public void RegisterOneWayMapping_SimpleObjects() { _mapper.InitializeMap(); var resourceObj = _builder.Build <ResourceClassSimple>(); var domainObj = new DomainClassSimple(); _mapper.Map(resourceObj, domainObj, null); Assert.AreEqual(resourceObj.ExampleProperty, domainObj.ExampleProperty); Assert.IsNull(domainObj.RandomProperty); }
private static void AssertAreEqual(ResourceClassSimple resource, DomainClassSimple domain) { if (resource == null) { Assert.IsNull(domain); } else { Assert.IsNotNull(domain); Assert.AreEqual(resource.ExampleProperty, domain.ExampleProperty); } }
public void RegisterOneWayMap_Overlay_ConsumesMembers() { _mapper.ConvertUsing <string, int>(Convert.ToInt32); _mapper.ConvertUsing <int, string>(Convert.ToString); _mapper.RegisterOneWayMapping <ResourceClassNested, DomainClassSimple>(mapping => { mapping.Ignore(to => to.RandomProperty); mapping.Overlay(to => to, from => from.Child); }); _mapper.InitializeMap(); var resourceObj = _builder.Build <ResourceClassNested>(); var domainObj = new DomainClassSimple(); domainObj = _mapper.Map(resourceObj, domainObj, null); Assert.AreEqual(resourceObj.Child.ExampleProperty, domainObj.ExampleProperty); }