public void EnvironmentVariableGetsPassed() { var processMock = new Mock <IProcessExecutor>(MockBehavior.Strict); processMock.Setup(x => x.Start( It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IEnumerable <KeyValuePair <string, string> > >())) .Returns(new ProcessResult() { ExitCode = -100 }); string path = "/test"; var target = new DotnetTestRunner(path, processMock.Object); target.SetActiveMutation(1); var result = target.RunAll(); Assert.False(result.Success); processMock.Verify(m => m.Start( path, "dotnet", It.Is <string>(s => s.Contains("test")), It.Is <IEnumerable <KeyValuePair <string, string> > >( x => x.Where(y => y.Value == "1" && y.Key == "ActiveMutation").Any() ))); }
private void RunTests() { var runTestsResult = new DotnetTestRunner().Run(testConfig.Names); if (runTestsResult == false) { throw new Exception("Tests Failed."); } }
public void RunAllExceptionStatusCodeSuccessShouldBeFalse() { var processMock = new Mock <IProcessExecutor>(MockBehavior.Strict); processMock.SetupProcessMockToReturn("Testrun failed other way", -100); string path = "/test"; var target = new DotnetTestRunner(path, processMock.Object); var result = target.RunAll(null); Assert.False(result.Success); processMock.Verify(m => m.Start(path, "dotnet", It.Is <string>(s => s.Contains("test")), It.IsAny <IEnumerable <KeyValuePair <string, string> > >(), It.IsAny <int>())); }
public void RunAllExceptionStatusCodeSuccessShouldBeFalse() { var processMock = new Mock <IProcessExecutor>(MockBehavior.Strict); processMock.SetupProcessMockToReturn("Testrun failed other way", -100); string path = FilePathUtils.NormalizePathSeparators("c://test"); var target = new DotnetTestRunner(path, processMock.Object, OptimizationFlags.NoOptimization, new[] { "C://test//mytest.dll" }); var result = target.RunAll(null, null, null); Assert.Equal(1, result.FailingTests.Count); processMock.Verify(m => m.Start(path, "dotnet", It.Is <string>(s => s.Contains("vstest")), It.IsAny <IEnumerable <KeyValuePair <string, string> > >(), It.IsAny <int>())); }
public void RunAllExceptionStatusCodeSuccessShouldBeFalse() { var processMock = new Mock <IProcessExecutor>(MockBehavior.Strict); processMock.SetupProcessMockToReturn("Testrun failed other way", -100); string path = FilePathUtils.ConvertPathSeparators("c://test//"); var target = new DotnetTestRunner(path, processMock.Object, OptimizationFlags.NoOptimization); var result = target.RunAll(null, null); Assert.False(result.Success); processMock.Verify(m => m.Start(Path.GetDirectoryName(path), "dotnet", It.Is <string>(s => s.Contains("test")), It.IsAny <IEnumerable <KeyValuePair <string, string> > >(), It.IsAny <int>())); }
public void RunAllExitCode0SuccessShouldBeTrue() { var processMock = new Mock <IProcessExecutor>(MockBehavior.Strict); processMock.SetupProcessMockToReturn("Testrun successful"); string path = FilePathUtils.NormalizePathSeparators("c://test"); var target = new DotnetTestRunner(path, processMock.Object, OptimizationFlags.NoOptimization, new string[] { "C://test//mytest.dll" }); var result = target.RunAll(null, null); Assert.True(result.Success); processMock.Verify(m => m.Start(path, "dotnet", It.Is <string>(s => s.Contains("vstest C://test//mytest.dll")), It.IsAny <IEnumerable <KeyValuePair <string, string> > >(), It.IsAny <int>())); }
public void RunAllExitCode0SuccessShouldBeTrue() { var processMock = new Mock <IProcessExecutor>(MockBehavior.Strict); processMock.SetupProcessMockToReturn("Testrun successful"); string path = "/test"; var target = new DotnetTestRunner(path, processMock.Object, totalNumberOfTestsParserMock.Object); var result = target.RunAll(null, null); Assert.True(result.Success); processMock.Verify(m => m.Start(path, "dotnet", It.Is <string>(s => s.Contains("test")), It.IsAny <IEnumerable <KeyValuePair <string, string> > >(), It.IsAny <int>())); }
public void EnvironmentVariableGetsPassed() { var processMock = new Mock <IProcessExecutor>(MockBehavior.Strict); processMock.SetupProcessMockToReturn("Testrun failed other way", -100); string path = FilePathUtils.ConvertPathSeparators("c://test//"); var target = new DotnetTestRunner(path, processMock.Object, OptimizationFlags.NoOptimization); var result = target.RunAll(null, 1); Assert.False(result.Success); processMock.Verify(m => m.Start( Path.GetDirectoryName(path), "dotnet", It.Is <string>(s => s.Contains("test")), It.Is <IDictionary <string, string> >(x => x.Any(y => y.Value == "1" && y.Key == "ActiveMutation")), It.IsAny <int>())); }
public void EnvironmentVariableGetsPassed() { var processMock = new Mock <IProcessExecutor>(MockBehavior.Strict); processMock.SetupProcessMockToReturn("Testrun failed other way", -100); string path = "/test"; var target = new DotnetTestRunner(path, processMock.Object, totalNumberOfTestsParserMock.Object); var result = target.RunAll(null, 1); Assert.False(result.Success); processMock.Verify(m => m.Start( path, "dotnet", It.Is <string>(s => s.Contains("test")), It.Is <IDictionary <string, string> >(x => x.Any(y => y.Value == "1" && y.Key == "ActiveMutation")), It.IsAny <int>())); }
public void RunAllExceptionStatusCodeSuccessShouldBeFalse() { var processMock = new Mock <IProcessExecutor>(MockBehavior.Strict); processMock.Setup(x => x.Start( It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IEnumerable <KeyValuePair <string, string> > >())) .Returns(new ProcessResult() { ExitCode = -100 }); string path = "/test"; var target = new DotnetTestRunner(path, processMock.Object); var result = target.RunAll(); Assert.False(result.Success); processMock.Verify(m => m.Start(path, "dotnet", It.Is <string>(s => s.Contains("test")), It.IsAny <IEnumerable <KeyValuePair <string, string> > >())); }
public void EnvironmentVariableGetsPassed() { var processMock = new Mock <IProcessExecutor>(MockBehavior.Strict); processMock.SetupProcessMockToReturn("Testrun failed other way"); string path = FilePathUtils.NormalizePathSeparators("c://test"); var target = new DotnetTestRunner(path, processMock.Object, OptimizationFlags.NoOptimization, new[] { "C://test//mytest.dll" }); var result = target.RunAll(null, new Mutant() { Id = 1 }, null); Assert.Equal(0, result.FailingTests.Count); processMock.Verify(m => m.Start( path, "dotnet", It.Is <string>(s => s.Contains("vstest")), It.Is <IDictionary <string, string> >(x => x.Any(y => y.Value == "1" && y.Key == "ActiveMutation")), It.IsAny <int>())); }