本文整理汇总了C#中IOperation.GetExecutedChildOperationsForOperationHierarchy方法的典型用法代码示例。如果您正苦于以下问题:C# IOperation.GetExecutedChildOperationsForOperationHierarchy方法的具体用法?C# IOperation.GetExecutedChildOperationsForOperationHierarchy怎么用?C# IOperation.GetExecutedChildOperationsForOperationHierarchy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOperation
的用法示例。
在下文中一共展示了IOperation.GetExecutedChildOperationsForOperationHierarchy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VerifyExecutedOperations
private static void VerifyExecutedOperations(IOperation operation, Type[] expectedOperationTypes, bool allowOperationFailures)
{
Verify.NotNull(operation, nameof(operation));
Verify.NotNull(expectedOperationTypes, nameof(expectedOperationTypes));
var messageParts = new List<string>(expectedOperationTypes.Length + 2) { "Operations", "==========" };
var executedOperations = operation.GetExecutedChildOperationsForOperationHierarchy().ToList();
var items = Math.Max(expectedOperationTypes.Length, executedOperations.Count);
var hasErrors = false;
for (var i = 0; i < items; i++)
{
if (i >= executedOperations.Count)
{
messageParts.Add("none [error: expected " + expectedOperationTypes[i].Name + "]");
hasErrors = true;
continue;
}
var executedOperationType = executedOperations[i].Operation.GetType();
if (i >= expectedOperationTypes.Length)
{
messageParts.Add(executedOperationType.Name + " [error: expected none]");
hasErrors = true;
continue;
}
if (executedOperationType != expectedOperationTypes[i])
{
messageParts.Add(executedOperationType.Name + " [error: expected " + expectedOperationTypes[i].Name + "]");
hasErrors = true;
continue;
}
var hasFailedOperation = !allowOperationFailures && executedOperations[i].Error != null;
hasErrors = hasErrors || hasFailedOperation;
var matchMessage = hasFailedOperation ? " [match, failed]" : " [match]";
messageParts.Add(expectedOperationTypes[i].Name + matchMessage);
}
if (hasErrors)
throw new AssertionException(string.Join(Environment.NewLine, messageParts));
}