public void RerunFixtureAfterSetUpFixed() { MisbehavingFixtureSetUp testFixture = new MisbehavingFixtureSetUp(); TestSuite suite = new TestSuite("ASuite"); suite.Add(testFixture); TestSuiteResult result = (TestSuiteResult)suite.Run(NullListener.NULL); // should have one suite and one fixture ResultSummarizer summ = new ResultSummarizer(result); Assert.AreEqual(1, summ.ResultCount); Assert.AreEqual(0, summ.TestsNotRun); Assert.AreEqual(0, summ.SuitesNotRun); TestResult failedResult = ((TestResult)result.Results[0]); Assert.IsTrue(failedResult.Executed, "Suite should have executed"); //fix the blow up in setup testFixture.blowUp = false; result = (TestSuiteResult)suite.Run(NullListener.NULL); // should have one suite and one fixture summ = new ResultSummarizer(result); Assert.AreEqual(1, summ.ResultCount); Assert.AreEqual(0, summ.TestsNotRun); Assert.AreEqual(0, summ.SuitesNotRun); }
public void HandleErrorInFixtureSetup() { MisbehavingFixtureSetUp testFixture = new MisbehavingFixtureSetUp(); TestSuite suite = new TestSuite("ASuite"); suite.Add(testFixture); TestSuiteResult result = (TestSuiteResult)suite.Run(NullListener.NULL); // should have one suite and one fixture ResultSummarizer summ = new ResultSummarizer(result); Assert.AreEqual(1, summ.ResultCount); Assert.AreEqual(0, summ.TestsNotRun); Assert.AreEqual(0, summ.SuitesNotRun); TestSuiteResult failedResult = ((TestSuiteResult)result.Results[0]); Assert.IsTrue(failedResult.Executed, "Suite should have executed"); Assert.IsTrue(failedResult.IsFailure, "Suite should have failed"); Assert.AreEqual("This was thrown from fixture setup", failedResult.Message, "TestSuite Message"); Assert.IsNotNull(failedResult.StackTrace, "TestSuite StackTrace should not be null"); TestResult testResult = ((TestResult)failedResult.Results[0]); Assert.IsTrue(testResult.Executed, "Testcase should have executed"); Assert.AreEqual("This was thrown from fixture setup", testResult.Message, "TestCase Message"); Assert.AreEqual(testResult.StackTrace, testResult.StackTrace, "TestCase stackTrace should match TestSuite stackTrace"); }