コード例 #1
0
            public void Should_Add_Mandatory_Arguments()
            {
                // Given
                var fixture = new DotNetCoreNuGetUpdateSourceFixture();

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

                // Then
                Assert.Equal("nuget update source \"name\"", result.Args);
            }
コード例 #2
0
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
            {
                // Given
                var fixture = new DotNetCoreNuGetUpdateSourceFixture();

                fixture.GivenProcessExitsWithCode(1);

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

                // Then
                AssertEx.IsCakeException(result, ".NET CLI: Process returned an error (exit code 1).");
            }
コード例 #3
0
            public void Should_Throw_If_Process_Was_Not_Started()
            {
                // Given
                var fixture = new DotNetCoreNuGetUpdateSourceFixture();

                fixture.GivenProcessCannotStart();

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

                // Then
                AssertEx.IsCakeException(result, ".NET CLI: Process was not started.");
            }
コード例 #4
0
            public void Should_Throw_If_Settings_Are_Null()
            {
                // Given
                var fixture = new DotNetCoreNuGetUpdateSourceFixture();

                fixture.Settings = null;

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

                // Then
                AssertEx.IsArgumentNullException(result, "settings");
            }
コード例 #5
0
            public void Should_Throw_If_Name_Is_Null_Or_WhiteSpace(string name)
            {
                // Given
                var fixture = new DotNetCoreNuGetUpdateSourceFixture();

                fixture.Name = name;

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

                // Then
                AssertEx.IsArgumentException(result, "name", "Value cannot be null or whitespace.");
            }
コード例 #6
0
            public void Should_Add_Host_Arguments()
            {
                // Given
                var fixture = new DotNetCoreNuGetUpdateSourceFixture();

                fixture.Settings = new DotNetCoreNuGetSourceSettings {
                    DiagnosticOutput = true
                };

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

                // Then
                Assert.Equal("--diagnostics nuget update source \"name\"", result.Args);
            }
コード例 #7
0
            public void Should_Add_Additional_Arguments()
            {
                // Given
                var fixture = new DotNetCoreNuGetUpdateSourceFixture();

                fixture.Settings = new DotNetCoreNuGetSourceSettings
                {
                    Source   = "source",
                    UserName = "******",
                    Password = "******",
                    StorePasswordInClearText = true,
                    ValidAuthenticationTypes = "basic,negotiate"
                };

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

                // Then
                Assert.Equal("nuget update source \"name\" --source \"source\" --username \"username\" --password \"password\" --store-password-in-clear-text --valid-authentication-types \"basic,negotiate\"", result.Args);
            }