keep the bar green to keep the code clean
单元测试不是证明代码是对的,而是证明代码没有错
简单使用方法
被测试类
MathCompute.cs
测试类
每个测试类都要有TestFixture attribute.这样 nunit 框架才能用反射的方法发现测试类。
同样 测试方法都要有Test attribute,这样 nunit 框架才能用反射的方法发现测试方法。
最后判断测试结果基本上都用nunit框架中的 Assert 类中的静态方法。