public void TestThatTimesOutIsRanToCompletionWhenDebuggerIsAttachedBeforeTimeOut() { // give var testThatAttachesDebuggerAndTimesOut = TestBuilder.MakeTestCase(typeof(SampleTests), nameof(SampleTests.TestThatAttachesDebuggerAndTimesOut)); _debugger = new StubDebugger { IsAttached = false }; // when var result = TestBuilder.RunTest(testThatAttachesDebuggerAndTimesOut, new SampleTests(), _debugger); // then Assert.That(_testRanToCompletion, () => "Test did not run to completion"); }
public void TimeoutCausesOtherwisePassingTestToFailWithoutDebuggerAttached() { // given var testThatTimesOutButOtherwisePasses = TestBuilder.MakeTestCase(typeof(SampleTests), nameof(SampleTests.TestThatTimesOut)); var detachedDebugger = new StubDebugger { IsAttached = false }; // when var result = TestBuilder.RunTest(testThatTimesOutButOtherwisePasses, new SampleTests(), detachedDebugger); // then Assert.That(_testRanToCompletion == false, () => "Test ran to completion"); Assert.That(result.ResultState.Status, Is.EqualTo(TestStatus.Failed)); Assert.That(result.ResultState.Site, Is.EqualTo(FailureSite.Test)); Assert.That(result.ResultState.Label, Is.EqualTo($"Test exceeded Timeout value {SampleTests.Timeout}ms.")); }
public void TestThatTimesOutIsRanToCompletionAndItsResultIsPropagatedWhenDebuggerIsAttached(TestAction test) { // given _testAction = test.Action; var testThatTimesOut = TestBuilder.MakeTestCase(typeof(SampleTests), nameof(SampleTests.TestThatTimesOutAndInvokesAction)); var attachedDebugger = new StubDebugger { IsAttached = true }; // when var result = TestBuilder.RunTest(testThatTimesOut, new SampleTests(), attachedDebugger); // then Assert.That(_testRanToCompletion, () => "Test did not run to completion"); test.Assertion.Invoke(result); }
public void TestThatCompletesWithinTimeoutPeriodHasItsOriginalResultPropagated( [ValueSource(nameof(PossibleTestOutcomes))] TestAction test, [Values] bool isDebuggerAttached) { // given _testAction = test.Action; var testThatCompletesWithoutTimeout = TestBuilder.MakeTestCase(typeof(SampleTests), nameof(SampleTests.TestThatInvokesActionImmediately)); var debugger = new StubDebugger { IsAttached = isDebuggerAttached }; // when var result = TestBuilder.RunTest(testThatCompletesWithoutTimeout, new SampleTests(), debugger); // then test.Assertion.Invoke(result); }