コード例 #1
0
        public void EqualsReturnsTrueIfCompareContentCrc64ByValues()
        {
            var hash1 = new byte[] { 1, 2, 3 };
            var hash2 = new byte[] { 1, 2, 3 };

            var info1 = new PageInfo(
                new Core.Http.ETag("A"),
                new DateTimeOffset(2019, 9, 25, 1, 1, 1, TimeSpan.Zero),
                hash1,
                hash1,
                1,
                "key1");

            var info2 = new PageInfo(
                new Core.Http.ETag("A"),
                new DateTimeOffset(2019, 9, 25, 1, 1, 1, TimeSpan.Zero),
                hash1,
                hash2,
                1,
                "key1");

            Assert.True(info1.Equals(info2));
            Assert.True(info2.Equals(info1));

            Assert.AreEqual(info1.GetHashCode(), info2.GetHashCode());
        }
コード例 #2
0
        public void EqualsReturnsFalseIfCompareContentCrc64WithNull()
        {
            var hash = new byte[] { 1, 2, 3 };

            var info1 = new PageInfo(
                new Core.Http.ETag("A"),
                new DateTimeOffset(2019, 9, 25, 1, 1, 1, TimeSpan.Zero),
                hash,
                null,
                1,
                "key1");

            var info2 = new PageInfo(
                new Core.Http.ETag("A"),
                new DateTimeOffset(2019, 9, 25, 1, 1, 1, TimeSpan.Zero),
                hash,
                hash,
                1,
                "key1");

            Assert.True(!info1.Equals(info2));
            Assert.True(!info2.Equals(info1));

            Assert.AreNotEqual(info1.GetHashCode(), info2.GetHashCode());
        }
コード例 #3
0
        public void EqualsReturnFalseIfCompareDifferentValues()
        {
            var hash = new byte[] { 1, 2, 3 };

            var info1 = new PageInfo(
                new Core.Http.ETag("B"),
                new DateTimeOffset(2019, 9, 25, 1, 1, 1, TimeSpan.Zero),
                hash,
                hash,
                1,
                "key1");

            var info2 = new PageInfo(
                new Core.Http.ETag("A"),
                new DateTimeOffset(2019, 11, 25, 1, 1, 1, TimeSpan.Zero),
                hash,
                hash,
                2,
                "key2");

            Assert.True(!info1.Equals(info2));
            Assert.True(!info2.Equals(info1));

            Assert.AreNotEqual(info1.GetHashCode(), info2.GetHashCode());
        }
コード例 #4
0
        public void EqualsReturnsTrueForEqualValues()
        {
            var hash = new byte[] { 1, 2, 3 };

            var info1 = new PageInfo(
                new ETag("A"),
                new DateTimeOffset(2019, 9, 25, 1, 1, 1, TimeSpan.Zero),
                hash,
                hash,
                1,
                "key1");

            var info2 = new PageInfo(
                new ETag("A"),
                new DateTimeOffset(2019, 9, 25, 1, 1, 1, TimeSpan.Zero),
                hash,
                hash,
                1,
                "key1");

            Assert.True(info1.Equals(info2));
            Assert.True(info2.Equals(info1));

            Assert.AreEqual(info1.GetHashCode(), info2.GetHashCode());
        }
コード例 #5
0
        public void EqualsReturnsTrueForNullValues()
        {
            var info1 = new PageInfo(
                new Core.Http.ETag("A"),
                new DateTimeOffset(2019, 9, 25, 1, 1, 1, TimeSpan.Zero),
                null,
                null,
                1,
                null);

            var info2 = new PageInfo(
                new Core.Http.ETag("A"),
                new DateTimeOffset(2019, 9, 25, 1, 1, 1, TimeSpan.Zero),
                null,
                null,
                1,
                null);

            Assert.True(info1.Equals(info2));
            Assert.True(info2.Equals(info1));

            Assert.AreEqual(info1.GetHashCode(), info2.GetHashCode());
        }