예제 #1
0
파일: FailSkipSink.cs 프로젝트: ahri/xunit
        /// <inheritdoc/>
        public override bool OnMessageWithTypes(IMessageSinkMessage message, string[] messageTypes)
        {
            var hashedTypes = GetMessageTypesAsHashSet(messageTypes);

            var testSkipped = Cast <ITestSkipped>(message, hashedTypes);

            if (testSkipped != null)
            {
                SkipCount++;
                var testFailed = new TestFailed(testSkipped.Test, 0M, "",
                                                new[] { "FAIL_SKIP" },
                                                new[] { testSkipped.Reason },
                                                new[] { "" },
                                                new[] { -1 });
                return(Sink.OnMessageWithTypes(testFailed, TestFailedTypes));
            }

            var testCollectionFinished = Cast <ITestCollectionFinished>(message, hashedTypes);

            if (testCollectionFinished != null)
            {
                testCollectionFinished = new TestCollectionFinished(testCollectionFinished.TestCases,
                                                                    testCollectionFinished.TestCollection,
                                                                    testCollectionFinished.ExecutionTime,
                                                                    testCollectionFinished.TestsRun,
                                                                    testCollectionFinished.TestsFailed + testCollectionFinished.TestsSkipped,
                                                                    0);
                return(Sink.OnMessageWithTypes(testCollectionFinished, TestCollectionFinishedTypes));
            }

            var assemblyFinished = Cast <ITestAssemblyFinished>(message, hashedTypes);

            if (assemblyFinished != null)
            {
                assemblyFinished = new TestAssemblyFinished(assemblyFinished.TestCases,
                                                            assemblyFinished.TestAssembly,
                                                            assemblyFinished.ExecutionTime,
                                                            assemblyFinished.TestsRun,
                                                            assemblyFinished.TestsFailed + assemblyFinished.TestsSkipped,
                                                            0);
                return(Sink.OnMessageWithTypes(assemblyFinished, TestAssemblyFinishedTypes));
            }

            return(Sink.OnMessageWithTypes(message, messageTypes));
        }
예제 #2
0
        /// <inheritdoc/>
        public override bool OnMessage(IMessageSinkMessage message)
        {
            var testSkipped = message as ITestSkipped;

            if (testSkipped != null)
            {
                SkipCount++;
                var testFailed = new TestFailed(testSkipped.Test, 0M, "",
                                                new[] { "FAIL_SKIP" },
                                                new[] { testSkipped.Reason },
                                                new[] { "" },
                                                new[] { -1 });
                return(Visitor.OnMessage(testFailed));
            }

            var testCollectionFinished = message as ITestCollectionFinished;

            if (testCollectionFinished != null)
            {
                testCollectionFinished = new TestCollectionFinished(testCollectionFinished.TestCases,
                                                                    testCollectionFinished.TestCollection,
                                                                    testCollectionFinished.ExecutionTime,
                                                                    testCollectionFinished.TestsRun,
                                                                    testCollectionFinished.TestsFailed + testCollectionFinished.TestsSkipped,
                                                                    0);
                return(Visitor.OnMessage(testCollectionFinished));
            }

            var assemblyFinished = message as ITestAssemblyFinished;

            if (assemblyFinished != null)
            {
                assemblyFinished = new TestAssemblyFinished(assemblyFinished.TestCases,
                                                            assemblyFinished.TestAssembly,
                                                            assemblyFinished.ExecutionTime,
                                                            assemblyFinished.TestsRun,
                                                            assemblyFinished.TestsFailed + assemblyFinished.TestsSkipped,
                                                            0);
                var result = Visitor.OnMessage(assemblyFinished);
                base.OnMessage(assemblyFinished);
                return(result);
            }

            return(Visitor.OnMessage(message));
        }
예제 #3
0
        /// <inheritdoc/>
        public bool OnMessageWithTypes(IMessageSinkMessage message, HashSet <string> messageTypes)
        {
            var testSkipped = message.Cast <ITestSkipped>(messageTypes);

            if (testSkipped != null)
            {
                skipCount++;
                var testFailed = new TestFailed(testSkipped.Test, 0M, "",
                                                new[] { "FAIL_SKIP" },
                                                new[] { testSkipped.Reason },
                                                new[] { "" },
                                                new[] { -1 });
                return(innerSink.OnMessage(testFailed));
            }

            var testCollectionFinished = message.Cast <ITestCollectionFinished>(messageTypes);

            if (testCollectionFinished != null)
            {
                testCollectionFinished = new TestCollectionFinished(testCollectionFinished.TestCases,
                                                                    testCollectionFinished.TestCollection,
                                                                    testCollectionFinished.ExecutionTime,
                                                                    testCollectionFinished.TestsRun,
                                                                    testCollectionFinished.TestsFailed + testCollectionFinished.TestsSkipped,
                                                                    0);
                return(innerSink.OnMessage(testCollectionFinished));
            }

            var assemblyFinished = message.Cast <ITestAssemblyFinished>(messageTypes);

            if (assemblyFinished != null)
            {
                assemblyFinished = new TestAssemblyFinished(assemblyFinished.TestCases,
                                                            assemblyFinished.TestAssembly,
                                                            assemblyFinished.ExecutionTime,
                                                            assemblyFinished.TestsRun,
                                                            assemblyFinished.TestsFailed + assemblyFinished.TestsSkipped,
                                                            0);
                return(innerSink.OnMessage(assemblyFinished));
            }

            return(innerSink.OnMessageWithTypes(message, messageTypes));
        }
        /// <inheritdoc/>
        public bool OnMessageWithTypes(IMessageSinkMessage message, HashSet<string> messageTypes)
        {
            var testSkipped = message.Cast<ITestSkipped>(messageTypes);
            if (testSkipped != null)
            {
                skipCount++;
                var testFailed = new TestFailed(testSkipped.Test, 0M, "",
                                                new[] { "FAIL_SKIP" },
                                                new[] { testSkipped.Reason },
                                                new[] { "" },
                                                new[] { -1 });
                return innerSink.OnMessage(testFailed);
            }

            var testCollectionFinished = message.Cast<ITestCollectionFinished>(messageTypes);
            if (testCollectionFinished != null)
            {
                testCollectionFinished = new TestCollectionFinished(testCollectionFinished.TestCases,
                                                                    testCollectionFinished.TestCollection,
                                                                    testCollectionFinished.ExecutionTime,
                                                                    testCollectionFinished.TestsRun,
                                                                    testCollectionFinished.TestsFailed + testCollectionFinished.TestsSkipped,
                                                                    0);
                return innerSink.OnMessage(testCollectionFinished);
            }

            var assemblyFinished = message.Cast<ITestAssemblyFinished>(messageTypes);
            if (assemblyFinished != null)
            {
                assemblyFinished = new TestAssemblyFinished(assemblyFinished.TestCases,
                                                            assemblyFinished.TestAssembly,
                                                            assemblyFinished.ExecutionTime,
                                                            assemblyFinished.TestsRun,
                                                            assemblyFinished.TestsFailed + assemblyFinished.TestsSkipped,
                                                            0);
                return innerSink.OnMessage(assemblyFinished);
            }

            return innerSink.OnMessageWithTypes(message, messageTypes);
        }