microsoft / UnitTestBoilerplateGenerator

An extension for Visual Studio that generates a unit test boilerplate from a given class, setting up mocks for all dependencies. Supports NUnit, Visual Studio Test, Moq and SimpleStubs.
MIT License
158 stars 51 forks source link

Default target framework and mock framework #26

Closed generik0 closed 6 years ago

generik0 commented 6 years ago

Hi

Just want to start by saying that this extension is the best thing since sliced cheeeeszzee.

Installed product versions

Description

Is it possible that the tools->options can get a "IsDefault" for the test framework and the mock framework. So i don't need to change to NUnit and NSubstritute, which is my companies weapon of choice...

Regards, Rik

RandomEngy commented 6 years ago

The extension has logic to try and set those automatically by checking the .csproj for assembly and nuget references. Can you share the .csproj for the project you're using, so I can find out why the auto-detect logic isn't working for you?

generik0 commented 6 years ago

@RandomEngy so that is why it sometimes finds the right stuff.

Our issue is that the test projects are old, and even though we use NUnit and NSub now, have used others in the past. So unfortunately finds the wrong ones :-/

Strange thing is, we do not have VS test framework in tests but always finds that first. I will see what I can find :-)

So this issues should be to assign a default, when more than one framework is present :-)

Br Rik

RandomEngy commented 6 years ago

It should be finding VS Test framework as a "last resort" if it doesn't find another framework. Would still be handy to see the .csproj file as there might be something more going wrong. Still, it's a good idea; I'll add a "preferred framework" feature to the backlog, to use when multiple frameworks or no frameworks are found.

generik0 commented 6 years ago

Hi @RandomEngy I found an example. The Test framework is incorrect, the mock framework is correct.

image

I have provided the csproj using email.

RandomEngy commented 6 years ago

Released 1.8.0, which does several things to help:

Remember to leave a review on the marketplace if you like the extension!