Beispiel #1
0
        public void GetHashCode3()
        {
            DateComparer comparer = DateComparer.Default as DateComparer;

            ExceptionAssert.Throws <ArgumentNullException>(() => ((DateComparer)DateComparer.Default).GetHashCode(((string)null)));
            Assert.AreEqual(String.Empty.GetHashCode(), comparer.GetHashCode(String.Empty));

            string c = "abc";

            Assert.AreEqual(c.GetHashCode(), comparer.GetHashCode(c));
        }
Beispiel #2
0
        public void GetHashCode4()
        {
            DateComparer comparer = DateComparer.DefaultInvariant as DateComparer;
            string       x        = "10/31/2006";

            Assert.AreEqual(DateTime.Parse(x).GetHashCode(), comparer.GetHashCode(x));

            object y = "10/31/2006";

            Assert.AreEqual(DateTime.Parse(y.ToString()).GetHashCode(), comparer.GetHashCode(y));

            DateTime z = DateTime.Today;

            Assert.AreEqual(z.GetHashCode(), comparer.GetHashCode(z));

            object a = DateTime.Today;

            Assert.AreEqual(a.GetHashCode(), comparer.GetHashCode(a));

            object b = 3;

            Assert.AreEqual(b.GetHashCode(), comparer.GetHashCode(b));

            object c = "abc";

            Assert.AreEqual(c.GetHashCode(), comparer.GetHashCode(c));
        }
Beispiel #3
0
        public void GetHashCode1()
        {
            DateComparer comparer = DateComparer.Default as DateComparer;
            string       x        = "10/31/2006";

            Assert.AreEqual(DateTime.Parse(x).GetHashCode(), comparer.GetHashCode(x));

            object y = "10/31/2006";

            Assert.AreEqual(DateTime.Parse(y.ToString()).GetHashCode(), comparer.GetHashCode(y));

            DateTime z = DateTime.Today;

            Assert.AreEqual(z.GetHashCode(), comparer.GetHashCode(z));

            object a = DateTime.Today;

            Assert.AreEqual(a.GetHashCode(), comparer.GetHashCode(a));

            object b = 3;

            Assert.AreEqual(b.GetHashCode(), comparer.GetHashCode(b));

            object c = "abc";

            Assert.AreEqual(c.GetHashCode(), comparer.GetHashCode(c));

            ExceptionAssert.Throws <ArgumentNullException>(() => ((DateComparer)DateComparer.Default).GetHashCode(((object)null)));
        }