Exemple #1
0
        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());
        }
Exemple #2
0
        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());
        }
Exemple #3
0
        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);
Exemple #5
0
        public static IEnumerable <string> GetAllSlots([NotNull] this ISlotConfiguration configuration)
        {
            Ensure.Any.IsNotNull(configuration, nameof(configuration));

            return(new[] { configuration.Slot }.Concat(configuration.AdditionalSlots));
        }