public TestRunState Run(ITestListener testListener, string assemblyFile, string cref) { if (testListener == null) { throw new ArgumentNullException("testListener"); } if (assemblyFile == null) { throw new ArgumentNullException("assemblyFile"); } FacadeOptions options = FacadeOptions.ReadFromRegistry(); FacadeTestRunState result = TestRunner.Run(new AdapterFacadeTestListener(testListener), assemblyFile, cref, options); return(FacadeUtils.ToTestRunState(result)); }
public TestRunState RunAssembly(ITestListener testListener, Assembly assembly) { if (testListener == null) { throw new ArgumentNullException("testListener"); } if (assembly == null) { throw new ArgumentNullException("assembly"); } FacadeOptions options = FacadeOptions.ReadFromRegistry(); FacadeTestRunState result = TestRunner.Run(new AdapterFacadeTestListener(testListener), GetAssemblyPath(assembly), null, options); return(FacadeUtils.ToTestRunState(result)); }
public void RunReturnsCorrectResultCode(int resultCode, FacadeTestRunState expectedRunState) { StubbedLocalTestRunner tr = new StubbedLocalTestRunner(); Assembly assembly = typeof(TDNetAddInTests).Assembly; string assemblyPath = AssemblyUtils.GetAssemblyLocalPath(assembly); tr.SetRunLauncherAction(delegate { TestLauncherResult result = new TestLauncherResult(new Report()); result.SetResultCode(resultCode); return(result); }); FacadeOptions facadeOptions = new FacadeOptions(); FacadeTestRunState runResult = tr.Run(MockRepository.GenerateStub <IFacadeTestListener>(), assemblyPath, null, facadeOptions); Assert.AreEqual(expectedRunState, runResult); }
public static TestRunState ToTestRunState(FacadeTestRunState state) { switch (state) { case FacadeTestRunState.Success: return(TestRunState.Success); case FacadeTestRunState.Failure: return(TestRunState.Failure); case FacadeTestRunState.Error: return(TestRunState.Error); case FacadeTestRunState.NoTests: return(TestRunState.NoTests); default: throw new ArgumentOutOfRangeException("state"); } }
public void RunReturnsCorrectResultCode(int resultCode, FacadeTestRunState expectedRunState) { StubbedLocalTestRunner tr = new StubbedLocalTestRunner(); Assembly assembly = typeof(TDNetAddInTests).Assembly; string assemblyPath = AssemblyUtils.GetAssemblyLocalPath(assembly); tr.SetRunLauncherAction(delegate { TestLauncherResult result = new TestLauncherResult(new Report()); result.SetResultCode(resultCode); return result; }); FacadeOptions facadeOptions = new FacadeOptions(); FacadeTestRunState runResult = tr.Run(MockRepository.GenerateStub<IFacadeTestListener>(), assemblyPath, null, facadeOptions); Assert.AreEqual(expectedRunState, runResult); }
public static TestRunState ToTestRunState(FacadeTestRunState state) { switch (state) { case FacadeTestRunState.Success: return TestRunState.Success; case FacadeTestRunState.Failure: return TestRunState.Failure; case FacadeTestRunState.Error: return TestRunState.Error; case FacadeTestRunState.NoTests: return TestRunState.NoTests; default: throw new ArgumentOutOfRangeException("state"); } }