private void HandleTestOrSuiteFinished(NUnit.Core.TestResult nunitResult)
            {
                if (testContextStack.Count == 0)
                {
                    return;
                }

                ITestContext testContext = testContextStack.Peek();
                NUnitTest    test        = (NUnitTest)testContext.TestStep.Test;

                if (test.Test.TestName != nunitResult.Test.TestName)
                {
                    return;
                }

                testContextStack.Pop();

                progressMonitor.Worked(1);

                string logStreamName = nunitResult.ResultState == ResultState.Success ? MarkupStreamNames.Warnings : MarkupStreamNames.Failures;

                MarkupDocumentWriter logWriter = testContext.LogWriter;

                if (nunitResult.Message != null)
                {
                    using (logWriter[logStreamName].BeginSection(Resources.NUnitTestController_ResultMessageSectionName))
                        logWriter[logStreamName].Write(nunitResult.Message);
                }
                if (nunitResult.StackTrace != null)
                {
                    using (logWriter[logStreamName].BeginSection(Resources.NUnitTestController_ResultStackTraceSectionName))
                        using (logWriter[logStreamName].BeginMarker(Marker.StackTrace))
                            logWriter[logStreamName].Write(nunitResult.StackTrace);
                }

                testContext.AddAssertCount(nunitResult.AssertCount);
                TestResult result = testContext.FinishStep(CreateOutcomeFromResult(nunitResult), null);

                if (testContextStack.Count == 0)
                {
                    topResult = result;
                }
            }
            private void HandleTestOrSuiteFinished(NUnit.Core.TestResult nunitResult)
            {
                if (testContextStack.Count == 0)
                    return;

                ITestContext testContext = testContextStack.Peek();
                NUnitTest test = (NUnitTest) testContext.TestStep.Test;
                if (test.Test.TestName != nunitResult.Test.TestName)
                    return;

                testContextStack.Pop();

                progressMonitor.Worked(1);

                string logStreamName = nunitResult.ResultState == ResultState.Success ? MarkupStreamNames.Warnings : MarkupStreamNames.Failures;

                MarkupDocumentWriter logWriter = testContext.LogWriter;
                if (nunitResult.Message != null)
                {
                    using (logWriter[logStreamName].BeginSection(Resources.NUnitTestController_ResultMessageSectionName))
                        logWriter[logStreamName].Write(nunitResult.Message);
                }
                if (nunitResult.StackTrace != null)
                {
                    using (logWriter[logStreamName].BeginSection(Resources.NUnitTestController_ResultStackTraceSectionName))
                        using (logWriter[logStreamName].BeginMarker(Marker.StackTrace))
                            logWriter[logStreamName].Write(nunitResult.StackTrace);
                }

                testContext.AddAssertCount(nunitResult.AssertCount);
                TestResult result = testContext.FinishStep(CreateOutcomeFromResult(nunitResult), null);
                if (testContextStack.Count == 0)
                    topResult = result;
            }