mattwhitfield / Unitverse

A unit test generation extension for Visual Studio that aims to always produce code that compiles - covering the basic cases automatically and preparing as much as it can for the complex cases.
MIT License
89 stars 20 forks source link

No Test Generated for Inherited method #241

Closed CoenraadS closed 8 months ago

CoenraadS commented 8 months ago

Describe the bug A clear and concise description of what the bug is.

When generating a test for a class that inherits a method, I expect a test for that method.

To Reproduce

public abstract class Test
{
    public void Render(StringBuilder sb)
    {

    }
}

public sealed class Test2 : Test
{

}

Trying to generate test for class Test2 results in:

image

config.txt

mattwhitfield commented 8 months ago

It is actually designed like that - because the behaviour isn't in the inheriting class. So, in general, tests are emitted for things defined in the class you are generating for, and not elsewhere...

Should every class emit a test for the ToString method, for example?

Happy to add an option that makes it behave differently - but interested to hear your thoughts on exactly what it should do - especially when the methods that you are inheriting are defined in a different assembly.

CoenraadS commented 8 months ago

I understand, I think I will rework my class to use less inheritance, wasn't really a fan of what I was doing anyway.. :)