protected override async Task <Tuple <decimal, string> > InvokeTestAsync(ExceptionAggregator aggregator)
        {
            var testOutputHelper = ConstructorArguments.OfType <TestOutputHelper>().FirstOrDefault() ?? new TestOutputHelper();

            testOutputHelper.Initialize(MessageBus, Test);
            try
            {
                TestContextProvider.Initialize(TestMethod, TestMethodArguments, testOutputHelper, SkipReason);
                var totalTime = await InvokeTestMethodAsync(aggregator);

                return(Tuple.Create(totalTime, testOutputHelper.Output));
            }
            finally
            {
                testOutputHelper.Uninitialize();
                TestContextProvider.Clear();
            }
        }
Exemple #2
0
        /// <inheritdoc/>
        protected override async Task <Tuple <decimal, string> > InvokeTestAsync(ExceptionAggregator aggregator)
        {
            var output           = String.Empty;
            var testOutputHelper = ConstructorArguments.OfType <TestOutputHelper>().FirstOrDefault();

            if (testOutputHelper != null)
            {
                testOutputHelper.Initialize(MessageBus, Test);
            }

            var executionTime = await InvokeTestMethodAsync(aggregator);

            if (testOutputHelper != null)
            {
                output = testOutputHelper.Output;
                testOutputHelper.Uninitialize();
            }

            return(Tuple.Create(executionTime, output));
        }
Exemple #3
0
        /// <inheritdoc/>
        protected override async Task <Tuple <decimal, string> > InvokeTestAsync(ExceptionAggregator aggregator)
        {
            var output           = String.Empty;
            var testOutputHelper = ConstructorArguments.OfType <TestOutputHelper>().FirstOrDefault();

            if (testOutputHelper != null)
            {
                testOutputHelper.Initialize(MessageBus, Test);
            }

            var executionTime = await new XunitTestInvoker(Test, MessageBus, TestClass, ConstructorArguments, TestMethod, TestMethodArguments, beforeAfterAttributes, aggregator, CancellationTokenSource).RunAsync();

            if (testOutputHelper != null)
            {
                output = testOutputHelper.Output;
                testOutputHelper.Uninitialize();
            }

            return(Tuple.Create(executionTime, output));
        }
Exemple #4
0
        protected override async Task <Tuple <decimal, string> > InvokeTestAsync(ExceptionAggregator aggregator)
        {
            string output = string.Empty;

            var testOutputHelper = TestMethodArguments.OfType <TestOutputHelper>().FirstOrDefault();

            if (testOutputHelper == null)
            {
                testOutputHelper = ConstructorArguments.OfType <TestOutputHelper>().FirstOrDefault();
            }

            if (testOutputHelper == null)
            {
                testOutputHelper = new TestOutputHelper();
            }

            testOutputHelper?.Initialize(MessageBus, Test);

            decimal item = await InvokeTestMethodAsync(aggregator);

            if (testOutputHelper != null)
            {
                output = testOutputHelper.Output;

                var scenarioRunOutput = RenderScenarioReport(Scenario);
                if (scenarioRunOutput != null)
                {
                    if (output.Length == 0)
                    {
                        scenarioRunOutput = scenarioRunOutput.Trim();
                    }

                    output += scenarioRunOutput;
                }

                testOutputHelper.Uninitialize();
            }

            return(Tuple.Create(item, output));
        }