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

Error at generating UnitTest MSTest "System.NullReferenceException" #48

Closed jcmisena closed 5 years ago

jcmisena commented 5 years ago

Installed product versions

Steps to recreate

  1. Right Click on Controller
  2. Click on Generate Unite Test Boilerplate
  3. Click on Create Unit Test Class
  4. Opens a modal window with lines about the exception
RandomEngy commented 5 years ago

Can you post the code you were trying to create a test for?

RealUlysse commented 5 years ago

I have the same issue. It comes from parameter attribute in my case. In the exemple below, it works if I remove FromBody attribute. public async Task<IHttpActionResult> MettreAJourPersonneRessource(int numeroPersonneRessource, [FromBody]PersonneRessource personneRessource)

RandomEngy commented 5 years ago

Thanks for the reports and the bug details. This is fixed in 2.0.1.

Please leave a review if you like the extension!