Example #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());
        }
Example #2
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());
        }
Example #3
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());
        }
Example #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());
        }
        //ExStart:ReadHeaderFooterInfo
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);

            // Create project and project info instances
            Project  project = new Project(dataDir + "Blank2010.mpp");
            PageInfo info    = project.DefaultView.PageInfo;

            Console.WriteLine("Page data cannot be null : {0} ", !info.Equals(null));

            AssertHeaderFooterCorrect(info);
            AssertPageSettingsCorrect(info);
            AssertPageViewSettingsCorrect(info);
            AssertMarginsCorrect(info);
            AssertLegendCorrect(info);
        }
Example #6
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());
        }