Example #1
0
            public void Should_Add_Additional_Arguments()
            {
                // Given
                const string packageName  = "foo.nupkg";
                const int    timeout      = 60;
                const string source       = "http://www.nuget.org/api/v2/package";
                const string apiKey       = "key1234";
                const string symbolSource = "http://www.symbolserver.org/";
                const string symbolApiKey = "key5678";

                var fixture = new DotNetCorePusherFixture();

                fixture.Settings.Source             = source;
                fixture.Settings.ApiKey             = apiKey;
                fixture.Settings.SymbolSource       = symbolSource;
                fixture.Settings.SymbolApiKey       = symbolApiKey;
                fixture.Settings.Timeout            = timeout;
                fixture.Settings.DisableBuffering   = true;
                fixture.Settings.IgnoreSymbols      = true;
                fixture.Settings.ForceEnglishOutput = true;
                fixture.PackageName = packageName;

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

                // Then
                Assert.Equal(string.Format("nuget push {0} --source {1} --api-key \"{2}\" --symbol-source {3} --symbol-api-key \"{4}\" --timeout {5} --disable-buffering --no-symbols --force-english-output", packageName, source, apiKey, symbolSource, symbolApiKey, timeout), result.Args);
            }
Example #2
0
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
            {
                // Given
                var fixture = new DotNetCorePusherFixture();

                fixture.PackageName = "foo.nupkg";
                fixture.GivenProcessExitsWithCode(1);

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

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

                fixture.PackageName = "foo.nupkg";
                fixture.GivenProcessCannotStart();

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

                // Then
                AssertEx.IsCakeException(result, ".NET Core CLI: Process was not started.");
            }
Example #4
0
            public void Should_Throw_If_PackageName_Is_Empty(string packageName)
            {
                // Given
                var fixture = new DotNetCorePusherFixture();

                fixture.PackageName = packageName;
                fixture.Settings    = new DotNetCoreNuGetPushSettings();

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

                // Then
                AssertEx.IsArgumentNullException(result, "packageName");
            }
Example #5
0
            public void Should_Throw_If_Settings_Are_Null()
            {
                // Given
                var fixture = new DotNetCorePusherFixture();

                fixture.Settings = null;
                fixture.GivenDefaultToolDoNotExist();

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

                // Then
                AssertEx.IsArgumentNullException(result, "settings");
            }
Example #6
0
            public void Should_Add_Mandatory_Arguments()
            {
                // Given
                const string packageName = "foo.nupkg";

                var fixture = new DotNetCorePusherFixture();

                fixture.PackageName = packageName;

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

                // Then
                Assert.Equal(string.Format("nuget push {0}", packageName), result.Args);
            }
Example #7
0
            public void Should_Add_Host_Arguments()
            {
                // Given
                const string packageName = "foo.nupkg";

                var fixture = new DotNetCorePusherFixture();

                fixture.Settings.DiagnosticOutput = true;
                fixture.PackageName = packageName;

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

                // Then
                Assert.Equal(string.Format("--diagnostics nuget push {0}", packageName), result.Args);
            }