本文整理汇总了C#中System.Result.Append方法的典型用法代码示例。如果您正苦于以下问题:C# Result.Append方法的具体用法?C# Result.Append怎么用?C# Result.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Result
的用法示例。
在下文中一共展示了Result.Append方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Append_GivenInitialFailureAndSuccessParameter_ShouldReturnFailure
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 );
}
示例2: Append_GivenMessage_ShouldAddMessage
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 ) );
}
示例3: Append_ValueResult_GivenInitialSuccessAndSuccessParameter_ShouldReturnSuccess
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);
}