public void PublishResultsShouldNotCleanTemporaryResultsOnMergeFailure() { // Set up the test var result = this.mocks.StrictMock <IIntegrationResult>(); var parameters = new List <NameValuePair>(); SetupResult.For(result.Parameters).Return(parameters); SetupResult.For(result.Succeeded).Return(false); SetupResult.For(result.Modifications).Return(new Modification[0]); SetupResult.For(result.FailureUsers).Return(new ArrayList()); var results = new List <ITaskResult>(); SetupResult.For(result.TaskResults).Return(results); var project = new Project(); project.Publishers = new ITask[] { new PhantomPublisher(true) }; var tempResult = new PhantomResult(p => { Assert.Fail("CleanUp() called"); }); results.Add(tempResult); // Run the test this.mocks.ReplayAll(); project.PublishResults(result); // Check the results this.mocks.VerifyAll(); }
public void PublishResultsShouldCleanTemporaryResultsOnSuccess() { // Set up the test var result = this.mocks.StrictMock <IIntegrationResult>(); var parameters = new List <NameValuePair>(); SetupResult.For(result.Parameters).Return(parameters); SetupResult.For(result.Succeeded).Return(true); var results = new List <ITaskResult>(); SetupResult.For(result.TaskResults).Return(results); var project = new Project(); project.Publishers = new ITask[] { new PhantomPublisher(false) }; var cleaned = false; var tempResult = new PhantomResult(p => { cleaned = true; }); results.Add(tempResult); // Run the test this.mocks.ReplayAll(); project.PublishResults(result); // Check the results this.mocks.VerifyAll(); Assert.IsTrue(cleaned); }
public void PublishResultsShouldNotCleanTemporaryResultsOnMergeFailure() { // Set up the test var result = this.mocks.Create <IIntegrationResult>(MockBehavior.Strict).Object; var parameters = new List <NameValuePair>(); Mock.Get(result).SetupGet(_result => _result.Parameters).Returns(parameters); Mock.Get(result).SetupGet(_result => _result.Succeeded).Returns(false); Mock.Get(result).SetupGet(_result => _result.Modifications).Returns(new Modification[0]); Mock.Get(result).SetupGet(_result => _result.FailureUsers).Returns(new ArrayList()); Mock.Get(result).SetupGet(_result => _result.FailureTasks).Returns(new ArrayList()); var results = new List <ITaskResult>(); Mock.Get(result).SetupGet(_result => _result.TaskResults).Returns(results); var project = new Project(); project.Publishers = new ITask[] { new PhantomPublisher(true) }; var tempResult = new PhantomResult(p => { Assert.Fail("CleanUp() called"); }); results.Add(tempResult); // Run the test project.PublishResults(result); // Check the results this.mocks.Verify(); }
public void PublishResultsShouldNotCleanTemporaryResultsOnMergeFailure() { // Set up the test var result = this.mocks.StrictMock<IIntegrationResult>(); var parameters = new List<NameValuePair>(); SetupResult.For(result.Parameters).Return(parameters); SetupResult.For(result.Succeeded).Return(false); SetupResult.For(result.Modifications).Return(new Modification[0]); SetupResult.For(result.FailureUsers).Return(new ArrayList()); SetupResult.For(result.FailureTasks).Return(new ArrayList()); var results = new List<ITaskResult>(); SetupResult.For(result.TaskResults).Return(results); var project = new Project(); project.Publishers = new ITask[] { new PhantomPublisher(true) }; var tempResult = new PhantomResult(p => { Assert.Fail("CleanUp() called"); }); results.Add(tempResult); // Run the test this.mocks.ReplayAll(); project.PublishResults(result); // Check the results this.mocks.VerifyAll(); }
public void PublishResultsShouldCleanTemporaryResultsOnSuccess() { // Set up the test var result = this.mocks.StrictMock<IIntegrationResult>(); var parameters = new List<NameValuePair>(); SetupResult.For(result.Parameters).Return(parameters); SetupResult.For(result.Succeeded).Return(true); var results = new List<ITaskResult>(); SetupResult.For(result.TaskResults).Return(results); var project = new Project(); project.Publishers = new ITask[] { new PhantomPublisher(false) }; var cleaned = false; var tempResult = new PhantomResult(p => { cleaned = true; }); results.Add(tempResult); // Run the test this.mocks.ReplayAll(); project.PublishResults(result); // Check the results this.mocks.VerifyAll(); Assert.IsTrue(cleaned); }