public void Should_Add_OverrideArguments_Flag_To_Arguments_If_Set(bool overrideArguments, string expected) { // Given var fixture = new ChocolateyUninstallerFixture(); fixture.Settings.OverrideArguments = overrideArguments; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Args); }
public void Should_Add_NotSilent_Flag_To_Arguments_If_Set(bool notSilent, string expected) { // Given var fixture = new ChocolateyUninstallerFixture(); fixture.Settings.NotSilent = notSilent; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Args); }
public void Should_Add_Version_To_Arguments_If_Not_Null() { // Given var fixture = new ChocolateyUninstallerFixture(); fixture.Settings.Version = "1.0.0"; // When var result = fixture.Run(); // Then Assert.Equal("uninstall \"Cake\" -y --version \"1.0.0\"", result.Args); }
public void Should_Add_AllVersions_To_Arguments_If_Set(bool allVersions, string expected) { // Given var fixture = new ChocolateyUninstallerFixture(); fixture.Settings.AllVersions = allVersions; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Args); }
public void Should_Add_UseSystemPowershell_To_Arguments_If_Set(bool useSystemPowershell, string expected) { // Given var fixture = new ChocolateyUninstallerFixture(); fixture.Settings.UseSystemPowershell = useSystemPowershell; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Args); }
public void Should_Add_Source_To_Arguments_If_Set() { // Given var fixture = new ChocolateyUninstallerFixture(); fixture.Settings.Source = "A"; // When var result = fixture.Run(); // Then Assert.Equal("uninstall \"Cake\" -y -s \"A\"", result.Args); }
public void Should_Add_FailOnStandardError_To_Arguments_If_Set(bool failOnStandardError, string expected) { // Given var fixture = new ChocolateyUninstallerFixture(); fixture.Settings.FailOnStandardError = failOnStandardError; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Args); }
public void Should_Throw_If_Settings_Are_Null() { // Given var fixture = new ChocolateyUninstallerFixture(); fixture.Settings = null; // When var result = Record.Exception(() => fixture.Run()); // Then Assert.IsArgumentNullException(result, "settings"); }
public void Should_Add_CacheLocation_Flag_To_Arguments_If_Set(string cacheLocation, string expected) { // Given var fixture = new ChocolateyUninstallerFixture(); fixture.Settings.CacheLocation = cacheLocation; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Args); }
public void Should_Add_ExecutionTimeout_To_Arguments_If_Set(int executionTimeout, string expected) { // Given var fixture = new ChocolateyUninstallerFixture(); fixture.Settings.ExecutionTimeout = executionTimeout; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Args); }
public void Should_Add_AcceptLicense_Flag_To_Arguments_If_Set(bool acceptLicense, string expected) { // Given var fixture = new ChocolateyUninstallerFixture(); fixture.Settings.AcceptLicense = acceptLicense; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Args); }
public void Should_Throw_If_Traget_Package_Id_Is_Null() { // Given var fixture = new ChocolateyUninstallerFixture(); fixture.PackageIds = null; // When var result = Record.Exception(() => fixture.Run()); // Then Assert.IsArgumentNullException(result, "packageIds"); }
public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code() { // Given var fixture = new ChocolateyUninstallerFixture(); fixture.GivenProcessExitsWithCode(1); // When var result = Record.Exception(() => fixture.Run()); // Then Assert.IsCakeException(result, "Chocolatey: Process returned an error (exit code 1)."); }
public void Should_Use_Chocolatey_Executable_From_Tool_Path_If_Provided_On_Windows(string toolPath, string expected) { // Given var fixture = new ChocolateyUninstallerFixture(); fixture.Settings.ToolPath = toolPath; fixture.GivenSettingsToolPathExist(); // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Path.FullPath); }