Example #1
0
        public static void AreEqualCollections <TSrc, TDest>(ICollection <TSrc> src, ICollection <TDest> dest)
        {
            for (int i = 0; i < src.Count; i++)
            {
                var result = ObjectComparer.AreEqual(src.ElementAt(i), dest.ElementAt(i));

                Assert.IsTrue(result.Success);
            }
        }
Example #2
0
        public void AreEqual_EqualSimpleObjects_ReturnsTrue()
        {
            Src  src  = new Src();
            Dest dest = new Dest();

            dest.Name     = src.Name;
            dest.Number   = src.Number;
            dest.Float    = src.Float;
            dest.DateTime = src.DateTime;

            var result = ObjectComparer.AreEqual(src, dest);

            result.Errors.ForEach(Console.WriteLine);

            Assert.IsTrue(result.Success);
            Assert.IsEmpty(result.Errors);
        }
Example #3
0
        public void AreEqual_NotEqualNestedObjects_ReturnsFalse()
        {
            var src  = new NestedSrc();
            var dest = new NestedDest();

            dest.Name             = src.Name;
            dest.Number           = src.Number;
            dest.Float            = src.Float;
            dest.DateTime         = src.DateTime;
            dest.Child.MyProperty = src.Child.MyProperty - 42;

            var result = ObjectComparer.AreEqual(src, dest);

            result.Errors.ForEach(Console.WriteLine);

            Assert.IsFalse(result.Success);
            Assert.IsNotEmpty(result.Errors);
        }