public void Should_Find_GitReleaseManager_Executable_If_Tool_Path_Not_Provided_When_Using_Token()
            {
                // Given
                var fixture = new GitReleaseManagerLabellerFixture();

                fixture.UseToken();

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

                // Then
                Assert.Equal("/Working/tools/GitReleaseManager.exe", result.Path.FullPath);
            }
            public void Should_Throw_If_Owner_Is_Null_When_Using_Token()
            {
                // Given
                var fixture = new GitReleaseManagerLabellerFixture();

                fixture.UseToken();
                fixture.Owner = string.Empty;

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                AssertEx.IsArgumentNullException(result, "owner");
            }
            public void Should_Add_Mandatory_Arguments_When_Using_Token()
            {
                // Given
                var fixture = new GitReleaseManagerLabellerFixture();

                fixture.UseToken();

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

                // Then
                Assert.Equal("label --token \"token\" " +
                             "-o \"repoOwner\" -r \"repo\"", result.Args);
            }
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code_When_Using_Token()
            {
                // Given
                var fixture = new GitReleaseManagerLabellerFixture();

                fixture.UseToken();
                fixture.GivenProcessExitsWithCode(1);

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                AssertEx.IsCakeException(result, "GitReleaseManager: Process returned an error (exit code 1).");
            }
            public void Should_Throw_If_Process_Was_Not_Started_When_Using_Token()
            {
                // Given
                var fixture = new GitReleaseManagerLabellerFixture();

                fixture.UseToken();
                fixture.GivenProcessCannotStart();

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                AssertEx.IsCakeException(result, "GitReleaseManager: Process was not started.");
            }
            public void Should_Throw_If_GitReleaseManager_Executable_Was_Not_Found_When_Using_Token()
            {
                // Given
                var fixture = new GitReleaseManagerLabellerFixture();

                fixture.UseToken();
                fixture.GivenDefaultToolDoNotExist();

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                AssertEx.IsCakeException(result, "GitReleaseManager: Could not locate executable.");
            }
            public void Should_Throw_If_Settings_Are_Null_When_Using_Token()
            {
                // Given
                var fixture = new GitReleaseManagerLabellerFixture();

                fixture.UseToken();
                fixture.Settings = null;

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                AssertEx.IsArgumentNullException(result, "settings");
            }
            public void Should_Add_TargetDirectory_To_Arguments_If_Set_When_Using_Token()
            {
                // Given
                var fixture = new GitReleaseManagerLabellerFixture();

                fixture.UseToken();
                fixture.Settings.TargetDirectory = @"/temp";

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

                // Then
                Assert.Equal("label --token \"token\" " +
                             "-o \"repoOwner\" -r \"repo\" -d \"/temp\"", result.Args);
            }
            public void Should_Use_GitReleaseManager_Executable_From_Tool_Path_If_Provided_On_Windows_When_Using_Token(string toolPath, string expected)
            {
                // Given
                var fixture = new GitReleaseManagerLabellerFixture();

                fixture.UseToken();
                fixture.Settings.ToolPath = toolPath;
                fixture.GivenSettingsToolPathExist();

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

                // Then
                Assert.Equal(expected, result.Path.FullPath);
            }
            public void Should_All_NoLogo_To_Arguments_If_Set_When_Using_Token()
            {
                // Given
                var fixture = new GitReleaseManagerLabellerFixture();

                fixture.UseToken();
                fixture.Settings.NoLogo = true;

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

                // Then
                Assert.Equal("label --token \"token\" " +
                             "-o \"repoOwner\" -r \"repo\" " +
                             "--no-logo", result.Args);
            }
            public void Should_Add_LogFilePath_To_Arguments_If_Set_When_Using_Token()
            {
                // Given
                var fixture = new GitReleaseManagerLabellerFixture();

                fixture.UseToken();
                fixture.Settings.LogFilePath = @"/temp/log.txt";

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

                // Then
                Assert.Equal("label --token \"token\" " +
                             "-o \"repoOwner\" -r \"repo\" " +
                             "-l \"/temp/log.txt\"", result.Args);
            }