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

                fixture.Settings.Sources         = new[] { "https://www.example.com/source1", "https://www.example.com/source2" };
                fixture.Settings.FallbackSources = new[] { "https://www.example.com/fallback1", "https://www.example.com/fallback2" };
#pragma warning disable 0618
                fixture.Settings.Quiet = true;
#pragma warning restore 0618
                fixture.Settings.NoCache             = true;
                fixture.Settings.DisableParallel     = true;
                fixture.Settings.ForceEnglishOutput  = true;
                fixture.Settings.IgnoreFailedSources = true;
                fixture.Settings.InferRuntimes       = new[] { "runtime1", "runtime2" };
                fixture.Settings.ConfigFile          = "./NuGet.config";
                fixture.Settings.PackagesDirectory   = "./packages/";
                fixture.Settings.Verbosity           = DotNetCoreRestoreVerbosity.Information;

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

                // Then
                Assert.Equal("restore" +
                             " --packages \"/Working/packages\"" +
                             " --source \"https://www.example.com/source1\"" +
                             " --source \"https://www.example.com/source2\"" +
                             " --fallbacksource \"https://www.example.com/fallback1\"" +
                             " --fallbacksource \"https://www.example.com/fallback2\"" +
                             " --configfile \"/Working/NuGet.config\"" +
                             " --infer-runtimes \"runtime1\"" +
                             " --infer-runtimes \"runtime2\"" +
                             " --no-cache --disable-parallel --ignore-failed-sources --force-english-output" +
                             " --verbosity Information", result.Args);
            }
コード例 #2
0
ファイル: DotNetCoreRestorerTests.cs プロジェクト: zokiz/cake
            public void Should_Add_Settings()
            {
                // Given
                var fixture = new DotNetCoreRestorerFixture();

                fixture.Settings.Sources             = new[] { "https://www.example.com/source1", "https://www.example.com/source2" };
                fixture.Settings.NoCache             = true;
                fixture.Settings.DisableParallel     = true;
                fixture.Settings.IgnoreFailedSources = true;
                fixture.Settings.ConfigFile          = "./NuGet.config";
                fixture.Settings.PackagesDirectory   = "./packages/";
                fixture.Settings.Runtime             = "runtime1";
                fixture.Settings.NoDependencies      = true;
                fixture.Settings.Verbosity           = DotNetCoreVerbosity.Minimal;

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

                // Then
                Assert.Equal("restore" +
                             " --runtime runtime1" +
                             " --packages \"/Working/packages\"" +
                             " --source \"https://www.example.com/source1\"" +
                             " --source \"https://www.example.com/source2\"" +
                             " --configfile \"/Working/NuGet.config\"" +
                             " --no-cache --disable-parallel --ignore-failed-sources --no-dependencies" +
                             " --verbosity Minimal", result.Args);
            }
コード例 #3
0
            public void Should_Add_Mandatory_Arguments()
            {
                // Given
                var fixture = new DotNetCoreRestorerFixture();

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

                // Then
                Assert.Equal("restore", result.Args);
            }
コード例 #4
0
            public void Should_Quote_Root_Path(string text, string expected)
            {
                // Given
                var fixture = new DotNetCoreRestorerFixture();

                fixture.Root = text;

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

                // Then
                Assert.Equal(expected, result.Args);
            }
コード例 #5
0
            public void Should_Add_Path()
            {
                // Given
                var fixture = new DotNetCoreRestorerFixture();

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

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

                // Then
                Assert.Equal("restore \"./src/*\"", result.Args);
            }
コード例 #6
0
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
            {
                // Given
                var fixture = new DotNetCoreRestorerFixture();

                fixture.GivenProcessExitsWithCode(1);

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

                // Then
                Assert.IsCakeException(result, ".NET Core CLI: Process returned an error (exit code 1).");
            }
コード例 #7
0
ファイル: DotNetCoreRestorerTests.cs プロジェクト: zokiz/cake
            public void Should_Add_Host_Arguments()
            {
                // Given
                var fixture = new DotNetCoreRestorerFixture();

                fixture.Settings.DiagnosticOutput = true;

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

                // Then
                Assert.Equal("--diagnostics restore", result.Args);
            }
コード例 #8
0
            public void Should_Add_ForceEvaluate()
            {
                // Given
                var fixture = new DotNetCoreRestorerFixture();

                fixture.Settings.ForceEvaluate = true;

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

                // Then
                Assert.Equal($@"restore --force-evaluate", result.Args);
            }
コード例 #9
0
            public void Should_Add_LockedMode()
            {
                // Given
                var fixture = new DotNetCoreRestorerFixture();

                fixture.Settings.LockedMode = true;

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

                // Then
                Assert.Equal($@"restore --locked-mode", result.Args);
            }
コード例 #10
0
            public void Should_Add_UseLockFile()
            {
                // Given
                var fixture = new DotNetCoreRestorerFixture();

                fixture.Settings.UseLockFile = true;

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

                // Then
                Assert.Equal($@"restore --use-lock-file", result.Args);
            }
コード例 #11
0
            public void Should_Add_Interactive()
            {
                // Given
                var fixture = new DotNetCoreRestorerFixture();

                fixture.Settings.Interactive = true;

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

                // Then
                Assert.Equal($@"restore --interactive", result.Args);
            }
コード例 #12
0
            public void Should_Throw_If_Process_Was_Not_Started()
            {
                // Given
                var fixture = new DotNetCoreRestorerFixture();

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

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

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

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

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

                // Then
                Assert.IsArgumentNullException(result, "settings");
            }
コード例 #14
0
            public void Should_Add_LockFilePath()
            {
                // Given
                var          fixture  = new DotNetCoreRestorerFixture();
                const string lockfile = @"mypackages.lock.json";

                fixture.Settings.LockFilePath = lockfile;

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

                // Then
                Assert.Equal($@"restore --lock-file-path ""/Working/{lockfile}""", result.Args);
            }
コード例 #15
0
            public void Quiet_Does_Not_Set_Verbosity()
            {
                // Given
                var fixture = new DotNetCoreRestorerFixture();

                fixture.Settings.Sources = new[] { "https://www.example.com/source1", "https://www.example.com/source2" };
#pragma warning disable 0618
                fixture.Settings.Quiet = true;
#pragma warning restore 0618

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

                // Then
                Assert.Equal("restore" +
                             " --source \"https://www.example.com/source1\"" +
                             " --source \"https://www.example.com/source2\"", result.Args);
            }