public void Mapper_MapNestedReferenceTypes_Success() { var config = new HappyConfig(cfg => { cfg.CreateMap <NestedSrc, NestedDest>(); }); var mapper = config.CompileMapper(); var src = new NestedSrc(); var dest = new NestedDest(); mapper.Map(src, dest); var result = ObjectComparer.AreEqual(src, dest); result.Errors.ForEach(Console.WriteLine); Assert.IsTrue(result.Success); }
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); }