This exercise is guided tour in using NUnit (version 2.5.3) together with Visual C# 2008 Express on Windows. The exercise will help set up the BankAccount test, which we have seen on an earlier slide page in this material. If you use C# via another IDE, or on a non-Windows platform, you should not follow this guide.
We will assume that you already have installed Nunit and that you use Visual C# 2008 Express.
Start Visual C# 2008 Express. Use File > New Project... and make a Class Library project.
In the Solution Explorer (usually at the far right of you screen) right click References, and do Add Reference.... Select and add nunit.framework (version 2.5.3) from the list. (The list may be long, so be careful to select the right entry).
Use Project > Add Class... to add the BankAccount class. (Do copy and paste from the BankAccount class of this material).
Paste the BankAccountTest class instead of Class1, which was made automatically by Visual C# 2008 Express.
Now build your library application: Use F6 as usual. "Build succeeded" is expected.
Do File > Save All. Notice the Location of you project. On a piece of paper (or in a text editor) notice the full file path to your Visual C# 2008 project. You can also get information about your project locations via the C# 2008 Express menu entry Tools > Options..., 'Projects and Solutions'.
Start NUnit 2.5.3 - for instance via the Icon on your desktop or via the Windows start menu.
In NUnit use Tools -> Settings... and check the 'Enable Visual Studio Support' in the window which appears. You find the check box in IDE Support > Visual Studio. (This is most likely the default setting in NUNIT 2.5.3).
In NUnit use File > Open Project, and select the dll named after your project. The file is most likely located in the Bin/Debug branch of your project directory (as you should have noticed above).
Activate the Run button in NUnit. You should see 'green light'.
Introduce an run-time error in BankAccount class. Is the error revealed in unit test?
If you managed to get to here you should be able to use NUnit on your own stuff. Congratulations.
There is no solution to this exercise