示例#1
0
        private bool IsMet(UpdateStepContextPrecondition precondition)
        {
            foreach (var handler in _preconditionHandlers)
            {
                if (!handler.CanHandle(precondition))
                {
                    continue;
                }

                return(handler.IsMet(precondition));
            }

            return(true);
            // TODO: fix
            //  throw new InvalidOperationException($"Precondition {precondition} not supported");
        }
示例#2
0
        public bool IsMet(UpdateStepContextWithPreconditions context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (context.Preconditions == null)
            {
                throw new InvalidOperationException();
            }

            return(context.Preconditions.All(p =>
            {
                var updateStepContextPrecondition = new UpdateStepContextPrecondition(context, p);
                var result = IsMet(updateStepContextPrecondition);
                return result;
            }));
        }