Exemple #1
0
        public void TestGetHashCode()
        {
            GregorianDate date          = new GregorianDate(2001, 1, 1, 6, 3, 14);
            GregorianDate sameDate      = new GregorianDate(2001, 1, 1, 6, 3, 14);
            GregorianDate differentTime = new GregorianDate(2001, 1, 1, 6, 5, 26);
            GregorianDate differentDay  = new GregorianDate(2001, 2, 3, 6, 3, 14);

            Assert.AreEqual(date.GetHashCode(), sameDate.GetHashCode());
            Assert.AreNotEqual(date.GetHashCode(), differentTime.GetHashCode());
            Assert.AreNotEqual(date.GetHashCode(), differentDay.GetHashCode());
        }
        public void TestGetHashCode()
        {
            GregorianDate date = new GregorianDate(2001, 1, 1, 6, 3, 14);
            GregorianDate sameDate = new GregorianDate(2001, 1, 1, 6, 3, 14);
            GregorianDate differentTime = new GregorianDate(2001, 1, 1, 6, 5, 26);
            GregorianDate differentDay = new GregorianDate(2001, 2, 3, 6, 3, 14);

            Assert.AreEqual(date.GetHashCode(), sameDate.GetHashCode());
            Assert.AreNotEqual(date.GetHashCode(), differentTime.GetHashCode());
            Assert.AreNotEqual(date.GetHashCode(), differentDay.GetHashCode());
        }