public override bool Equals()

in src/Microsoft.Azure.NotificationHubs/Messaging/AuthorizationRule.cs [247:282]


        public override bool Equals(Object obj)
        {
            if (!(this.GetType() == obj.GetType()))
            {
                return false;
            }

            AuthorizationRule comparand = (AuthorizationRule) obj;
            if (!string.Equals(this.IssuerName, comparand.IssuerName, StringComparison.OrdinalIgnoreCase) ||
                !string.Equals(this.ClaimType, comparand.ClaimType, StringComparison.OrdinalIgnoreCase) ||
                !string.Equals(this.ClaimValue, comparand.ClaimValue, StringComparison.OrdinalIgnoreCase))
            {
                return false;
            }

            if ((this.Rights != null && comparand.Rights == null) ||
                (this.Rights == null && comparand.Rights != null))
            {
                return false;
            }

            if (this.Rights != null && comparand.Rights != null)
            {
                HashSet<AccessRights> thisRights = new HashSet<AccessRights>(this.Rights);
                HashSet<AccessRights> comparandRights = new HashSet<AccessRights>(comparand.Rights);

                if (comparandRights.Count != thisRights.Count)
                {
                    return false;
                }

                return thisRights.All(comparandRights.Contains);
            }

            return true;
        }