Inheritance: XunitTestCaseRunner
Example #1
0
        public override Task <RunSummary> RunAsync(IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
        {
            TestTraceListener.Ensure();
            MessageBusOverride messageBusOverride = new MessageBusOverride(messageBus)
                                                    .AddAfterStartingBeforeFinished(new ExecuteBeforeAfterAttributesMessageBusInjection(Method, TestMethod.TestClass.Class));

            var testMethodArguments = GetTestMethodArguments();
            var runner = new TestCaseRunner(this, DisplayName, SkipReason, constructorArguments, testMethodArguments, messageBus, aggregator, cancellationTokenSource);

            if (ThreadType == ThreadType.UI)
            {
                return(UIThreadHelper.Instance.Invoke(runner.RunAsync));
            }

            messageBusOverride.AddAfterStartingBeforeFinished(new VerifyGlobalProviderMessageBusInjection());
            return(ThreadType == ThreadType.Background ? Task.Run(() => runner.RunAsync()) : runner.RunAsync());
        }
Example #2
0
        public override Task <RunSummary> RunAsync(IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
        {
            TestTraceListener.Ensure();
            var testMethodArguments = GetTestMethodArguments();
            var runner = new TestCaseRunner(this, DisplayName, SkipReason, constructorArguments, testMethodArguments, messageBus, aggregator, cancellationTokenSource);

            switch (ThreadType)
            {
            case ThreadType.UI:
                return(MainThreadFixture.Invoke(runner.RunAsync));

            case ThreadType.Background:
                return(Task.Run(() => runner.RunAsync()));

            default:
                return(runner.RunAsync());
            }
        }