public virtual bool AllowedFor(ISlotConfiguration context) { Ensure.That(context, nameof(context)).IsNotNull(); var allSlots = context.GetAllSlots(); return(allSlots.All(Slots.ContainsKey) && allSlots.Except(this.OccupiedSlots()).Any()); }
public virtual bool AllowedFor(ISlotConfiguration context) { if (context == null) { return(false); } var allSlots = new HashSet <string>(context.GetAllSlots()); if (!allSlots.All(Slots.ContainsKey)) { return(false); } return(!new HashSet <string>(this.OccupiedSlots()).Intersect(allSlots).Any()); }
public static Set <string> GetAllSlots(this ISlotConfiguration configuration) { Ensure.That(configuration, nameof(configuration)).IsNotNull(); return(Set(configuration.Slot).Union(configuration.AdditionalSlots)); }
public override bool AllowedFor(ISlotConfiguration context) => (context is EquipmentConfiguration || context is Equipment) && base.AllowedFor(context);
public static IEnumerable <string> GetAllSlots([NotNull] this ISlotConfiguration configuration) { Ensure.Any.IsNotNull(configuration, nameof(configuration)); return(new[] { configuration.Slot }.Concat(configuration.AdditionalSlots)); }