public void DelegateMapper_Works() { var foo = new Foo() { A = 5, B = 10 }; var mapper = new DelegateMapper <Foo, Bar>((source, destination) => { destination.A = source.A; destination.B = source.B; destination.C = 15; }); var @new = mapper.Map(foo); Assert.AreEqual(@new.A, 5); Assert.AreEqual(@new.B, 10); Assert.AreEqual(@new.C, 15); Assert.AreEqual(@new.E, null); var existing = new Bar(); mapper.Map(foo, existing); Assert.AreEqual(existing.A, 5); Assert.AreEqual(existing.B, 10); Assert.AreEqual(existing.C, 15); Assert.AreEqual(existing.E, null); }
public void Converts() { var mapper = new DelegateMapper <User>(ConvertRecord); var record = Substitute.For <IDataRecord>(); var actual = mapper.Map(record); Assert.NotNull(actual); }
public void Converts() { var mapper = new DelegateMapper<User>(ConvertRecord); var record = Substitute.For<IDataRecord>(); var actual = mapper.Map(record); Assert.NotNull(actual); }