Esempio n. 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();
            }
        }
Esempio n. 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();
            }
        }
Esempio n. 4
0
 /// <summary>Executed before each test is run</summary>
 /// <param name="test">The test that is going to be run.</param>
 public void BeforeTest(ITest test)
 {
     TestContextProvider.Initialize(test.Method.MethodInfo, test.Arguments);
 }
 /// <summary>Executed before each test is run</summary>
 /// <param name="testDetails">Provides details about the test that is going to be run.</param>
 public void BeforeTest(TestDetails testDetails)
 {
     TestContextProvider.Initialize(testDetails.Method);
 }