Пример #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>());
            }