Ejemplo 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();
            }
        }
Ejemplo 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();
            }
        }
Ejemplo 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);
 }
Ejemplo n.º 5
0
 /// <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);
 }