Ejemplo n.º 1
0
        public Rule(RuleTrigger trigger, RuleAction action)
        {
            Guard.NotNull(trigger, nameof(trigger));
            Guard.NotNull(action, nameof(action));

            this.trigger = trigger;
            this.action  = action;
        }
Ejemplo n.º 2
0
        public Rule(RuleTrigger trigger, RuleAction action)
        {
            Guard.NotNull(trigger);
            Guard.NotNull(action);

            SetTrigger(trigger);
            SetAction(action);
        }
Ejemplo n.º 3
0
        public Rule(RuleTrigger trigger, RuleAction action)
        {
            Guard.NotNull(trigger);
            Guard.NotNull(action);

            Action = action;

            Trigger = trigger;
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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;
            }));
        }
Ejemplo n.º 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);
            }));
        }
Ejemplo n.º 8
0
 private void SetTrigger(RuleTrigger newTrigger)
 {
     trigger = newTrigger;
     trigger.Freeze();
 }
Ejemplo n.º 9
0
 public bool DeepEquals(RuleTrigger action)
 {
     return(this.WithDeepEqual(action).IgnoreProperty <Freezable>(x => x.IsFrozen).Compare());
 }
Ejemplo n.º 10
0
 public bool DeepEquals(RuleTrigger action)
 {
     return(SimpleEquals.IsEquals(this, action));
 }