Esempio n. 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var result = intValue;
         result = (result * 397) ^ (stringValue != null ? stringValue.GetHashCode() : 0);
         result = (result * 397) ^ structValue.GetHashCode();
         return(result);
     }
 }
        public void GetHashCode_should_return_value_for_struct()
        {
            var instance = new SimpleStruct();

            instance.X = 1;
            instance.Y = 2;

            var result = instance.GetHashCode();

            Assert.NotEqual(0, result);
        }