public void SetResult_ThrowsIfSetTwice() { var testRun = new TestRun(null); var result = new TestEngineResult(); testRun.SetResult(result); Assert.Throws<InvalidOperationException>(() => testRun.SetResult(result)); }
public void SetResult_ThrowsIfSetTwice() { var testRun = new TestRun(null); var result = new TestEngineResult(); testRun.SetResult(result); Assert.Throws <InvalidOperationException>(() => testRun.SetResult(result)); }
public void IsComplete_TrueIfComplete() { var testRun = new TestRun(null); var result = new TestEngineResult(); testRun.SetResult(result); Assert.IsTrue(testRun.IsComplete); }
public void Wait_AllowsMultipleWaits() { var testRun = new TestRun(null); testRun.SetResult(new TestEngineResult()); Assert.IsTrue(testRun.Wait(TimeSpan.FromMilliseconds(0)), "Expected wait to be true because the test is complete"); Assert.IsTrue(testRun.Wait(TimeSpan.FromMilliseconds(0)), "Expected the second wait to be non blocking"); }
public void Wait_ReturnsFalseTillTestCompletes() { var testRun = new TestRun(null); var result = new TestEngineResult("<test-assembly />"); Assert.IsFalse(testRun.Wait(TimeSpan.FromMilliseconds(0)), "Expected wait to be false because test hasn't completed yet"); testRun.SetResult(result); Assert.IsTrue(testRun.Wait(TimeSpan.FromMilliseconds(0)), "Expected wait to be true because the test is complete"); Assert.AreEqual(result.Xml, testRun.Result); }
/// <summary> /// Start a run of the tests in the loaded TestPackage, returning immediately. /// The tests are run asynchronously and the listener interface is notified /// as it progresses. /// </summary> /// <param name="listener">An ITestEventHandler to receive events</param> /// <param name="filter">A TestFilter used to select tests</param> /// <returns>An <see cref="ITestRun"/> that will provide the result of the test execution</returns> protected virtual ITestRun RunTestsAsync(ITestEventListener listener, TestFilter filter) { var testRun = new TestRun(this); using (var worker = new BackgroundWorker()) { worker.DoWork += (s, ea) => { var result = RunTests(listener, filter); testRun.SetResult(result); }; worker.RunWorkerAsync(); } return(testRun); }
/// <summary> /// Start a run of the tests in the loaded TestPackage, returning immediately. /// The tests are run asynchronously and the listener interface is notified /// as it progresses. /// </summary> /// <param name="listener">An ITestEventHandler to receive events</param> /// <param name="filter">A TestFilter used to select tests</param> /// <returns>An <see cref="ITestRun"/> that will provide the result of the test execution</returns> protected virtual ITestRun RunTestsAsync(ITestEventListener listener, TestFilter filter) { var testRun = new TestRun(this); using (var worker = new BackgroundWorker()) { worker.DoWork += (s, ea) => { var result = RunTests(listener, filter); testRun.SetResult(result); }; worker.RunWorkerAsync(); } return testRun; }
public void SetResult_ThrowsIfNull() { var testRun = new TestRun(null); Assert.Throws <ArgumentNullException>(() => testRun.SetResult(null)); }
public void SetResult_ThrowsIfNull() { var testRun = new TestRun(null); Assert.Throws<ArgumentNullException>(() => testRun.SetResult(null)); }