예제 #1
0
            public void Should_Throw_If_Tools_Could_Not_Be_Found()
            {
                // Given
                var fixture = new ScriptProcessorFixture();

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

                // Then
                Assert.IsCakeException(result, "Failed to install tool 'tool'.");
            }
예제 #2
0
            public void Should_Throw_If_Installer_Could_Not_Be_Resolved()
            {
                // Given
                var fixture = new ScriptProcessorFixture();

                fixture.GivenNoInstallerCouldBeResolved();

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

                // Then
                Assert.IsCakeException(result, "Could not find an installer for the 'custom' scheme.");
            }
예제 #3
0
            public void Should_Throw_If_Install_Path_Is_Null()
            {
                // Given
                var fixture = new ScriptProcessorFixture();

                fixture.InstallPath = null;

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

                // Then
                Assert.IsArgumentNullException(result, "installPath");
            }
예제 #4
0
            public void Should_Throw_If_Analyzer_Result_Is_Null()
            {
                // Given
                var fixture = new ScriptProcessorFixture();

                fixture.Result = null;

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

                // Then
                Assert.IsArgumentNullException(result, "analyzerResult");
            }
예제 #5
0
            public void Should_Register_Installed_Tools_With_The_Tool_Service()
            {
                // Given
                var fixture = new ScriptProcessorFixture();

                fixture.GivenFilesWillBeInstalled();

                // When
                fixture.InstallTools();

                // Then
                fixture.Tools.Received(1).RegisterFile(
                    Arg.Is <FilePath>(path => path.FullPath == "/Working/Bin/Temp.dll"));
            }
예제 #6
0
            public void Should_Not_Install_Addins_Present_On_Disc()
            {
                // Given
                var fixture = new ScriptProcessorFixture();

                fixture.GivenToolFilesAlreadyHaveBeenDownloaded();

                // When
                fixture.InstallTools();

                // Then
                fixture.Installer.Received(0)
                .InstallPackage(Arg.Any <NuGetPackage>(), Arg.Any <DirectoryPath>());
            }
예제 #7
0
            public void Should_Install_Tools_Referenced_By_Scripts()
            {
                // Given
                var fixture = new ScriptProcessorFixture();

                fixture.GivenFilesWillBeInstalled();

                // When
                fixture.InstallTools();

                // Then
                fixture.Installer.Received(1).Install(
                    Arg.Is <PackageReference>(package => package.OriginalString == "custom:?package=tool"),
                    Arg.Is <PackageType>(type => type == PackageType.Tool),
                    Arg.Is <DirectoryPath>(path => path.FullPath == "/Working/Bin"));
            }
예제 #8
0
            public void Should_Install_Tools_Referenced_By_Scripts()
            {
                // Given
                var fixture = new ScriptProcessorFixture();

                fixture.GivenToolFilesAreDownloaded();

                // When
                fixture.InstallTools();

                // Then
                fixture.Installer.Received(1).InstallPackage(
                    Arg.Is <NuGetPackage>(package =>
                                          package.PackageId == "Tool" &&
                                          package.Source == "http://example.com"),
                    Arg.Any <DirectoryPath>());
            }