public async Task RunTestsAsync_WhenRunningAndProjectCont_ShouldGetCorrectResult(string type, string dllName) { var testDllPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "Samples", type, "WithErrors", dllName); var dotNetRunner = new DotNetTestRunner(null, TimeSpan.FromSeconds(5)); var result = await dotNetRunner.RunTestsAsync(testDllPath); Assert.IsFalse(result.IsSuccess, "Test result should not be successful"); Assert.IsTrue(result.Name.StartsWith("ERROR")); StringAssert.Contains("was not found", result.Name); }
public async Task RunTestsAsync_WhenRunningAndAllTestPassFromANonCoreProject_ShouldGetCorrectResult() { var testDllPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "Samples", "NonCore", "NUnit", "PassingTests", "NunitTestProject.dll"); var dotNetRunner = new DotNetTestRunner(null, TimeSpan.FromSeconds(5)); var result = await dotNetRunner.RunTestsAsync(testDllPath); Assert.IsTrue(result.IsSuccess, "Test result should be successful"); Assert.AreEqual(2, result.TestResults.Count, "Wrong test result count"); Assert.AreEqual(2, result.TestResults.Count(t => t.IsSuccess), "Should find two test that pass"); }
public async Task RunTestsAsync_WhenRunningAndSomeUnitTestFail_ShouldGetCorrectResult(string type, string dllName) { var testDllPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "Samples", type, "FailingTests", dllName); var dotNetRunner = new DotNetTestRunner(null, TimeSpan.FromSeconds(5)); var result = await dotNetRunner.RunTestsAsync(testDllPath); Assert.IsFalse(result.IsSuccess, "Test result should not be successful"); Assert.AreEqual(2, result.TestResults.Count, "Wrong test result count"); Assert.IsTrue(result.TestResults.Any(t => t.IsSuccess), "Should find one test that pass"); Assert.IsTrue(result.TestResults.Any(t => !t.IsSuccess), "Should find one test that fail"); }