Working with TestRunner
Once TestRunner is installed, it can be initialised from the Tools menu of the VS IDE. The TestRunner window can be docked alongside the solution explorer within Visual Studio so that it is easily accessed during development. One additional benefit of using TestRunner is that it automatically updates itself whenever the application is built. This means your test cases are always current and there is no need to reload them (as is required by the NUnit GUI, for instance).
TestRunner executes your NUnit tests from within the Visual Studio IDE.
Anatomy of a unit testNUnit exploits the attribute capabilities of .NET to automatically locate and register test cases within your application. This means you can create test fixtures without any need to tell NUnit about them. In all, there are six attributes that can be used to build and configure your test cases, the most important of which is TextFixture. This attribute informs NUnit that the current class contains test cases. Next, the Test attribute is used to notify NUnit that the method directly following is in fact a unit test. A unit test method must be public, accept zero parameters and return void. Combined, these two attributes are all you need to build a simple unit test such as the following.
namespace UnitTests
{
using System;
using NUnit.Framework;
[TestFixture]
public class UnitTestClass _
{
[Test]
public void UnitTest ()
{
// test code goes here
}
}
}