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"); }
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); }
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"); }
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); }
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"); }
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"); }
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."); }
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"); }
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."); }
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."); }
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."); }
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"); }
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\"")); }
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))); }
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))); }
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\"")); }
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))); }
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\"")); }
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()))); }