Beispiel #1
0
        public void Should_Add_Directory_To_Deploy_To_Arguments()
        {
            // Given
            var fixture = new NetlifyDeployFixture();

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

            // Then
            result.Args.Should().Equals("deploy -p \"/Working/dist\"");
        }
Beispiel #2
0
        public void Should_Find_Netlify_Executable_If_Tool_Path_Not_Provided()
        {
            // Given
            var fixture = new NetlifyDeployFixture();

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

            // Then
            result.Path.FullPath.Should().Equals("/Working/tools/netlify.cmd");
        }
        public void Should_Throw_If_Context_Is_Null()
        {
            // Given
            var fixture = new NetlifyDeployFixture();

            // When
            var result = Record.Exception(() => NetlifyAliases.NetlifyDeploy(
                                              null, fixture.DirectoryToDeploy, fixture.Settings));

            // Then
            result.Should().BeOfType <ArgumentNullException>().Subject.ParamName.Should().Equals("context");
        }
Beispiel #4
0
        public void Should_Throw_If_Process_Was_Not_Started()
        {
            // Given
            var fixture = new NetlifyDeployFixture();

            fixture.GivenProcessCannotStart();

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

            // Then
            result.Should().BeOfType <CakeException>().Subject.Message.Should().Equals("Netlify: Process was not started.");
        }
Beispiel #5
0
        public void Should_Throw_If_Netlify_Executable_Was_Not_Found()
        {
            // Given
            var fixture = new NetlifyDeployFixture();

            fixture.GivenDefaultToolDoNotExist();

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

            // Then
            result.Should().BeOfType <CakeException>().Subject.Message.Should().Equals("Netlify: Could not locate executable.");
        }
Beispiel #6
0
        public void Should_Throw_If_Directory_To_Deploy_Is_Null()
        {
            // Given
            var fixture = new NetlifyDeployFixture();

            fixture.DirectoryToDeploy = null;

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

            // Then
            result.Should().BeOfType <ArgumentNullException>().Subject.ParamName.Should().Equals("directoryToDeploy");
        }
Beispiel #7
0
        public void Should_Add_Token_To_Arguments()
        {
            // Given
            var fixture = new NetlifyDeployFixture();

            fixture.Settings.SiteId = "123";
            fixture.Settings.Token  = "456";
            // When
            var result = fixture.Run();

            // Then
            result.Args.Should().Equals("deploy -p \"/Working/dist\" -s 123 -t 456");
        }
Beispiel #8
0
        public void Should_Throw_If_Settings_Are_Null()
        {
            // Given
            var fixture = new NetlifyDeployFixture();

            fixture.Settings = null;

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

            // Then
            result.Should().BeOfType <ArgumentNullException>().Subject.ParamName.Should().Equals("settings");
        }
        public void Should_Throw_If_Directory_To_Deploy_Is_Null()
        {
            // Given
            var fixture = new NetlifyDeployFixture();
            var context = Substitute.For <ICakeContext>();

            // When
            var result = Record.Exception(() => NetlifyAliases.NetlifyDeploy(
                                              context, null, fixture.Settings));

            // Then
            result.Should().BeOfType <ArgumentNullException>().Subject.ParamName.Should().Equals("directoryToDeploy");
        }
Beispiel #10
0
        public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
        {
            // Given
            var fixture = new NetlifyDeployFixture();

            fixture.GivenProcessExitsWithCode(1);

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

            // Then
            result.Should().BeOfType <CakeException>().Subject.Message
            .Should().Equals("Netlify: Process returned an error (exit code 1).");
        }
Beispiel #11
0
        public void Should_Use_Netlify_Executable_From_Tool_Path_If_Provided(string toolPath, string expected)
        {
            // Given
            var fixture = new NetlifyDeployFixture();

            fixture.Settings.ToolPath = toolPath;
            fixture.GivenSettingsToolPathExist();

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

            // Then
            result.Path.FullPath.Should().Equals(expected);
        }
Beispiel #12
0
        public void Should_Add_Environment_To_Arguments()
        {
            // Given
            var fixture = new NetlifyDeployFixture();

            fixture.Settings.SiteId      = "123";
            fixture.Settings.Token       = "456";
            fixture.Settings.Draft       = true;
            fixture.Settings.Environment = "production";

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

            // Then
            result.Args.Should().Equals("deploy -p \"/Working/dist\" -s 123 -t 456 -d -e production");
        }