public static void HashCode_Combine()
        {
            var hcs = new int[]
            {
                HashCodeBuilder.Combine(1),
                HashCodeBuilder.Combine(1, 2),
                HashCodeBuilder.Combine(1, 2, 3),
                HashCodeBuilder.Combine(1, 2, 3, 4),
                HashCodeBuilder.Combine(1, 2, 3, 4, 5),
                HashCodeBuilder.Combine(1, 2, 3, 4, 5, 6),
                HashCodeBuilder.Combine(1, 2, 3, 4, 5, 6, 7),
                HashCodeBuilder.Combine(1, 2, 3, 4, 5, 6, 7, 8),

                HashCodeBuilder.Combine(2),
                HashCodeBuilder.Combine(2, 3),
                HashCodeBuilder.Combine(2, 3, 4),
                HashCodeBuilder.Combine(2, 3, 4, 5),
                HashCodeBuilder.Combine(2, 3, 4, 5, 6),
                HashCodeBuilder.Combine(2, 3, 4, 5, 6, 7),
                HashCodeBuilder.Combine(2, 3, 4, 5, 6, 7, 8),
                HashCodeBuilder.Combine(2, 3, 4, 5, 6, 7, 8, 9),
            };

            for (int i = 0; i < hcs.Length; i++)
            {
                for (int j = 0; j < hcs.Length; j++)
                {
                    if (i == j)
                    {
                        continue;
                    }
                    Assert.AreNotEqual(hcs[i], hcs[j]);
                }
            }
        }
 public override int GetHashCode()
 {
     // Currently the hash code is simply the hash of the authority and first scope as this is what is used to determine equality.
     // This assumes that Authority Scopes are always non-null and Scopes has a length of one.
     // This is guaranteed by the way the AuthenticationChallenge cache is constructed.
     return(HashCodeBuilder.Combine(Authority, Scopes[0]));
 }
        public static void HashCode_Combine_Add_1()
        {
            var hc = new HashCodeBuilder();

            hc.Add(1);
            Assert.AreEqual(hc.ToHashCode(), HashCodeBuilder.Combine(1));
        }
Exemple #4
0
 public override int GetHashCode()
 {
     return(HashCodeBuilder.Combine(
                Name?.ToLower(CultureInfo.InvariantCulture),
                Publisher?.ToLower(CultureInfo.InvariantCulture),
                Product?.ToLower(CultureInfo.InvariantCulture),
                PromotionCode?.ToLower(CultureInfo.InvariantCulture),
                Version?.ToLower(CultureInfo.InvariantCulture)));
 }
Exemple #5
0
 public override int GetHashCode()
 {
     return(HashCodeBuilder.Combine(
                Name?.ToLower(CultureInfo.InvariantCulture),
                Family?.ToLower(CultureInfo.InvariantCulture),
                Size?.ToLower(CultureInfo.InvariantCulture),
                Tier?.ToString().ToLower(CultureInfo.InvariantCulture),
                Capacity));
 }
        public static void HashCode_Combine_Add_5()
        {
            var hc = new HashCodeBuilder();

            hc.Add(1);
            hc.Add(2);
            hc.Add(3);
            hc.Add(4);
            hc.Add(5);
            Assert.AreEqual(hc.ToHashCode(), HashCodeBuilder.Combine(1, 2, 3, 4, 5));
        }
            public int GetHashCode(JsonWebKey obj)
            {
                if (obj is null)
                {
                    return(0);
                }

                if (obj.KeyType == KeyType.Oct)
                {
                    return(HashCodeBuilder.Combine(obj.KeyType, obj.K));
                }

                if (obj.KeyType == KeyType.Rsa)
                {
                    return(HashCodeBuilder.Combine(obj.KeyType, obj.N));
                }

                if (obj.KeyType == KeyType.Ec)
                {
                    return(HashCodeBuilder.Combine(obj.KeyType, obj.X));
                }

                throw new NotImplementedException();
            }
 public override int GetHashCode()
 {
     return(HashCodeBuilder.Combine(Key, Value));
 }
Exemple #9
0
 public override int GetHashCode() => HashCodeBuilder.Combine(Offset, Count);
Exemple #10
0
 public override int GetHashCode()
 {
     return(HashCodeBuilder.Combine(TenantId, PrincipalId));
 }
 public override int GetHashCode()
 {
     return(HashCodeBuilder.Combine(SystemAssignedIdentity, UserAssignedIdentities));
 }
Exemple #12
0
 /// <inheritdoc />
 public override int GetHashCode() => HashCodeBuilder.Combine(Longitude, Latitude, Altitude);
 /// <inheritdoc />
 public override int GetHashCode()
 {
     return(HashCodeBuilder.Combine(West, South, East, North, MinAltitude, MaxAltitude));
 }
Exemple #14
0
 public override int GetHashCode() => HashCodeBuilder.Combine(Offset, Length);