public void Should_Add_Action_If_No_Configuration_Provided()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

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

                // Then
                Assert.Equal("match", result.Args);
            }
            public void Should_Set_Working_Directory()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

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

                // Then
                Assert.Equal("/Working", result.Process.WorkingDirectory.FullPath);
            }
            public void Should_Find_Fastlane_Match_Runner_If_Tool_Path_Not_Provided()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

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

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

                fixture.Settings.KeyChainName = "My Key Chain";

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

                // Then
                Assert.Equal($"match -s {fixture.Settings.KeyChainName}", result.Args);
            }
            public void Should_Add_User_Name_If_Provided()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.Settings.UserName = "******";

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

                // Then
                Assert.Equal($"match -u {fixture.Settings.UserName}", result.Args);
            }
            public void Should_Add_App_Identifier_If_Provided()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.Settings.AppIdentifier = "com.fastlane.cake.local";

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

                // Then
                Assert.Equal($"match -a {fixture.Settings.AppIdentifier}", result.Args);
            }
            public void Should_Add_Certificate_Type_If_Provided(CertificateType certificateType)
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.Settings.CertificateType = certificateType;

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

                // Then
                Assert.Equal($"match {certificateType.ToString().ToLowerInvariant()}", result.Args);
            }
            public void Should_Add_Git_Branch_If_Provided()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.Settings.GitBranch = "develop";

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

                // Then
                Assert.Equal("match --git_branch develop", result.Args);
            }
            public void Should_Add_Git_URL_If_Provided()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.Settings.GitUrl = "https://cake.fastlane.org";

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

                // Then
                Assert.Equal("match -r https://cake.fastlane.org", result.Args);
            }
            public void Should_Add_Key_Chain_Password_If_Provided()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.Settings.KeyChainPassword = "******";

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

                // Then
                Assert.Equal($"match -p [REDACTED]", result.Args);
            }
            public void Should_Add_Team_Id_If_Provided()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.Settings.TeamId = "456";

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

                // Then
                Assert.Equal($"match -b {fixture.Settings.TeamId}", result.Args);
            }
            public void Should_Add_Read_Only_If_Provided()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.Settings.ReadOnly = true;

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

                // Then
                Assert.Equal("match --readonly", result.Args);
            }
            public void Should_Add_Team_Name_If_Provided()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.Settings.TeamName = "NY Mets";

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

                // Then
                Assert.Equal($"match -l {fixture.Settings.TeamName}", result.Args);
            }
            public void Should_Add_Verbose_If_Provided()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.Settings.Verbose = true;

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

                // Then
                Assert.Equal("match --verbose", result.Args);
            }
            public void Should_Add_Force_For_New_Devices_If_Provided()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.Settings.ForceForNewDevices = true;

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

                // Then
                Assert.Equal("match --force_for_new_devices", result.Args);
            }
            public void Should_Add_Skip_Docs_Provided()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.Settings.SkipDocs = true;

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

                // Then
                Assert.Equal("match --skip_docs", result.Args);
            }
            public void Should_Add_Clone_Branch_Directly_If_Provided()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.Settings.CloneBranchDirectly = true;

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

                // Then
                Assert.Equal("match --clone_branch_directly", result.Args);
            }
            public void Should_Add_Workspace_If_Provided()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.Settings.Workspace = "./usr/";

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

                // Then
                Assert.Equal("match --workspace \"/Working/usr\"", result.Args);
            }
            public void Should_Add_Shallow_Clone_If_Provided()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.Settings.ShallowClone = true;

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

                // Then
                Assert.Equal("match --shallow_clone", result.Args);
            }
            public void Should_Add_Skip_Confirmation_If_Provided()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.Settings.SkipConfirmation = true;

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

                // Then
                Assert.Equal("match --skip_confirmation", result.Args);
            }
            public void Should_Throw_If_Settings_Is_Null()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.Settings = null;

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

                // Then
                Assert.IsType <ArgumentNullException>(result);
            }
            public void Should_Use_Fastlane_Match_Runner_From_Tool_Path_If_Provided(string toolPath, string expected)
            {
                // Given
                var fixture = new FastlaneMatchFixture();

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

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

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

                fixture.Settings = null;

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

                // Then
                Assert.IsType <ArgumentNullException>(result);
                Assert.Equal("Value cannot be null.\nParameter name: configuration", result?.Message);
            }
            public void Should_Throw_If_Fastlane_Match_Runner_Was_Not_Found()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.GivenDefaultToolDoNotExist();

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

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("fastlane: Could not locate executable.", result?.Message);
            }
            public void Should_Throw_If_Process_Was_Not_Started()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.GivenProcessCannotStart();

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

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("fastlane: Process was not started.", result?.Message);
            }
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
            {
                // Given
                var fixture = new FastlaneMatchFixture();

                fixture.GivenProcessExitsWithCode(1);

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

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("fastlane: Process returned an error (exit code 1).", result?.Message);
            }