Equals() public méthode

public Equals ( object obj ) : bool
obj object
Résultat bool
Exemple #1
0
        public override bool Equals(object obj)
        {
            if (obj is Transition <TStateModel> )
            {
                var other = obj as Transition <TStateModel>;
                // if both using no (default) guard, only compare states and trigger
                if (other.Guard == trueGuard && Guard == trueGuard)
                {
                    return(Trigger.Equals(other.Trigger) &&
                           (Source == null && other.Source == null || Source.Equals(other.Source)) &&
                           Target.Equals(other.Target));
                }
                // if one or more using custom guard, compare guard too
                return(Trigger.Equals(other.Trigger) &&
                       (Source == null && other.Source == null || Source.Equals(other.Source)) &&
                       Target.Equals(other.Target) &&
                       Guard.Equals(other.Guard));
            }

            return(base.Equals(obj));
        }
Exemple #2
0
 public void Trigger_Equals_TwoInstances_SameName_ReturnTrue()
 {
     var trigger1 = new Trigger("trigger");
     var trigger2 = new Trigger("trigger");
     Assert.True(trigger1.Equals(trigger2));
 }