public void TestCaseCleanupFailure()
        {
            var caseStarting = new _TestCaseStarting
            {
                AssemblyUniqueID       = assemblyID,
                TestCaseUniqueID       = testCaseID,
                TestCaseDisplayName    = "MyTestCase",
                TestClassUniqueID      = classID,
                TestCollectionUniqueID = collectionID,
                TestMethodUniqueID     = methodID
            };
            var caseCleanupFailure = new _TestCaseCleanupFailure
            {
                AssemblyUniqueID       = assemblyID,
                ExceptionParentIndices = exceptionParentIndices,
                ExceptionTypes         = exceptionTypes,
                Messages               = messages,
                StackTraces            = stackTraces,
                TestCaseUniqueID       = testCaseID,
                TestCollectionUniqueID = collectionID,
                TestClassUniqueID      = classID,
                TestMethodUniqueID     = methodID
            };
            var handler = TestableDefaultRunnerReporterMessageHandler.Create();

            handler.OnMessage(caseStarting);
            handler.OnMessage(caseCleanupFailure);

            AssertFailureMessages(handler.Messages, "Test Case Cleanup Failure (MyTestCase)");
        }
Пример #2
0
        public async ValueTask TestCaseCleanupFailure()
        {
            var caseStarting = new _TestCaseStarting
            {
                AssemblyUniqueID       = assemblyID,
                TestCaseUniqueID       = testCaseID,
                TestCaseDisplayName    = "MyTestCase",
                TestClassUniqueID      = classID,
                TestCollectionUniqueID = collectionID,
                TestMethodUniqueID     = methodID
            };
            var caseCleanupFailure = new _TestCaseCleanupFailure
            {
                AssemblyUniqueID       = assemblyID,
                ExceptionParentIndices = exceptionParentIndices,
                ExceptionTypes         = exceptionTypes,
                Messages               = messages,
                StackTraces            = stackTraces,
                TestCaseUniqueID       = testCaseID,
                TestCollectionUniqueID = collectionID,
                TestClassUniqueID      = classID,
                TestMethodUniqueID     = methodID
            };
            var listener = Substitute.For <ITestListener>();

            await using var sink = new ResultSink(listener, 42)
                        {
                            TestRunState = TestRunState.NoTests
                        };

            sink.OnMessage(caseStarting);
            sink.OnMessage(caseCleanupFailure);

            AssertFailure(listener, sink.TestRunState, "Test Case Cleanup Failure (MyTestCase)");
        }
    public void TestCaseCleanupFailure()
    {
        var caseStarting = new _TestCaseStarting
        {
            AssemblyUniqueID       = assemblyID,
            TestCaseUniqueID       = testCaseID,
            TestCaseDisplayName    = "MyTestCase",
            TestClassUniqueID      = classID,
            TestCollectionUniqueID = collectionID,
            TestMethodUniqueID     = methodID
        };
        var caseCleanupFailure = new _TestCaseCleanupFailure
        {
            AssemblyUniqueID       = assemblyID,
            ExceptionParentIndices = exceptionParentIndices,
            ExceptionTypes         = exceptionTypes,
            Messages               = messages,
            StackTraces            = stackTraces,
            TestCaseUniqueID       = testCaseID,
            TestCollectionUniqueID = collectionID,
            TestClassUniqueID      = classID,
            TestMethodUniqueID     = methodID
        };
        var assemblyElement = new XElement("assembly");
        var sink            = new DelegatingXmlCreationSink(innerSink, assemblyElement);

        sink.OnMessage(caseStarting);
        sink.OnMessage(caseCleanupFailure);

        AssertFailureElement(assemblyElement, "test-case-cleanup", "MyTestCase");
    }