コード例 #1
0
ファイル: Xunit2.cs プロジェクト: redoz/xunit
 /// <summary>
 /// Starts the process of running the selected xUnit.net v2 tests.
 /// </summary>
 /// <param name="testCases">The test cases to run; if null, all tests in the assembly are run.</param>
 /// <param name="messageSink">The message sink to report results back to.</param>
 /// <param name="executionOptions">The options to be used during test execution.</param>
 public void Run(IEnumerable <ITestCase> testCases, IMessageSink messageSink, XunitExecutionOptions executionOptions)
 {
     executor.RunTests(testCases, messageSink, executionOptions);
 }
コード例 #2
0
        public static async void NonParallel()
        {
            var passing = Mocks.XunitTestCase<ClassUnderTest>("Passing");
            var other = Mocks.XunitTestCase<ClassUnderTest>("Other");
            var options = new XunitExecutionOptions { DisableParallelization = true };
            var runner = TestableXunitTestAssemblyRunner.Create(testCases: new[] { passing, other }, options: options);

            await runner.RunAsync();

            var threadIDs = runner.TestCasesRun.Select(x => x.Item1).ToList();
            Assert.Equal(threadIDs[0], threadIDs[1]);
        }
コード例 #3
0
ファイル: Xunit2.cs プロジェクト: redoz/xunit
 /// <summary>
 /// Starts the process of running all the xUnit.net v2 tests in the assembly.
 /// </summary>
 /// <param name="messageSink">The message sink to report results back to.</param>
 /// <param name="discoveryOptions">The options to be used during test discovery.</param>
 /// <param name="executionOptions">The options to be used during test execution.</param>
 public void Run(IMessageSink messageSink, XunitDiscoveryOptions discoveryOptions, XunitExecutionOptions executionOptions)
 {
     executor.RunAll(messageSink, discoveryOptions, executionOptions);
 }
コード例 #4
0
        public static void TestOptionsOverrideAttribute()
        {
            var attribute = Mocks.CollectionBehaviorAttribute(disableTestParallelization: true, maxParallelThreads: 127);
            var options = new XunitExecutionOptions { DisableParallelization = false, MaxParallelThreads = 255 };
            var assembly = Mocks.TestAssembly(attributes: new[] { attribute });
            var runner = TestableXunitTestAssemblyRunner.Create(assembly: assembly, options: options);

            var result = runner.GetTestFrameworkEnvironment();

            Assert.EndsWith("[collection-per-class, parallel (255 threads)]", result);
        }
コード例 #5
0
        public static void TestOptions_MaxThreads()
        {
            var options = new XunitExecutionOptions { MaxParallelThreads = 255 };
            var runner = TestableXunitTestAssemblyRunner.Create(options: options);

            var result = runner.GetTestFrameworkEnvironment();

            Assert.EndsWith("[collection-per-class, parallel (255 threads)]", result);
        }
コード例 #6
0
        public static void TestOptions_NonParallel()
        {
            var options = new XunitExecutionOptions { DisableParallelization = true };
            var runner = TestableXunitTestAssemblyRunner.Create(options: options);

            var result = runner.GetTestFrameworkEnvironment();

            Assert.EndsWith("[collection-per-class, non-parallel]", result);
        }
コード例 #7
0
ファイル: Xunit2.cs プロジェクト: Tofudebeast/xunit
 /// <summary>
 /// Starts the process of running the selected xUnit.net v2 tests.
 /// </summary>
 /// <param name="testCases">The test cases to run; if null, all tests in the assembly are run.</param>
 /// <param name="messageSink">The message sink to report results back to.</param>
 /// <param name="executionOptions">The options to be used during test execution.</param>
 public void Run(IEnumerable<ITestCase> testCases, IMessageSink messageSink, XunitExecutionOptions executionOptions)
 {
     executor.RunTests(testCases, messageSink, executionOptions);
 }
コード例 #8
0
ファイル: Xunit2.cs プロジェクト: Tofudebeast/xunit
 /// <summary>
 /// Starts the process of running all the xUnit.net v2 tests in the assembly.
 /// </summary>
 /// <param name="messageSink">The message sink to report results back to.</param>
 /// <param name="discoveryOptions">The options to be used during test discovery.</param>
 /// <param name="executionOptions">The options to be used during test execution.</param>
 public void Run(IMessageSink messageSink, XunitDiscoveryOptions discoveryOptions, XunitExecutionOptions executionOptions)
 {
     executor.RunAll(messageSink, discoveryOptions, executionOptions);
 }