public void NoConverter() { var mapping = new SimpleColumnMapping<User>(x => x.FirstName, "first_name", null); var dataRecord = Substitute.For<IDataRecord>(); dataRecord["first_name"].Returns("arne"); var actual = new User(); mapping.SetValue(dataRecord, actual); Assert.Equal("arne", actual.FirstName); }
public void NoConverter() { var mapping = new SimpleColumnMapping <User>(x => x.FirstName, "first_name", null); var dataRecord = Substitute.For <IDataRecord>(); dataRecord["first_name"].Returns("arne"); var actual = new User(); mapping.SetValue(dataRecord, actual); Assert.Equal("arne", actual.FirstName); }
public void CallingConverter() { var converter = Substitute.For<IColumnConverter>(); converter.Convert("arne").Returns("Arne"); var mapping = new SimpleColumnMapping<User>(x => x.FirstName, "first_name", converter); var dataRecord = Substitute.For<IDataRecord>(); dataRecord["first_name"].Returns("arne"); var actual = new User(); mapping.SetValue(dataRecord, actual); Assert.Equal("Arne", actual.FirstName); converter.Received().Convert("arne"); }
public void CallingConverter() { var converter = Substitute.For <IColumnConverter>(); converter.Convert("arne").Returns("Arne"); var mapping = new SimpleColumnMapping <User>(x => x.FirstName, "first_name", converter); var dataRecord = Substitute.For <IDataRecord>(); dataRecord["first_name"].Returns("arne"); var actual = new User(); mapping.SetValue(dataRecord, actual); Assert.Equal("Arne", actual.FirstName); converter.Received().Convert("arne"); }