Exemple #1
0
        public Rule(RuleTrigger trigger, RuleAction action)
        {
            Guard.NotNull(trigger);
            Guard.NotNull(action);

            SetTrigger(trigger);
            SetAction(action);
        }
Exemple #2
0
        public Rule(RuleTrigger trigger, RuleAction action)
        {
            Guard.NotNull(trigger, nameof(trigger));
            Guard.NotNull(action, nameof(action));

            this.trigger = trigger;
            this.action  = action;
        }
Exemple #3
0
        public Rule(RuleTrigger trigger, RuleAction action)
        {
            Guard.NotNull(trigger);
            Guard.NotNull(action);

            Action = action;

            Trigger = trigger;
        }
Exemple #4
0
        public Rule(RuleTrigger trigger, RuleAction action)
        {
            Guard.NotNull(trigger);
            Guard.NotNull(action);

            this.trigger = trigger;
            this.trigger.Freeze();

            this.action = action;
            this.action.Freeze();
        }
Exemple #5
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;
        }
Exemple #6
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;
            }));
        }
Exemple #7
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);
            }));
        }
Exemple #8
0
 private void SetAction(RuleAction newAction)
 {
     action = newAction;
     action.Freeze();
 }
Exemple #9
0
 public bool DeepEquals(RuleAction action)
 {
     return(SimpleEquals.IsEquals(this, action));
 }
Exemple #10
0
 public bool DeepEquals(RuleAction action)
 {
     return(this.WithDeepEqual(action).IgnoreProperty <Freezable>(x => x.IsFrozen).Compare());
 }