1.下载nunit:
<a href="http://www.nunit.org/index.php?p=home">http://www.nunit.org/index.php?p=home</a>
2.创建测试的project
3.增加reference(nuit.framework)
4,写测试类(诸如):
using system;
using system.collections.generic;
using system.linq;
using system.text;
using nunit.framework;
namespace testnunit
{
[testfixture]
public class numersfixture
private int a;
private int b;
[setup]
public void initializeoperands()
a = 1;
b = 2;
}
[test]
public void addtwonumbers()
int sum = a + b;
assert.areequal(sum, 3);
public void multipllytwonumbers()
int product = a * b;
assert.areequal(2, product);
5.在project的properties中设置debug信息:
6.debug的时候就可以运行nunit