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

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

            SetTrigger(trigger);
            SetAction(action);
        }
Beispiel #3
0
        public Rule(RuleTrigger trigger, RuleAction action)
        {
            Guard.NotNull(trigger);
            Guard.NotNull(action);

            Action = action;

            Trigger = trigger;
        }
Beispiel #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();
        }
Beispiel #5
0
        public void Update(RuleTrigger newTrigger)
        {
            Guard.NotNull(newTrigger, nameof(newTrigger));

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

            trigger = newTrigger;
        }
Beispiel #6
0
        public Rule Update(RuleTrigger newTrigger)
        {
            Guard.NotNull(newTrigger, nameof(newTrigger));

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

            return(Clone(clone =>
            {
                clone.trigger = newTrigger;
            }));
        }
Beispiel #7
0
        public Rule Update(RuleTrigger newTrigger)
        {
            Guard.NotNull(newTrigger);

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

            if (trigger.DeepEquals(newTrigger))
            {
                return(this);
            }

            return(Clone(clone =>
            {
                clone.SetTrigger(newTrigger);
            }));
        }
Beispiel #8
0
 private void SetTrigger(RuleTrigger newTrigger)
 {
     trigger = newTrigger;
     trigger.Freeze();
 }
Beispiel #9
0
 public bool DeepEquals(RuleTrigger action)
 {
     return(this.WithDeepEqual(action).IgnoreProperty <Freezable>(x => x.IsFrozen).Compare());
 }
Beispiel #10
0
 public bool DeepEquals(RuleTrigger action)
 {
     return(SimpleEquals.IsEquals(this, action));
 }