private void Run(string assembly, string nspace, string type, string method) { Assembly asm = Assembly.LoadFrom(assembly); if (string.IsNullOrEmpty(nspace)) { FilteredTestRunner.RunAssembly(this, asm); } else if (string.IsNullOrEmpty(type)) { FilteredTestRunner.RunNamespace(this, asm, nspace); } else { Type t = asm.GetType(string.Concat(nspace, ".", type)); if (t == null) { throw new Exception("Unable to load type."); } MemberInfo mi; if (string.IsNullOrEmpty(method)) { mi = t; } else { mi = t.GetMethod(method); if (mi == null) { throw new Exception("Unable to load function."); } } FilteredTestRunner.RunMember(this, asm, mi); } }
/// <summary> /// Runs the tests in a namespace. /// </summary> public TestRunState RunNamespace(ITestListener testListener, Assembly assembly, string ns) { switch (FilteredTestRunner.RunNamespace(new ProxyListener(testListener), assembly, ns)) { case Testing.TestRunner.TestStatus.Pass: return(TestRunState.Success); case Testing.TestRunner.TestStatus.Untested: case Testing.TestRunner.TestStatus.Ignore: return(TestRunState.NoTests); case Testing.TestRunner.TestStatus.Fail: default: return(TestRunState.Error); } }
/// <summary> /// Runs the tests in a Type or Method. /// </summary> public TestRunState RunMember(ITestListener testListener, Assembly assembly, MemberInfo member) { switch (FilteredTestRunner.RunMember(new ProxyListener(testListener), assembly, member)) { case Testing.TestRunner.TestStatus.Pass: return(TestRunState.Success); case Testing.TestRunner.TestStatus.Untested: case Testing.TestRunner.TestStatus.Ignore: return(TestRunState.NoTests); case Testing.TestRunner.TestStatus.Fail: default: return(TestRunState.Error); } }