Esempio n. 1
0
            public void Should_Add_Mandatory_Arguments()
            {
                // Given
                var fixture = new DotNetCoreBuilderFixture();

                fixture.Project = "./src/*";

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

                // Then
                Assert.Equal("build \"./src/*\"", result.Args);
            }
Esempio n. 2
0
            public void Should_Quote_Project_Path(string text, string expected)
            {
                // Given
                var fixture = new DotNetCoreBuilderFixture();

                fixture.Project = text;

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

                // Then
                Assert.Equal(expected, result.Args);
            }
Esempio n. 3
0
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
            {
                // Given
                var fixture = new DotNetCoreBuilderFixture();

                fixture.Project = "./src/*";
                fixture.GivenProcessExitsWithCode(1);

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

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

                fixture.Project = "./src/*";
                fixture.GivenProcessCannotStart();

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

                // Then
                AssertEx.IsCakeException(result, ".NET Core CLI: Process was not started.");
            }
Esempio n. 5
0
            public void Should_Throw_If_Project_Is_Null()
            {
                // Given
                var fixture = new DotNetCoreBuilderFixture();

                fixture.Settings = new DotNetCoreBuildSettings();
                fixture.GivenDefaultToolDoNotExist();

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

                // Then
                AssertEx.IsArgumentNullException(result, "project");
            }
Esempio n. 6
0
            public void Should_Add_Host_Arguments()
            {
                // Given
                var fixture = new DotNetCoreBuilderFixture();

                fixture.Project = "./src/*";
                fixture.Settings.DiagnosticOutput = true;

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

                // Then
                Assert.Equal("--diagnostics build \"./src/*\"", result.Args);
            }
Esempio n. 7
0
            public void Should_Add_OutputPath_Arguments()
            {
                // Given
                var fixture = new DotNetCoreBuilderFixture();

                fixture.Settings.OutputDirectory = "./artifacts/";
                fixture.Project = "./src/*";

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

                // Then
                Assert.Equal("build \"./src/*\" --output \"/Working/artifacts\"", result.Args);
            }
Esempio n. 8
0
            public void Should_Add_Build_Arguments()
            {
                // Given
                var fixture = new DotNetCoreBuilderFixture();

                fixture.Settings.NoIncremental  = true;
                fixture.Settings.NoDependencies = true;
                fixture.Project = "./src/*";

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

                // Then
                Assert.Equal("build \"./src/*\" --no-incremental --no-dependencies", result.Args);
            }
Esempio n. 9
0
            public void Should_Throw_If_Settings_Are_Null()
            {
                // Given
                var fixture = new DotNetCoreBuilderFixture();

                fixture.Project  = "./src/*";
                fixture.Settings = null;
                fixture.GivenDefaultToolDoNotExist();

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

                // Then
                Assert.IsArgumentNullException(result, "settings");
            }
Esempio n. 10
0
            public void Should_Add_Additional_Arguments()
            {
                // Given
                var fixture = new DotNetCoreBuilderFixture();

                fixture.Settings.Frameworks    = new[] { "net451", "dnxcore50" };
                fixture.Settings.Runtime       = "runtime1";
                fixture.Settings.Configuration = "Release";
                fixture.Settings.VersionSuffix = "rc1";
                fixture.Project = "./src/*";

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

                // Then
                Assert.Equal("build ./src/* --runtime runtime1 --framework \"net451;dnxcore50\" --configuration Release --version-suffix rc1", result.Args);
            }
Esempio n. 11
0
            public void Should_Add_Build_Arguments()
            {
                // Given
                var fixture = new DotNetCoreBuilderFixture();

                fixture.Settings.BuildBasePath  = "./temp/";
                fixture.Settings.BuildProfile   = true;
                fixture.Settings.NoIncremental  = true;
                fixture.Settings.NoDependencies = true;
                fixture.Project = "./src/*";

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

                // Then
                Assert.Equal("build ./src/* --build-base-path \"/Working/temp\" --build-profile --no-incremental --no-dependencies", result.Args);
            }
Esempio n. 12
0
            public void Should_Add_Additional_Arguments()
            {
                // Given
                var fixture = new DotNetCoreBuilderFixture();

                fixture.Settings.Framework     = "net451";
                fixture.Settings.Runtime       = "runtime1";
                fixture.Settings.Configuration = "Release";
                fixture.Settings.VersionSuffix = "rc1";
                fixture.Project            = "./src/*";
                fixture.Settings.Verbosity = DotNetCoreVerbosity.Minimal;

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

                // Then
                Assert.Equal("build \"./src/*\" --runtime runtime1 --framework net451 --configuration Release --version-suffix rc1 --verbosity Minimal", result.Args);
            }
Esempio n. 13
0
            public void Should_Add_Additional_Arguments()
            {
                // Given
                var fixture = new DotNetCoreBuilderFixture();

                fixture.Settings.Framework     = "net451";
                fixture.Settings.Runtime       = "runtime1";
                fixture.Settings.Configuration = "Release";
                fixture.Settings.VersionSuffix = "rc1";
                fixture.Settings.NoLogo        = true;
                fixture.Project            = "./src/*";
                fixture.Settings.Verbosity = DotNetCoreVerbosity.Minimal;
                fixture.Settings.Sources   = new[] { "https://api.nuget.org/v3/index.json" };

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

                // Then
                Assert.Equal("build \"./src/*\" --runtime runtime1 --framework net451 --configuration Release --version-suffix rc1 --nologo --source \"https://api.nuget.org/v3/index.json\" --verbosity minimal", result.Args);
            }