Closed drobertson123 closed 5 years ago
So you'd just want it to make the test file and methods for all the public methods?
Yes, basically.
The tools allow us to force consistency across the developers. It is a quick way to set up the test class in the right place and the right way. Ideally, I would like to be able to edit the template for the no mock option, but even a basic no frills option would be a huge help.
I'll put that support on the backlog. For now you could edit the VisualStudio/Moq template and take out the parts you don't need. It will default to Moq when it can't detect any mocking framework.
Sounds good. Thanks for responding on these.
Problem with this approach is that it makes it so you can't use boilerplate to render with Moq on a different project without changing the templates back again.
This is potentially an issue when your requirements for testing your organization's in-house code is different from that of 3rd party open source projects your organization contributes to.
However, it may be more useful to make the Mocking library option "Custom" rather than "None" as "None" implies no mocking and there is also a use-case for changing the parts to reflect other mocking libraries which aren't currently supported.
Implemented ability to choose "None" for a mock framework in 1.10.5.
In the generated test methods it will have "TODO" for constructor parameters as it has no way to know how to fill them.
Installed product versions
Description
Please add an option for using no Mock library. In many cases, we don't want a Mock layer in our testing. I do use mocks and appreciate them very much but mocks are not a one size fits all answer.
In many cases I want a simple test class constructed. A method for creating the object is great and a few support functions but otherwise just a basic class object would be wonderful.
Expected behavior
Right click on class and select "Create Unit Test Boilerplate..." Choose the appropriate test framework. In the Mock Framework drop-down there would be a selection of "None"
Create Unit Test would then create a test class using the appropriate template using No Mock library.