public void Map_WhenMapBiggerTypePropertyToSmallerOne_ShouldNotMapProperty() { Mapper mapper = new Mapper(); BigElephant elephant1 = new BigElephant() { Weight = 100, Age = 100, Name = "BigElephant" }; SmallElephant elephant2 = mapper.Map <BigElephant, SmallElephant>(elephant1); Assert.IsTrue(elephant2.Weight == 0); Assert.IsTrue(elephant2.Age == 0); Assert.IsTrue(elephant2.Name == "BigElephant"); }
public void Map_WhenSuitablePropertiesTypes_ShouldMapAllProperties() { Mapper mapper = new Mapper(); SmallElephant elephant1 = new SmallElephant() { Weight = 1, Age = 10, Name = "SmallElephant" }; BigElephant elephant2 = mapper.Map <SmallElephant, BigElephant>(elephant1); Assert.IsTrue(elephant2.Weight == 1); Assert.IsTrue(elephant2.Age == 10); Assert.IsTrue(elephant2.Name == "SmallElephant"); Assert.IsNull(elephant2.PassportId); }