Example #1
0
            public void Should_Add_ExecutionTimeout_To_Arguments_If_Set(int executionTimeout, string expected)
            {
                // Given
                var fixture = new ChocolateyDownloadFixture();

                fixture.Settings.ExecutionTimeout = executionTimeout;

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

                // Then
                Assert.Equal(expected, result.Args);
            }
Example #2
0
            public void Should_Add_LimitOutput_Flag_To_Arguments_If_Set(bool limitOutput, string expected)
            {
                // Given
                var fixture = new ChocolateyDownloadFixture();

                fixture.Settings.LimitOutput = limitOutput;

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

                // Then
                Assert.Equal(expected, result.Args);
            }
Example #3
0
            public void Should_Add_Noop_Flag_To_Arguments_If_Set(bool noop, string expected)
            {
                // Given
                var fixture = new ChocolateyDownloadFixture();

                fixture.Settings.Noop = noop;

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

                // Then
                Assert.Equal(expected, result.Args);
            }
Example #4
0
            public void Should_Add_AcceptLicense_Flag_To_Arguments_If_Set(bool acceptLicense, string expected)
            {
                // Given
                var fixture = new ChocolateyDownloadFixture();

                fixture.Settings.AcceptLicense = acceptLicense;

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

                // Then
                Assert.Equal(expected, result.Args);
            }
Example #5
0
            public void Should_Throw_If_Package_Id_Is_Null()
            {
                // Given
                var fixture = new ChocolateyDownloadFixture();

                fixture.PackageId = null;

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

                // Then
                AssertEx.IsArgumentNullException(result, "packageId");
            }
Example #6
0
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
            {
                // Given
                var fixture = new ChocolateyDownloadFixture();

                fixture.GivenProcessExitsWithCode(1);

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

                // Then
                AssertEx.IsCakeException(result, "Chocolatey: Process returned an error (exit code 1).");
            }
Example #7
0
            public void Should_Use_Chocolatey_Executable_From_Tool_Path_If_Provided_On_Windows(string toolPath, string expected)
            {
                // Given
                var fixture = new ChocolateyDownloadFixture();

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

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

                // Then
                Assert.Equal(expected, result.Path.FullPath);
            }
Example #8
0
            public void Should_Not_Add_AppendUseOriginalLocation_Flag_To_Arguments_If_Internalize_Is_Not_Set(bool appendUseOriginalLocation)
            {
                // Given
                var fixture = new ChocolateyDownloadFixture();

                fixture.Settings.Internalize = false;
                fixture.Settings.AppendUseOriginalLocation = appendUseOriginalLocation;

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

                // Then
                Assert.Equal("download \"MyPackage\" -y", result.Args);
            }
Example #9
0
            public void Should_Add_AppendUseOriginalLocation_Flag_To_Arguments_If_Set(bool appendUseOriginalLocation, string expected)
            {
                // Given
                var fixture = new ChocolateyDownloadFixture();

                fixture.Settings.Internalize = true;
                fixture.Settings.AppendUseOriginalLocation = appendUseOriginalLocation;

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

                // Then
                Assert.Equal(expected, result.Args);
            }
Example #10
0
            public void Should_Not_Add_ResourceLocation_To_Arguments_If_Internalize_Is_Not_Set(string resourcesLocation)
            {
                // Given
                var fixture = new ChocolateyDownloadFixture();

                fixture.Settings.Internalize       = false;
                fixture.Settings.ResourcesLocation = resourcesLocation;

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

                // Then
                Assert.Equal("download \"MyPackage\" -y", result.Args);
            }
Example #11
0
            public void Should_Add_ResourceLocation_To_Arguments_If_Set(string resourcesLocation, string expected)
            {
                // Given
                var fixture = new ChocolateyDownloadFixture();

                fixture.Settings.Internalize       = true;
                fixture.Settings.ResourcesLocation = resourcesLocation;

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

                // Then
                Assert.Equal(expected, result.Args);
            }
Example #12
0
            public void Should_Not_Add_InternalizeAllUrls_Flag_To_Arguments_If_Internalize_Is_Not_Set(bool internalizeAllUrls)
            {
                // Given
                var fixture = new ChocolateyDownloadFixture();

                fixture.Settings.Internalize        = false;
                fixture.Settings.InternalizeAllUrls = internalizeAllUrls;

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

                // Then
                Assert.Equal("download \"MyPackage\" -y", result.Args);
            }
Example #13
0
            public void Should_Add_InternalizeAllUrls_Flag_To_Arguments_If_Set(bool internalizeAllUrls, string expected)
            {
                // Given
                var fixture = new ChocolateyDownloadFixture();

                fixture.Settings.Internalize        = true;
                fixture.Settings.InternalizeAllUrls = internalizeAllUrls;

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

                // Then
                Assert.Equal(expected, result.Args);
            }