Esempio n. 1
0
        public static void GetHashCode_GivenObjectsWithDifferentIncrement_AreNotEqual()
        {
            const int initialValue = 12345;
            const int increment    = 9876;
            var       a            = new AutoIncrement(initialValue, increment);
            var       b            = new AutoIncrement(initialValue, 6789);

            Assert.That(a.GetHashCode(), Is.Not.EqualTo(b.GetHashCode()));
        }
Esempio n. 2
0
        public static void GetHashCode_GivenObjectsWithEqualInputs_AreEqual()
        {
            const int initialValue = 12345;
            const int increment    = 9876;
            var       a            = new AutoIncrement(initialValue, increment);
            var       b            = new AutoIncrement(initialValue, increment);

            Assert.That(a.GetHashCode(), Is.EqualTo(b.GetHashCode()));
        }
Esempio n. 3
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = base.GetHashCode();
         result = (result * 397) ^ (Type != null ? Type.GetHashCode() : 0);
         result = (result * 397) ^ AutoIncrement.GetHashCode();
         result = (result * 397) ^ Seed;
         result = (result * 397) ^ Increment;
         result = (result * 397) ^ Nullable.GetHashCode();
         result = (result * 397) ^ Size.GetHashCode();
         result = (result * 397) ^ DecimalScale;
         result = (result * 397) ^ DecimalPrecision;
         result = (result * 397) ^ (DefaultValue != null ? DefaultValue.GetHashCode() : 0);
         return(result);
     }
 }
        public override int GetHashCode()
        {
            int hash = 1;

            if (AutoIncrement != 0L)
            {
                hash ^= AutoIncrement.GetHashCode();
            }
            if (Branch.Length != 0)
            {
                hash ^= Branch.GetHashCode();
            }
            if (Revision.Length != 0)
            {
                hash ^= Revision.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }