NUnit is an unit testing framework for the .Net framework and is based on JUnit.
Minimal setup:
For making a test case, a normal c# class is created, which imports the NUnit framework.
using NUnit.Framework
The class must have the attribute [TextFixture] to indicate, that this class has test code.
The attributes [SetUp] and [TearDown] are optional and can be used if some pre/post conditions are need for each test (e.g. resetting the DB).
The different test cases are marked by the attribute [Test]. Different static methods of the Assert class are used for checking the results.
Example:
[TextFixture]
public class MyTests
{
[SetUp]
public void setup()
{
//fill database with test data
}
[TearDown]
public void tearDown()
{
//delete data in database
}
[Test]
public void test1()
{
user = ... //search for user by id
Assert.AreEqual(name, user.name);
}
}