GetHashCode() public method

Returns the hash code for this object.
public GetHashCode ( ) : int
return int
示例#1
0
        public void Test_HashCodeNotEquals()
        {
            //---------------Set up test pack-------------------
            UIGridColumn gridColumn = new UIGridColumn("pp", "pp", "", "", false, 0, PropAlignment.centre, null);
            UIGridColumn otherColumn = new UIGridColumn("pp", "qq", "", "", false, 0, PropAlignment.centre, null);

            //---------------Assert preconditions----------------
            Assert.IsFalse(gridColumn.Equals(otherColumn));
            //---------------Execute Test ----------------------
            //---------------Test Result -----------------------
            Assert.AreNotEqual(gridColumn.GetHashCode(), otherColumn.GetHashCode());
        }
示例#2
0
        public void Test_HashCodeEquals()
        {
            //---------------Set up test pack-------------------
            UIGridColumn gridColumn = new UIGridColumn("pp", "pp", "", "", false, 0, PropAlignment.centre, null);
            IUIGridColumn clonedGridColumn = gridColumn.Clone();

            //---------------Assert preconditions----------------
            Assert.IsTrue(gridColumn.Equals(clonedGridColumn));
            //---------------Execute Test ----------------------
            //---------------Test Result -----------------------
            Assert.AreEqual(gridColumn.GetHashCode(), clonedGridColumn.GetHashCode());
        }