Exemple #1
0
        public void Should_Throw_Cake_Exception_If_Cant_Parse_MinVer_Version()
        {
            var fixture = new MinVerToolFixture(_log);

            fixture.LocalTool.StandardOutput = new[] { "abcd" };

            fixture.Invoking(f => f.Run())
            .Should().ThrowExactly <CakeException>()
            .WithMessage("Version 'abcd' is not valid.");
        }
Exemple #2
0
        public void Should_Throw_If_Settings_Are_Null()
        {
            var fixture = new MinVerToolFixture(_log)
            {
                Settings = null,
            };

            fixture.GivenDefaultToolDoNotExist();

            fixture.Invoking(f => f.Run())
            .Should().ThrowExactly <ArgumentNullException>()
            .And.ParamName.Should().Be("settings");
        }
Exemple #3
0
        public void Should_Not_Fallback_If_NoFallback_Is_True()
        {
            var fixture = new MinVerToolFixture(_log)
            {
                Settings = { NoFallback = true },
            };

            fixture.GivenLocalToolFailsToRun();

            fixture.Invoking(f => f.Run())
            .Should().ThrowExactly <CakeException>()
            .And.Message.Should().StartWith("MinVer: Process returned an error (exit code 1)");

            fixture.LocalTool.ShouldHaveRunOnce();
            fixture.GlobalTool.ShouldNotHaveRun();
        }
Exemple #4
0
        public void Should_Not_Fallback_If_ToolPath_Is_Set()
        {
            var fixture = new MinVerToolFixture(_log);

            fixture.GivenLocalToolIsNotInstalled();
            fixture.GivenGlobalToolIsNotInstalled();

            var customToolExePath = fixture.DefaultToolPath.GetDirectory().CombineWithFilePath("customLocation/custom.exe");

            fixture.FileSystem.CreateFile(customToolExePath);

            fixture.Settings.ToolPath = customToolExePath;

            fixture.GivenGlobalToolFailsToRun();

            fixture.Invoking(f => f.Run())
            .Should().ThrowExactly <CakeException>()
            .And.Message.Should().StartWith("MinVer: Process returned an error (exit code 1)");

            fixture.GlobalTool.ShouldHaveRunOnce();
            fixture.LocalTool.ShouldNotHaveRun();
        }