Thursday, August 10, 2006

C# : NUnit

NUnit is a very powerful way of testing using extreme programming. Check out:

NUnit

The simple sample isn't all that clear. If you wanted to test a method Return0 in a class called CSharp1 which looked like:

public int Return0 ()
{

return 0;

}

use the following in CSharp1Test:

[Test]
public void CheckReturn()
{

CSharp1 cs = new CSharp1 ();

int ret = cs.Return0();

Assert.AreEqual(0, ret, "Should return 0");

}

No comments: