Ejemplo n.º 1
0
        public void Should_Prefer_Global_Tool_using_ToolPath_When_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;

            var result = fixture.Run();

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

            result.Version.Should().Be(MinVerToolOutputs.DefaultVersionForGlobalTool);
        }
Ejemplo n.º 2
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();
        }