Today it was a lucky day and I found out how I can make my unit tests working in VS Express 2005.
Normally you can attach the debugger to the nunit-GUI – but not in the Express Version!
This is really annoying. So look here for the workaround.
If you are new to C# it is a little bit different as in Java to create a test case.
You can do the following
- Install NUnit
- Create a new project with your sources. E.g. call it HelloWorld. (choose Windows Application)
- Add a new project with your tests to the solution. E.g. call it HelloWorldTest. Right click the solution and click ‘New Project’ (choose class library)
- Then right click HelloWorldTest and ‘Add Reference’. Browse until you find \ProgramFiles\NUnit\bin\nunit.framework.dll
- Add some unit test to HelloWorldTest
- Apply the mentioned hack above on HelloWorldTest.csproj
- Right click HelloWorldTest and click ‘Specify as StartUp Project’
- Press F5 and you should see the NUnit-GUI running your test cases. Now you can set breakpoints and evaluate expression in the test class (like you would do in HelloWorld).