public void TestCountTestCasesAsyncWithAssemblyReturnsNumberOfTestCasesLoaded( [Values] bool withChildTests, [Values] bool withFilter) { ITestFilter filter = withFilter ? NUnitFilter.Where.Class(typeof(TestFixtureStubOne).FullName).And.Method("Test2").Build().Filter : null; INUnitRunner runner = new NUnitRunner("suite-name"); Assembly assembly = typeof(TestFixtureStubOne).Assembly; int expected = 0; if (withChildTests) { expected = withFilter ? 1 : TestFixtureStubHelper.GeTestFixtureStub().TestCount; Task <ITest> testTask = runner.AddTestAssemblyAsync(assembly); testTask.Wait(); } Task <int> countTask = runner.CountTestCasesAsync(assembly, filter); Assert.IsNotNull(countTask); countTask.Wait(); int count = countTask.Result; Assert.AreEqual(expected, count); }
public void TestCountTestCasesAsyncThrowsArgumentNullExceptionWhenAssemblyIsNull() { INUnitRunner runner = new NUnitRunner("suite-name"); Assert.ThrowsAsync( Is.TypeOf <ArgumentNullException>().And.Message .EqualTo("The assembly cannot be null. (Parameter 'assembly')"), async() => await runner.CountTestCasesAsync(null, null)); }