コード例 #1
0
ファイル: NuGetPusherTests.cs プロジェクト: sjmcallister/cake
            public void Should_Find_NuGet_Executable_If_Tool_Path_Not_Provided()
            {
                // Given
                var fixture = new NuGetFixture();
                var pusher  = fixture.CreatePusher();

                // When
                pusher.Push("./existing.nupkg", new NuGetPushSettings());

                // Then
                fixture.ProcessRunner.Received(1).Start(Arg.Is <ProcessStartInfo>(
                                                            p => p.FileName == "/Working/tools/NuGet.exe"));
            }
コード例 #2
0
ファイル: NuGetPusherTests.cs プロジェクト: sjmcallister/cake
            public void Should_Throw_If_NuGet_Executable_Was_Not_Found()
            {
                // Given
                var fixture = new NuGetFixture(defaultToolExist: false);
                var pusher  = fixture.CreatePusher();

                // When
                var result = Record.Exception(() => pusher.Push("./existing.nupkg", new NuGetPushSettings()));

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("NuGet: Could not locate executable.", result.Message);
            }
コード例 #3
0
ファイル: NuGetPusherTests.cs プロジェクト: sjmcallister/cake
            public void Should_Throw_If_Nuspec_File_Path_Is_Null()
            {
                // Given
                var fixture = new NuGetFixture();
                var pusher  = fixture.CreatePusher();

                // When
                var result = Record.Exception(() => pusher.Push(null, new NuGetPushSettings()));

                // Then
                Assert.IsType <ArgumentNullException>(result);
                Assert.Equal("packageFilePath", ((ArgumentNullException)result).ParamName);
            }
コード例 #4
0
ファイル: NuGetPusherTests.cs プロジェクト: sjmcallister/cake
            public void Should_Throw_If_Settings_Is_Null()
            {
                // Given
                var fixture = new NuGetFixture();
                var pusher  = fixture.CreatePusher();

                // When
                var result = Record.Exception(() => pusher.Push("./existing.nupkg", null));

                // Then
                Assert.IsType <ArgumentNullException>(result);
                Assert.Equal("settings", ((ArgumentNullException)result).ParamName);
            }
コード例 #5
0
ファイル: NuGetPusherTests.cs プロジェクト: sjmcallister/cake
            public void Should_Add_NuGet_Package_To_Arguments()
            {
                // Given
                var fixture = new NuGetFixture();
                var pusher  = fixture.CreatePusher();

                // When
                pusher.Push("./existing.nupkg", new NuGetPushSettings());

                // Then
                fixture.ProcessRunner.Received(1).Start(Arg.Is <ProcessStartInfo>(
                                                            p => p.Arguments == "push \"/Working/existing.nupkg\" -NonInteractive"));
            }
コード例 #6
0
ファイル: NuGetPusherTests.cs プロジェクト: sjmcallister/cake
            public void Should_Throw_If_Process_Was_Not_Started()
            {
                // Given
                var fixture = new NuGetFixture();

                fixture.ProcessRunner.Start(Arg.Any <ProcessStartInfo>()).Returns((IProcess)null);
                var pusher = fixture.CreatePusher();

                // When
                var result = Record.Exception(() => pusher.Push("./existing.nupkg", new NuGetPushSettings()));

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("NuGet: Process was not started.", result.Message);
            }
コード例 #7
0
ファイル: NuGetPusherTests.cs プロジェクト: sjmcallister/cake
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
            {
                // Given
                var fixture = new NuGetFixture();

                fixture.Process.GetExitCode().Returns(1);
                var pusher = fixture.CreatePusher();

                // When
                var result = Record.Exception(() => pusher.Push("./existing.nupkg", new NuGetPushSettings()));

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("NuGet: Process returned an error.", result.Message);
            }
コード例 #8
0
ファイル: NuGetPusherTests.cs プロジェクト: sjmcallister/cake
            public void Should_Use_NuGet_Executable_From_Tool_Path_If_Provided(string toolPath, string expected)
            {
                // Given
                var fixture = new NuGetFixture(expected);
                var pusher  = fixture.CreatePusher();

                // When
                pusher.Push("./existing.nupkg", new NuGetPushSettings
                {
                    ToolPath = toolPath
                });

                // Then
                fixture.ProcessRunner.Received(1).Start(Arg.Is <ProcessStartInfo>(
                                                            p => p.FileName == expected));
            }
コード例 #9
0
ファイル: NuGetPusherTests.cs プロジェクト: sjmcallister/cake
            public void Should_Add_Timeout_To_Arguments_If_Not_Null()
            {
                // Given
                var fixture = new NuGetFixture();
                var pusher  = fixture.CreatePusher();

                // When
                pusher.Push("./existing.nupkg", new NuGetPushSettings
                {
                    Timeout = TimeSpan.FromSeconds(987)
                });

                // Then
                fixture.ProcessRunner.Received(1).Start(Arg.Is <ProcessStartInfo>(
                                                            p => p.Arguments == "push \"/Working/existing.nupkg\" -NonInteractive -Timeout 987"));
            }
コード例 #10
0
ファイル: NuGetPusherTests.cs プロジェクト: sjmcallister/cake
            public void Should_Add_Source_To_Arguments_If_Not_Null()
            {
                // Given
                var fixture = new NuGetFixture();
                var pusher  = fixture.CreatePusher();

                // When
                pusher.Push("./existing.nupkg", new NuGetPushSettings
                {
                    Source = "http://customsource/"
                });

                // Then
                fixture.ProcessRunner.Received(1).Start(Arg.Is <ProcessStartInfo>(
                                                            p => p.Arguments == "push \"/Working/existing.nupkg\" -NonInteractive -Source \"http://customsource/\""));
            }
コード例 #11
0
ファイル: NuGetPusherTests.cs プロジェクト: sjmcallister/cake
            public void Should_Add_Configuration_File_To_Arguments_If_Not_Null()
            {
                // Given
                var fixture = new NuGetFixture();
                var pusher  = fixture.CreatePusher();

                // When
                pusher.Push("./existing.nupkg", new NuGetPushSettings
                {
                    ConfigFile = "./NuGet.config"
                });

                // Then
                fixture.ProcessRunner.Received(1).Start(Arg.Is <ProcessStartInfo>(
                                                            p => p.Arguments == "push \"/Working/existing.nupkg\" -NonInteractive -ConfigFile \"/Working/NuGet.config\""));
            }
コード例 #12
0
ファイル: NuGetPusherTests.cs プロジェクト: sjmcallister/cake
            public void Should_Add_Api_Key_To_Arguments_If_Not_Null()
            {
                // Given
                var fixture = new NuGetFixture();
                var pusher  = fixture.CreatePusher();

                // When
                pusher.Push("./existing.nupkg", new NuGetPushSettings
                {
                    ApiKey = "1234"
                });

                // Then
                fixture.ProcessRunner.Received(1).Start(Arg.Is <ProcessStartInfo>(
                                                            p => p.Arguments == "push \"/Working/existing.nupkg\" 1234 -NonInteractive"));
            }
コード例 #13
0
ファイル: NuGetPusherTests.cs プロジェクト: sjmcallister/cake
            public void Should_Add_Verbosity_To_Arguments_If_Not_Null(NuGetVerbosity verbosity, string name)
            {
                // Given
                var fixture  = new NuGetFixture();
                var pusher   = fixture.CreatePusher();
                var expected = string.Format("push \"/Working/existing.nupkg\" -NonInteractive -Verbosity {0}", name);

                // When
                pusher.Push("./existing.nupkg", new NuGetPushSettings
                {
                    Verbosity = verbosity
                });

                // Then
                fixture.ProcessRunner.Received(1).Start(Arg.Is <ProcessStartInfo>(
                                                            p => p.Arguments == expected));
            }