示例#1
0
        /// <inheritdoc />
        protected override async void RunTestCases(
            IEnumerable <IXunitTestCase> testCases,
            IMessageSink executionMessageSink,
            ITestFrameworkExecutionOptions executionOptions)
        {
            if (_host == null)
            {
                using var runner = new DependencyInjectionTestAssemblyRunner(null, TestAssembly,
                                                                             testCases, DiagnosticMessageSink, executionMessageSink, executionOptions, _exception);

                await runner.RunAsync();
            }
            else
            {
                Exception?ex = null;
                try
                {
                    await _host.StartAsync();
                }
                catch (Exception e)
                {
                    ex = e;
                }

                using var runner = new DependencyInjectionTestAssemblyRunner(_host.Services, TestAssembly,
                                                                             testCases, DiagnosticMessageSink, executionMessageSink, executionOptions, _exception, ex);

                await runner.RunAsync();

                await _host.StopAsync();
            }
        }
示例#2
0
 protected override async void RunTestCases(
     IEnumerable <IXunitTestCase> testCases,
     IMessageSink executionMessageSink,
     ITestFrameworkExecutionOptions executionOptions)
 {
     using (var runner = new DependencyInjectionTestAssemblyRunner(_provider, TestAssembly,
                                                                   testCases, DiagnosticMessageSink, executionMessageSink, executionOptions))
         await runner.RunAsync();
 }