Esempio n. 1
0
        public void Public_FullCopy_ReturnTrue()
        {
            //	#	Arrange.
            var source      = Dto.CreateRandomised(_pr);
            var destination = source.FullCopy();

            //	#	Act.
            var res = AreEqual.Public(source, destination);

            //	# Assert.
            Assert.IsTrue(res);
        }
Esempio n. 2
0
        public void Public_NotFullCopyOfPublic_ReturnFalse()
        {
            //	#	Arrange.
            var source = Dto.CreateRandomised(_pr);

            var destination = source.FullCopy()
                              .With(d => d.MyPublicInt = _pr.Int());

            Assert.AreNotEqual(source.MyPublicInt, destination.MyPublicInt, "Sobriety check that what should be randomised to differ really does differ.");

            //	#	Act.
            var res = AreEqual.Public(source, destination);

            //	# Assert.
            Assert.IsFalse(res);
        }
Esempio n. 3
0
        public void PublicDepth_InfiniteDepth_StopForNothing()
        {
            //  #   Arrange.
            var equal = Dto.CreatePair(
                _pr,
                CreateInfiniteEqualsList(Dto.Pair.Equal));
            var notEqual = Dto.CreatePair(
                _pr,
                CreateInfiniteEqualsList(Dto.Pair.Differs));

            //  #   Act.
            var res1 = AreEqual.Public(AreEqual.Depth.Infinite, equal.Item1, equal.Item2);
            var res2 = AreEqual.Public(AreEqual.Depth.Infinite, notEqual.Item1, notEqual.Item2);

            //  #   Assert.
            Assert.IsTrue(res1);
            Assert.IsFalse(res2);
        }
Esempio n. 4
0
        public void PublicDepth_SetDepth_OnlyCompareToThatDepth()
        {
            //  #   Arrange.
            var equal = Dto.CreatePair(
                _pr,
                new[] { Dto.Pair.Equal, Dto.Pair.Equal, Dto.Pair.Differs });
            var notEqual = Dto.CreatePair(
                _pr,
                new[] { Dto.Pair.Equal, Dto.Pair.Differs, Dto.Pair.Equal });

            //  #   Act.
            var res1 = AreEqual.Public((AreEqual.Depth) 2, equal.Item1, equal.Item2);
            var res2 = AreEqual.Public((AreEqual.Depth) 2, notEqual.Item1, notEqual.Item2);

            //  #   Assert.
            Assert.IsTrue(res1);
            Assert.IsFalse(res2);
        }
Esempio n. 5
0
        public void PublicDepth_NoDepth_OnlyCompareImmediateObject()
        {
            //  #   Arrange.
            var equal = Dto.CreatePair(
                _pr,
                new[] { Dto.Pair.Equal, Dto.Pair.Differs });
            var notEqual = Dto.CreatePair(
                _pr,
                new[] { Dto.Pair.Differs, Dto.Pair.Equal });

            //  #   Act.
            var res1 = AreEqual.Public(AreEqual.Depth.None, equal.Item1, equal.Item2);
            var res2 = AreEqual.Public(AreEqual.Depth.None, notEqual.Item1, notEqual.Item2);

            //  #   Assert.
            Assert.IsTrue(res1);
            Assert.IsFalse(res2);
        }