예제 #1
0
            public void Should_Add_Mandatory_Arguments()
            {
                // Given
                var fixture = new DotNetCoreNuGetHasSourceFixture();

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

                // Then
                Assert.Equal("nuget list source --format \"detailed\"", result.Args);
            }
예제 #2
0
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
            {
                // Given
                var fixture = new DotNetCoreNuGetHasSourceFixture();

                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 DotNetCoreNuGetHasSourceFixture();

                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 DotNetCoreNuGetHasSourceFixture();

                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 DotNetCoreNuGetHasSourceFixture();

                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 DotNetCoreNuGetHasSourceFixture();

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

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

                // Then
                Assert.Equal("--diagnostics nuget list source --format \"detailed\"", result.Args);
            }
예제 #7
0
            public void Should_Return_True_For_Configured_Source(string name, string status)
            {
                // Given
                var fixture = new DotNetCoreNuGetHasSourceFixture();

                fixture.Name = name;
                fixture.GivenProcessOutput(new[]
                {
                    "Registered Sources:",
                    $"  1.  {name} [{status}]",
                    "      https://api.myfeed.org/v3/index.json"
                });

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

                // Then
                Assert.True(fixture.HasSource);
            }