Example #1
0
 protected override async Task <decimal> InvokeTestMethodAsync(ExceptionAggregator aggregator)
 {
     try
     {
         TestContextProvider.Initialize(TestMethod, TestMethodArguments);
         return(await base.InvokeTestMethodAsync(aggregator));
     }
     finally
     {
         TestContextProvider.Clear();
     }
 }
        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();
            }
        }
Example #3
0
        private void RunCase(TestClass testClass, Case testCase)
        {
            var instance = testClass.Construct();

            try
            {
                TestContextProvider.Initialize(testCase.Method, testCase.Parameters);
                testCase.Execute(instance);
                if (testCase.Exception is IgnoreException)
                {
                    testCase.Skip(testCase.Exception.Message);
                }
            }
            finally
            {
                TestContextProvider.Clear();
                instance.Dispose();
            }
        }
Example #4
0
 /// <summary>Executed after each test is run</summary>
 /// <param name="test">The test that has just been run.</param>
 public void AfterTest(ITest test)
 {
     TestContextProvider.Clear();
 }
 /// <summary>Executed after each test is run</summary>
 /// <param name="testDetails">Provides details about the test that has just been run.</param>
 public void AfterTest(TestDetails testDetails)
 {
     TestContextProvider.Clear();
 }