public void Append_GivenInitialFailureAndSuccessParameter_ShouldReturnFailure() { // Arrange var originalResult = new Result { Success = false }; var appendedResult = new Result { Success = true }; // Act var returnedResult = originalResult.Append( appendedResult ); // Assert Assert.IsFalse( originalResult.Success ); Assert.IsFalse( returnedResult.Success ); }
public void Append_GivenMessage_ShouldAddMessage() { // Arrange var originalMessage = "original message"; var originalResult = new Result { Message = originalMessage }; var appendedMessage = "appended message"; var appendedResult = new Result { Message = appendedMessage }; // Act var returnedResult = originalResult.Append( appendedResult ); // Assert Assert.AreEqual( 2, returnedResult.GetMessages().Count() ); Assert.AreEqual( originalMessage, returnedResult.GetMessages().ElementAt( 0 ) ); Assert.AreEqual( appendedMessage, returnedResult.GetMessages().ElementAt( 1 ) ); Assert.AreEqual( 2, originalResult.GetMessages().Count() ); Assert.AreEqual( originalMessage, originalResult.GetMessages().ElementAt( 0 ) ); Assert.AreEqual( appendedMessage, originalResult.GetMessages().ElementAt( 1 ) ); }
public void Append_ValueResult_GivenInitialSuccessAndSuccessParameter_ShouldReturnSuccess() { // Arrange var originalResult = new Result<string> { Success = true }; var appendedResult = new Result<string> { Success = true }; // Act var returnedResult = originalResult.Append(appendedResult); // Assert Assert.IsTrue(originalResult.Success); Assert.IsTrue(returnedResult.Success); }