Ejemplo n.º 1
0
        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()
                                       )));
        }
Ejemplo n.º 2
0
        private void RunTests()
        {
            var runTestsResult = new DotnetTestRunner().Run(testConfig.Names);

            if (runTestsResult == false)
            {
                throw new Exception("Tests Failed.");
            }
        }
Ejemplo n.º 3
0
        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>()));
        }
Ejemplo n.º 4
0
        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>()));
        }
Ejemplo n.º 5
0
        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>()));
        }
Ejemplo n.º 6
0
        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>()));
        }
Ejemplo n.º 7
0
        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>()));
        }
Ejemplo n.º 8
0
        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>()));
        }
Ejemplo n.º 9
0
        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>()));
        }
Ejemplo n.º 10
0
        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> > >()));
        }
Ejemplo n.º 11
0
        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>()));
        }