private void TestFinished(TestOutcome outcome, string fixtureName, string testName, int assertCount, ulong durationNanosec, string reason, TestContextCallback callback) { ITestCommand fixtureCommand; if (!testCommandsByName.TryGetValue(fixtureName, out fixtureCommand)) { return; } ITestCommand testCommand; ITestContext testContext = null; if (testCommandsByName.TryGetValue(fixtureName + @"." + testName, out testCommand)) { if (testContextStack.Peek().TestStep.Test == testCommand.Test) { // Remove our test context from the stack testContext = testContextStack.Pop(); } } ITestContext fixtureContext = GetFixtureContext(fixtureCommand); if (testCommand != null) { if (testContext == null) { testContext = testCommand.StartPrimaryChildStep(fixtureContext.TestStep); testContext.LifecyclePhase = LifecyclePhases.Execute; progressMonitor.SetStatus(testCommand.Test.Name); } TimeSpan?duration = null; if (durationNanosec > 0) { // A tick is equal to 100 nanoseconds duration = TimeSpan.FromTicks((long)(durationNanosec / 100UL)); } if (callback != null) { callback(testContext); } testContext.AddAssertCount(assertCount); testContext.FinishStep(outcome, duration); progressMonitor.Worked(1); } else if (!String.IsNullOrEmpty(reason)) { MarkupStreamWriter log = fixtureContext.LogWriter.Failures; using (log.BeginSection(Resources.CSUnitTestController_ResultMessageSectionName)) { log.Write(reason); } } }
private void TestFinished(TestOutcome outcome, string fixtureName, string testName, int assertCount, ulong durationNanosec, string reason, TestContextCallback callback) { ITestCommand fixtureCommand; if (!testCommandsByName.TryGetValue(fixtureName, out fixtureCommand)) return; ITestCommand testCommand; ITestContext testContext = null; if (testCommandsByName.TryGetValue(fixtureName + @"." + testName, out testCommand)) { if (testContextStack.Peek().TestStep.Test == testCommand.Test) { // Remove our test context from the stack testContext = testContextStack.Pop(); } } ITestContext fixtureContext = GetFixtureContext(fixtureCommand); if (testCommand != null) { if (testContext == null) { testContext = testCommand.StartPrimaryChildStep(fixtureContext.TestStep); testContext.LifecyclePhase = LifecyclePhases.Execute; progressMonitor.SetStatus(testCommand.Test.Name); } TimeSpan? duration = null; if (durationNanosec > 0) { // A tick is equal to 100 nanoseconds duration = TimeSpan.FromTicks((long)(durationNanosec / 100UL)); } if (callback != null) callback(testContext); testContext.AddAssertCount(assertCount); testContext.FinishStep(outcome, duration); progressMonitor.Worked(1); } else if (!String.IsNullOrEmpty(reason)) { MarkupStreamWriter log = fixtureContext.LogWriter.Failures; using (log.BeginSection(Resources.CSUnitTestController_ResultMessageSectionName)) { log.Write(reason); } } }