Example #1
0
        public async ValueTask TestCollectionCleanupFailure()
        {
            var collectionStarting = new _TestCollectionStarting
            {
                AssemblyUniqueID          = assemblyID,
                TestCollectionDisplayName = "FooBar",
                TestCollectionUniqueID    = collectionID
            };
            var collectionCleanupFailure = new _TestCollectionCleanupFailure
            {
                AssemblyUniqueID       = assemblyID,
                ExceptionParentIndices = exceptionParentIndices,
                ExceptionTypes         = exceptionTypes,
                Messages               = messages,
                StackTraces            = stackTraces,
                TestCollectionUniqueID = collectionID
            };
            var listener = Substitute.For <ITestListener>();

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

            sink.OnMessage(collectionStarting);
            sink.OnMessage(collectionCleanupFailure);

            AssertFailure(listener, sink.TestRunState, "Test Collection Cleanup Failure (FooBar)");
        }
    public void TestCollectionCleanupFailure()
    {
        var collectionStarting = new _TestCollectionStarting
        {
            AssemblyUniqueID          = assemblyID,
            TestCollectionDisplayName = "FooBar",
            TestCollectionUniqueID    = collectionID
        };
        var collectionCleanupFailure = new _TestCollectionCleanupFailure
        {
            AssemblyUniqueID       = assemblyID,
            ExceptionParentIndices = exceptionParentIndices,
            ExceptionTypes         = exceptionTypes,
            Messages               = messages,
            StackTraces            = stackTraces,
            TestCollectionUniqueID = collectionID
        };
        var assemblyElement = new XElement("assembly");
        var sink            = new DelegatingXmlCreationSink(innerSink, assemblyElement);

        sink.OnMessage(collectionStarting);
        sink.OnMessage(collectionCleanupFailure);

        AssertFailureElement(assemblyElement, "test-collection-cleanup", "FooBar");
    }
        public void TestCollectionCleanupFailure()
        {
            var collectionStarting = new _TestCollectionStarting
            {
                AssemblyUniqueID          = assemblyID,
                TestCollectionDisplayName = "FooBar",
                TestCollectionUniqueID    = collectionID
            };
            var collectionCleanupFailure = new _TestCollectionCleanupFailure
            {
                AssemblyUniqueID       = assemblyID,
                ExceptionParentIndices = exceptionParentIndices,
                ExceptionTypes         = exceptionTypes,
                Messages               = messages,
                StackTraces            = stackTraces,
                TestCollectionUniqueID = collectionID
            };
            var handler = TestableDefaultRunnerReporterMessageHandler.Create();

            handler.OnMessage(collectionStarting);
            handler.OnMessage(collectionCleanupFailure);

            AssertFailureMessages(handler.Messages, "Test Collection Cleanup Failure (FooBar)");
        }