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);
            }
            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).");
            }
            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.");
            }
            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");
            }
            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.");
            }
            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);
            }
            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);
            }