public void TestGetTestResultsThrowsArgumentNullExceptionWhenAssemblyIsNull() { INUnitRunner runner = new NUnitRunner("suite-name"); Assert.Throws( Is.TypeOf <ArgumentNullException>().And.Message .EqualTo("The assembly cannot be null. (Parameter 'assembly')"), () => runner.GetTestResults(null)); }
public void TestGetTestResultsWithAssemblyReturnsResults([Values] bool withChildTests, [Values] bool runTests, [Values] bool withFilter) { ITestFilter filter = withFilter ? NUnitFilter.Where.Class(typeof(TestFixtureStubOne).FullName).And.Method("Test2").Build().Filter : null; ResultState expectedState = ResultState.Inconclusive; if (withChildTests && runTests) { expectedState = withFilter ? ResultState.Success : ResultState.ChildFailure; } INUnitRunner runner = new NUnitRunner("suite-name"); Assembly assembly = typeof(TestFixtureStubOne).Assembly; int expectedCount = 0; if (withChildTests) { expectedCount = withFilter ? 1 : TestFixtureStubHelper.GeTestFixtureStub().TestCount; Task <ITest> testTask = runner.AddTestAssemblyAsync(assembly); testTask.Wait(); } if (runTests) { runner.RunTests(null, filter); } else { expectedCount = 0; } ITestResult results = runner.GetTestResults(assembly); Assert.IsNotNull(results); Assert.AreEqual(expectedState, results.ResultState); int totalCount = results.FailCount + results.InconclusiveCount + results.PassCount + results.SkipCount + results.WarningCount; Assert.AreEqual(expectedCount, totalCount); }