#Unit test seems to just run the Main() function of my Nano project and not the unit test I created..
1 messages ยท Page 1 of 1 (latest)
You can't debug nano Unit Tests. Have to use VS test explorer or the vstest command line to execute. Then look at the run outcome. Full output log is available
make sure the runsettings file is found and sits at the correct location to be found
you can check any of our class libs that have unit tests
Yep, I came across this. My workaround is to put all my testable code in a separate project (nf class library) and execute unit tests against it. The main project (nf application) contains just minimum wire-up code.
I did similar thing ๐ Take a look here: https://github.com/CShark-Hub/Mako-IoT.Device.Samples/tree/main/WasteBinsCalendar
- src/MakoIoT.Samples.WBC.Device - testable device-agnostic logic
- src/MakoIoT.Samples.WBC.Device.App - wire-up and device-specific code
- tests/MakoIoT.Samples.WBC.Device.Tests - unit tests
If you really want to debug your tests, then you need to use project reference by cloning the test framework. In the project itslef, you have an example as it's used to debug the framework itself ๐
Otherwise, yes, a good practice is to split over the project
And note as well that you can use the unit as a normal project as well, if you are really lazy, just copy the "main" from the unit test framework, and that's your main. Debug is then possible
Nice hack! ๐ I've always been using Debug.WriteLine
๐