public void SetUp() { modifier = Substitute.ForPartsOf <CanBeGroupedSelectionModifier.Modifier>(); canBeGroupedHelper = Substitute.For <IModifierHelper>(); modifier.CanBeGroupedHelper = canBeGroupedHelper; canBeGroupedHelper.Apply(Arg.Any <ISelectable[]>()).Returns(args => { List <ISelectable> selectables = new List <ISelectable>(args[0] as ISelectable[]); selectables.RemoveAll(x => x.Index >= 7); return(selectables.ToArray()); }); }
public void SetUp() { modifier = Substitute.ForPartsOf <TypePriorityInSelectionModifier.Modifier>(); typePriorityHelper = Substitute.For <IModifierHelper>(); modifier.TypePriorityHelper = typePriorityHelper; typePriorityHelper.Apply(Arg.Any <ISelectable[]>()).Returns(args => { var a = new List <ISelectable>(); var b = new List <ISelectable>(); var c = new List <ISelectable>(); (args[0] as ISelectable[]).ToList().ForEach(x => { if (x.Index < 4) { a.Add(x); } else if (x.Index < 7) { b.Add(x); } else { c.Add(x); } }); if (a.Count > 0) { return(a.ToArray()); } else if (b.Count > 0) { return(new ISelectable[] { b.First() }); } else if (c.Count > 0) { return(new ISelectable[] { c.First() }); } return(new ISelectable[] { }); }); }