Beispiel #1
0
            public void Should_Throw_If_Path_Is_Null_WithSettings()
            {
                // Given
                var fixture  = new AppVeyorFixture();
                var appVeyor = fixture.CreateAppVeyorService();

                // When
                var result = Record.Exception(() => appVeyor.UploadArtifact(null, settings => settings.SetArtifactType(AppVeyorUploadArtifactType.Auto)));

                // Then
                Assert.IsArgumentNullException(result, "path");
            }
Beispiel #2
0
            public void Should_Return_False_If_Not_Running_On_AppVeyor()
            {
                // Given
                var fixture  = new AppVeyorFixture();
                var appVeyor = fixture.CreateAppVeyorService();

                // When
                var result = appVeyor.IsRunningOnAppVeyor;

                // Then
                Assert.False(result);
            }
Beispiel #3
0
            public void Should_Throw_If_Path_Is_Null()
            {
                // Given
                var fixture  = new AppVeyorFixture();
                var appVeyor = fixture.CreateAppVeyorService();

                // When
                var result = Record.Exception(() => appVeyor.UploadArtifact(null));

                // Then
                Assert.IsArgumentNullException(result, "path");
            }
Beispiel #4
0
            public void Should_Return_Non_Null_Reference()
            {
                // Given
                var fixture  = new AppVeyorFixture();
                var appVeyor = fixture.CreateAppVeyorService();

                // When
                var result = appVeyor.Environment;

                // Then
                Assert.NotNull(result);
            }
Beispiel #5
0
            public void Should_Throw_If_Build_Version_Is_Null()
            {
                // Given
                var fixture  = new AppVeyorFixture();
                var appVeyor = fixture.CreateAppVeyorService();

                // When
                var result = Record.Exception(() => appVeyor.UpdateBuildVersion(null));

                // Then
                Assert.IsArgumentNullException(result, "version");
            }
Beispiel #6
0
            public void Should_Throw_If_Path_Is_Null()
            {
                // Given
                var fixture  = new AppVeyorFixture();
                var appVeyor = fixture.CreateAppVeyorService();

                // When
                var result = Record.Exception(() => appVeyor.UploadTestResults(null, AppVeyorTestResultsType.XUnit));

                // Then
                AssertEx.IsArgumentNullException(result, "path");
            }
Beispiel #7
0
            public void Should_Throw_If_Message_Is_Empty()
            {
                // Given
                var fixture  = new AppVeyorFixture();
                var appVeyor = fixture.CreateAppVeyorService();

                // When
                var result = Record.Exception(() => appVeyor.AddMessage(""));

                // Then
                Assert.IsCakeException(result, "The message cannot be empty.");
            }
Beispiel #8
0
            public void Should_Throw_If_Message_Is_Null()
            {
                // Given
                var fixture  = new AppVeyorFixture();
                var appVeyor = fixture.CreateAppVeyorService();

                // When
                var result = Record.Exception(() => appVeyor.AddMessage(null));

                // Then
                Assert.IsArgumentNullException(result, "message");
            }
Beispiel #9
0
            public void Should_Throw_If_Not_Running_On_AppVeyor()
            {
                // Given
                var fixture  = new AppVeyorFixture();
                var appVeyor = fixture.CreateAppVeyorService();

                // When
                var result = Record.Exception(() => appVeyor.UploadTestResults("./file.xml", AppVeyorTestResultsType.XUnit));

                // Then
                Assert.IsExceptionWithMessage <CakeException>(result,
                                                              "The current build is not running on AppVeyor.");
            }
Beispiel #10
0
            public void Should_Throw_If_Not_Running_On_AppVeyor()
            {
                // Given
                var fixture  = new AppVeyorFixture();
                var appVeyor = fixture.CreateAppVeyorService();

                // When
                var result = Record.Exception(() => appVeyor.UpdateBuildVersion("build-123"));

                // Then
                Assert.IsExceptionWithMessage <CakeException>(result,
                                                              "The current build is not running on AppVeyor.");
            }
Beispiel #11
0
            public void Should_Throw_If_Build_Version_Is_Empty(string version)
            {
                // Given
                var fixture  = new AppVeyorFixture();
                var appVeyor = fixture.CreateAppVeyorService();

                // When
                var result = Record.Exception(() => appVeyor.UpdateBuildVersion(version));

                // Then
                Assert.IsExceptionWithMessage <CakeException>(result,
                                                              "The build version cannot be empty.");
            }
Beispiel #12
0
            public void Should_Upload_Artifact_Throw_Exception_For_DeploymentName_Containing_Spaces()
            {
                // Given
                var fixture = new AppVeyorFixture();

                fixture.IsRunningOnAppVeyor();
                var appVeyor = fixture.CreateAppVeyorService();

                // When
                var result = Record.Exception(() => appVeyor.UploadArtifact("./file.zip", settings => settings.SetDeploymentName("MyApp Web")));

                // Then
                Assert.IsCakeException(result, "The deployment name can not contain spaces");
            }
Beispiel #13
0
            public void Should_Update_Build_Version()
            {
                // Given
                var fixture = new AppVeyorFixture();

                fixture.IsRunningOnAppVeyor();
                var appVeyor = fixture.CreateAppVeyorService();

                // When
                appVeyor.UpdateBuildVersion("build-123");

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Is <FilePath>(p => p.FullPath == "appveyor"),
                    Arg.Is <ProcessSettings>(p => p.Arguments.Render() == "UpdateBuild -Version \"build-123\""));
            }
Beispiel #14
0
            public void Should_Add_Message(string message, AppVeyorMessageCategoryType category, string details, string args)
            {
                // Given
                var fixture = new AppVeyorFixture();

                fixture.IsRunningOnAppVeyor();
                var appVeyor = fixture.CreateAppVeyorService();

                // When
                appVeyor.AddMessage(message, category, details);

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Is <FilePath>(p => p.FullPath == "appveyor"),
                    Arg.Is <ProcessSettings>(p => p.Arguments.Render() == string.Format("AddMessage {0}", args)));
            }
Beispiel #15
0
            public void Should_Add_ErrorMessage()
            {
                // Given
                var fixture = new AppVeyorFixture();

                fixture.IsRunningOnAppVeyor();
                var          appVeyor = fixture.CreateAppVeyorService();
                const string message  = "Hello world";

                // When
                appVeyor.AddErrorMessage(message);

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Is <FilePath>(p => p.FullPath == "appveyor"),
                    Arg.Is <ProcessSettings>(p => p.Arguments.Render() == string.Format("AddMessage \"{0}\" -Category \"Error\"", message)));
            }
Beispiel #16
0
            public void Should_Upload_Artifact()
            {
                // Given
                var fixture = new AppVeyorFixture();

                fixture.IsRunningOnAppVeyor();
                var appVeyor = fixture.CreateAppVeyorService();

                // When
                appVeyor.UploadArtifact("./file.zip");

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Is <FilePath>(p => p.FullPath == "appveyor"),
                    Arg.Is <ProcessSettings>(p => p.Arguments.Render()
                                             == "PushArtifact -Path \"/Working/file.zip\" -FileName \"file.zip\""));
            }
Beispiel #17
0
            public void Should_Upload_Artifact_For_ArtifactType(AppVeyorUploadArtifactType type, string arg)
            {
                // Given
                var fixture = new AppVeyorFixture();

                fixture.IsRunningOnAppVeyor();
                var appVeyor = fixture.CreateAppVeyorService();

                // When
                appVeyor.UploadArtifact("./file.zip", settings => settings.SetArtifactType(type));

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Is <FilePath>(p => p.FullPath == "appveyor"),
                    Arg.Is <ProcessSettings>(p => p.Arguments.Render()
                                             == string.Format("PushArtifact -Path \"/Working/file.zip\" -FileName \"file.zip\" -ArtifactType \"{0}\"", arg)));
            }
Beispiel #18
0
            public void Should_Upload_Artifact_For_DeploymentName()
            {
                // Given
                var fixture = new AppVeyorFixture();

                fixture.IsRunningOnAppVeyor();
                var appVeyor = fixture.CreateAppVeyorService();

                // When
                appVeyor.UploadArtifact("./file.zip", settings => settings.SetDeploymentName("MyApp.Web"));

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Is <FilePath>(p => p.FullPath == "appveyor"),
                    Arg.Is <ProcessSettings>(p => p.Arguments.Render()
                                             == "PushArtifact \"/Working/file.zip\" -Type Auto -DeploymentName \"MyApp.Web\""));
            }
Beispiel #19
0
            public void Should_Add_ErrorMessageWithException()
            {
                // Given
                var fixture = new AppVeyorFixture();

                fixture.IsRunningOnAppVeyor();
                var          appVeyor  = fixture.CreateAppVeyorService();
                const string message   = "Hello world";
                var          exception = new CakeException("This is an exception", new ArgumentException());

                // When
                appVeyor.AddErrorMessage(message, exception);

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Is <FilePath>(p => p.FullPath == "appveyor"),
                    Arg.Is <ProcessSettings>(p => p.Arguments.Render() == string.Format("AddMessage \"{0}\" -Category \"Error\" -Details \"{1}\"", message, exception.ToString())));
            }