public void Should_Correctly_Map_All_Properties() { using (var reader = RichDtoData.BuildReader()) { reader.Read(); var actual = _sut.Map <RichDto>(reader); Assert.IsNotNull(actual.Data); Assert.AreEqual(RichDtoData.StrText, actual.Data.StrText); Assert.AreEqual(RichDtoData.IntCount, actual.Data.Count); Assert.IsNotNull(actual.Data.CustomerData); Assert.AreEqual(RichDtoData.StrName, actual.Data.CustomerData.Name); Assert.AreEqual(RichDtoData.IntAge, actual.Data.CustomerData.Age); Assert.AreEqual(RichDtoData.ListOrders.Split(',').Length, actual.Data.CustomerData.Orders.Count); Assert.IsNotNull(actual.Data.CustomerData.Address); Assert.AreEqual(RichDtoData.StrCity, actual.Data.CustomerData.Address.City); Assert.AreEqual(RichDtoData.StrZip, actual.Data.CustomerData.Address.ZIP); Assert.IsNotNull(actual.Data.AdditionalData); Assert.AreEqual(RichDtoData.DatLastLogin, actual.Data.AdditionalData.LastLogin); Assert.AreEqual(RichDtoData.BoolConsent, actual.Data.AdditionalData.Consent); Assert.IsNotNull(actual.Error); Assert.AreEqual(RichDtoData.StrErrorCode, actual.Error.Code); Assert.AreEqual(RichDtoData.StrErrorCategory, actual.Error.Category); } }
public void Should_Correctly_Cache_Mapping_Function_For_Nested_Type() { using (var reader = RichDtoData.BuildReader()) { reader.Read(); var actual = _sut.Map <Error>(reader); Assert.IsNotNull(actual); Assert.AreEqual(RichDtoData.StrErrorCode, actual.Code); Assert.AreEqual(RichDtoData.StrErrorCategory, actual.Category); } }
public void Should_Correctly_Map_Nulls_To_Nullable_Fields() { using (var reader = RichDtoData.BuildReader(numberOfRows: 1, generateNulls: true)) { reader.Read(); var actual = _sut.Map <RichDto>(reader); Assert.IsNotNull(actual); Assert.AreEqual(null, actual.Data.StrText); Assert.IsNotNull(actual.Error); Assert.AreEqual(null, actual.Error.Code); Assert.AreEqual(null, actual.Error.Category); } }