Example #1
0
        public void Update(RuleAction newAction)
        {
            Guard.NotNull(newAction, nameof(newAction));

            if (newAction.GetType() != action.GetType())
            {
                throw new ArgumentException("New action has another type.", nameof(newAction));
            }

            action = newAction;
        }
Example #2
0
        public Rule Update(RuleAction newAction)
        {
            Guard.NotNull(newAction, nameof(newAction));

            if (newAction.GetType() != action.GetType())
            {
                throw new ArgumentException("New action has another type.", nameof(newAction));
            }

            return(Clone(clone =>
            {
                clone.action = newAction;
            }));
        }
Example #3
0
        public Rule Update(RuleAction newAction)
        {
            Guard.NotNull(newAction);

            if (newAction.GetType() != action.GetType())
            {
                throw new ArgumentException("New action has another type.", nameof(newAction));
            }

            if (action.DeepEquals(newAction))
            {
                return(this);
            }

            return(Clone(clone =>
            {
                clone.SetAction(newAction);
            }));
        }