using System.Collections;
public static void Main()
var x = new NUnitLite.AutoRun().Execute(new string[]{"--test:CalculatorTests", "--noc"});
Console.WriteLine("----------------------------------------------");
Console.WriteLine(x == 0 ? "通过全部测试... (o_o)" : string.Format("{0} 测试失败... (>_<)", x));
Console.WriteLine("----------------------------------------------");
public class CalculatorTests
for (int i = 0; i < 3; i++)
Console.WriteLine($"Add({a}, {b})");
Assert.AreEqual(a + b, result);
public void DemoTest1(int a, int b)
Console.WriteLine($"Add({a}, {b})");
Assert.AreEqual(a + b, result);
public void DemoTest2([Values(1, 2, 3)] int a, [Values(4, 5, 6)] int b)
public void DemoTest3([Values(1, 2, 3)] int a, [Values(4, 5, 6)] int b)
[TestCaseSource(typeof(MyValueProvider), nameof(MyValueProvider.ar))]
public void DemoTest4(int a, int b)
public void DemoTest5([Random(3)] int a, [Random(3)] int b)
public class MyValueProvider
public static ArrayList ar = new ArrayList{new int[]{1, 4}, new int[]{2, 5}, new int[]{3, 6}};