public void Should_Find_SyncReleases_Executable_If_Tool_Path_Not_Provided()
        {
            // Given
            var fixture = new SyncReleasesRunnerFixture();

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

            // Then
            result.Path.FullPath.Should().Equals("/Working/tools/SyncReleases.exe");
        }
        public void Should_Throw_If_Process_Was_Not_Started()
        {
            // Given
            var fixture = new SyncReleasesRunnerFixture();

            fixture.GivenProcessCannotStart();

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

            // Then
            result.Should().BeOfType <CakeException>().Subject.Message.Should().Equals("SyncReleases: Process was not started.");
        }
        public void Should_Throw_If_SyncReleasesl_Executable_Was_Not_Found()
        {
            // Given
            var fixture = new SyncReleasesRunnerFixture();

            fixture.GivenDefaultToolDoNotExist();

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

            // Then
            result.Should().BeOfType <CakeException>().Subject.Message.Should().Equals("SyncReleases: Could not locate executable.");
        }
        public void Should_Add_Url_To_Arguments()
        {
            // Given
            var fixture = new SyncReleasesRunnerFixture();

            fixture.Settings.Url = "https://google.com";

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

            // Then
            result.Args.Should().Equals("--url https://google.com");
        }
        public void Should_Throw_If_Settings_Are_Null()
        {
            // Given
            var fixture = new SyncReleasesRunnerFixture();

            fixture.Settings = null;

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

            // Then
            result.Should().BeOfType <ArgumentNullException>().Subject.ParamName.Should().Equals("settings");
        }
        public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
        {
            // Given
            var fixture = new SyncReleasesRunnerFixture();

            fixture.GivenProcessExitsWithCode(1);

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

            // Then
            result.Should().BeOfType <CakeException>()
            .Subject.Message.Should().Equals("SyncReleases: Process returned an error (exit code 1).");
        }
        public void Should_Use_SyncReleases_Executable_From_Tool_Path_If_Provided(string toolPath, string expected)
        {
            // Given
            var fixture = new SyncReleasesRunnerFixture();

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

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

            // Then
            result.Path.FullPath.Should().Equals(expected);
        }