コード例 #1
0
ファイル: CacheKeyTest.cs プロジェクト: techvenky/mybatisnet
        public void CacheKeys_should_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) });

            Assert.That(key1, Is.EqualTo(key2));
            Assert.That(key2, Is.EqualTo(key1));
            Assert.That(key2.GetHashCode(), Is.EqualTo(key1.GetHashCode()));
            Assert.That(key1.GetHashCode(), Is.EqualTo(key2.GetHashCode()));
            Assert.That(key1.ToString(), Is.EqualTo(key2.ToString()));
        }
コード例 #2
0
ファイル: CacheKeyTest.cs プロジェクト: techvenky/mybatisnet
        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()));
        }