使用 xUnit,您只需要实现ITestRunner
接口,即:
public class MyTestRunner : ITestRunner
{
// Methods
public MyTestRunner();
public static TestRunState RunAssembly(TestRunner runner);
public static TestRunState RunClass(TestRunner runner, Type type);
public static TestRunState RunClassWithInnerTypes(TestRunner runner, Type type);
public static TestRunState RunMethod(TestRunner runner, MethodInfo method);
TestRunState ITestRunner.RunAssembly(ITestListener listener, Assembly assembly);
TestRunState ITestRunner.RunMember(ITestListener listener, Assembly assembly, MemberInfo member);
TestRunState ITestRunner.RunNamespace(ITestListener listener, Assembly assembly, string ns);
}
有关实现细节,请获取 xUnit 的源代码并查看示例运行程序。