示例#1
0
        public void Should_Set_Working_Directory()
        {
            // Given
            var fixture = new CodecovRunnerFixture();

            // When
            var result = fixture.Run();

            // Then
            result.Process.WorkingDirectory.FullPath.Should().Be("/Working");
        }
        public void Should_Find_Codecov_Runner_If_Tool_Path_Not_Provided()
        {
            // Given
            var fixture = new CodecovRunnerFixture();

            // When
            var result = fixture.Run();

            // Then
            result.Path.FullPath.Should().Be("/Working/tools/codecov.exe");
        }
示例#3
0
        public void Should_Set_Files()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { Files = new[] { "file1.xml", "file2.xml" } }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be(@"--file ""file1.xml"" ""file2.xml""");
        }
示例#4
0
        public void Should_Enable_NoColor()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { NoColor = true }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be(@"--no-color");
        }
示例#5
0
        public void Should_Set_Pr()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { Pr = "1" }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be(@"--pr ""1""");
        }
示例#6
0
        public void Should_Throw_If_Process_Was_Not_Started()
        {
            // Given
            var fixture = new CodecovRunnerFixture();

            fixture.GivenProcessCannotStart();

            // When
            Action result = () => fixture.Run();

            // Then
            result.Should().Throw <CakeException>().WithMessage("Codecov: Process was not started.");
        }
示例#7
0
        public void Should_Set_Name()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { Name = "custom name" }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be(@"--name ""custom name""");
        }
示例#8
0
        public void Should_Set_Token()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { Token = @"00000000-0000-0000-0000-000000000000" }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be(@"--token ""00000000-0000-0000-0000-000000000000""");
        }
示例#9
0
        public void Should_Enable_Verbose()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { Verbose = true }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be(@"--verbose");
        }
示例#10
0
        public void Should_Set_Envs()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { Envs = new[] { "env1", "env2" } }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be(@"--env ""env1"" ""env2""");
        }
示例#11
0
        public void Should_Set_Slug()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { Slug = @"owner/repo" }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be(@"--slug ""owner/repo""");
        }
示例#12
0
        public void Should_Enable_DisableNetwork()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { DisableNetwork = true }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be(@"--disable-network");
        }
示例#13
0
        public void Should_Enable_Dump()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { Dump = true }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be(@"--dump");
        }
示例#14
0
        public void Should_Set_Commit()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { Commit = "603e02d40093d0649cfa787d846ae4ccc038085c" }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be(@"--sha ""603e02d40093d0649cfa787d846ae4ccc038085c""");
        }
示例#15
0
        public void Should_Set_Branch()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { Branch = "develop" }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be(@"--branch ""develop""");
        }
示例#16
0
        public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
        {
            // Given
            var fixture = new CodecovRunnerFixture();

            fixture.GivenProcessExitsWithCode(1);

            // When
            Action result = () => fixture.Run();

            // Then
            result.Should().Throw <CakeException>().WithMessage("Codecov: Process returned an error (exit code 1).");
        }
示例#17
0
        public void Should_Enable_Required()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { Required = true }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be(@"--required");
        }
示例#18
0
        public void Should_Throw_If_Codecov_Executable_Was_Not_Found()
        {
            // Given
            var fixture = new CodecovRunnerFixture();

            fixture.GivenDefaultToolDoNotExist();

            // When
            Action result = () => fixture.Run();

            // Then
            result.Should().Throw <CakeException>().WithMessage("Codecov: Could not locate executable.");
        }
示例#19
0
        public void Should_Set_Root()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { Root = @".\working" }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be(@"--root ""working""");
        }
示例#20
0
        public void Should_Set_Features()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { Features = new[] { "s3" } }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be("--feature \"s3\"");
        }
示例#21
0
        public void Should_Set_Tag()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { Tag = @"v1.0.0" }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be(@"--tag ""v1.0.0""");
        }
示例#22
0
        public void Should_Throw_If_Settings_Are_Null()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = null
            };

            // When
            Action result = () => fixture.Run();

            // Then
            result.Should().Throw <ArgumentNullException>().And.ParamName.Should().Be("settings");
        }
示例#23
0
        public void Should_Set_Url()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { Url = new Uri("https://my-hosted-codecov.com") }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be(@"--url ""https://my-hosted-codecov.com/""");
        }
示例#24
0
        public void Should_Set_Flags()
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { Flags = "ut,chrome" }
            };

            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Be(@"--flag ""ut,chrome""");
        }
示例#25
0
        public void Should_Use_Codecov_Runner_From_Tool_Path_If_Provided_On_Unix(string toolPath, string expected)
        {
            // Given
            var fixture = new CodecovRunnerFixture {
                Settings = { ToolPath = toolPath }
            };

            fixture.GivenSettingsToolPathExist();

            // When
            var result = fixture.Run();

            // Then
            result.Path.FullPath.Should().Be(expected);
        }
示例#26
0
        public void Should_Find_Codecov_Runner_If_Tool_Path_Not_Provided_On_osx(string path)
        {
            // Given
            var mock = new Mock <IPlatformDetector>(MockBehavior.Strict);

            mock.Setup(m => m.IsLinuxPlatform()).Returns(false);
            mock.Setup(m => m.IsOsxPlatform()).Returns(true);

            var fixture = new CodecovRunnerFixture(mock.Object, path);

            // When
            var result = fixture.Run();

            // Then
            result.Path.FullPath.Should().Be("/Working/tools/" + path);

            mock.Verify(m => m.IsLinuxPlatform(), Times.Once());
            mock.Verify(m => m.IsOsxPlatform(), Times.Once());
        }