public void MappingValue() { var mapper = new AnimalAnimalModelMapper(); var source = new Animal { Id = 1, Name = "Test" }; var expected = new AnimalModel { Id = 1, Name = "Test" }; var candidate = mapper.Map(source); this.Check(expected, candidate); }
public void MapCreatesDestination() { var locator = new Mock<IServiceLocator>(MockBehavior.Strict); var engine = new SimpleMappingEngine(locator.Object); engine.RegisterMap(new AnimalAnimalModelMapper()); var source = new Animal { Id = 1, Name = "Test" }; var expected = new AnimalModel { Id = 1, Name = "Test" }; var candidate = engine.Map<Animal, AnimalModel>(source); this.Check(expected, candidate); }
public override void Map(Animal source, System.Xml.Linq.XElement destination) { destination.Add( this.XElement("Id2", source.Id), this.XElement("Name2", source.Name)); }
public override void Map(XPathProcessor source, Animal destination) { destination.Id = source.ToInt("Id2"); destination.Name = source.ToString("Name2"); }