Game Development Reference
In-Depth Information
location for the projects directory is in the MyDocuments directory under Visual
Studio 2010.
In here, you will find an exe file. This is the compiled version of the code. There is
also an nunit.framework.dll file; this is the NUnit reference that was included
earlier. The exe file won't be able to run without this dll.
To run the tests, select File > Open Project in the NUnit GUI. Navigate to the
compiled code in the release directory. Click on the PlayerTest.exe file. This will
load the test we wrote earlier in NUnit, as shown in Figure 4.24.
Click the Run button; the project tree should turn green and a tick will appear
next to BasicTest . This means the test ran successfully. If the code is changed
so that the test fails, the little green circles will turn red. Try changing the code to
fail then running the tests again.
An Example Project
The player class in the game must represent the concept that if the player eats a
mushroom, he gets bigger. It's assumed all players begin life small. That will be
the first test.
namespace PlayerTest
{
[TestFixture]
public class TestPlayer
{
[Test]
Figure 4.24
NUnit GUI loading the project.
 
Search WWH ::




Custom Search