示例#1
0
        public void CacheKeys_should_not_be_equal_due_to_order()
        {
            CacheKey key1 = new CacheKey(new Object[] { 1, "hello", null });
            CacheKey key2 = new CacheKey(new Object[] { 1, null, "hello" });

            Assert.That(key1, Is.Not.EqualTo(key2));
            Assert.That(key2, Is.Not.EqualTo(key1));
            Assert.That(key1.GetHashCode(), Is.Not.EqualTo(key2.GetHashCode()));
            Assert.That(key1.ToString(), Is.Not.EqualTo(key2.ToString()));
        }
示例#2
0
        public void CacheKeys_should_not_be_equal()
        {
            DateTime date = DateTime.Now;
            CacheKey key1 = new CacheKey(new Object[] { 1, "hello", null, new DateTime(date.Ticks) });
            CacheKey key2 = new CacheKey(new Object[] { 1, "hello", null, new DateTime(date.Ticks+5) });

            Assert.That(key1, Is.Not.EqualTo(key2));
            Assert.That(key2, Is.Not.EqualTo(key1));
            Assert.That(key1.GetHashCode(), Is.Not.EqualTo(key2.GetHashCode()));
            Assert.That(key1.ToString(), Is.Not.EqualTo(key2.ToString()));
        }