using System; using System.Collections.Generic; using System.Linq; using UnityEngine; namespace UnityTest { public class GroupByExecutionMethodRenderer : AssertionListRenderer { protected override IEnumerable> GroupResult(IEnumerable assertionComponents) { var enumVals = Enum.GetValues(typeof(CheckMethod)).Cast(); var pairs = new List(); foreach (var checkMethod in enumVals) { var components = assertionComponents.Where(c => (c.checkMethods & checkMethod) == checkMethod); var componentPairs = components.Select(a => new CheckFunctionAssertionPair {checkMethod = checkMethod, assertionComponent = a}); pairs.AddRange(componentPairs); } return pairs.GroupBy(pair => pair.checkMethod, pair => pair.assertionComponent); } private class CheckFunctionAssertionPair { public AssertionComponent assertionComponent; public CheckMethod checkMethod; } } }