public void Should_Correctly_Map_String() { var sut = BuildAndConfigureFor <PrimitiveNullableDto <string> >(); string expectedValue = "ShouldBeThis"; using (var reader = PrimitiveNullableDto <string> .BuildReader(expectedValue)) { reader.Read(); var actual = sut.Map <PrimitiveNullableDto <string> >(reader); Assert.AreEqual(expectedValue, actual.PropertyToTest); } }
public void Should_Correctly_Map_Null_For_Nullable_Property() { var sut = BuildAndConfigureFor <PrimitiveNullableDto <string> >(); string expectedValue = null; using (var reader = PrimitiveNullableDto <string> .BuildReader(expectedValue)) { reader.Read(); var dtoWithNullableProperty = sut.Map <PrimitiveNullableDto <string> >(reader); Assert.AreEqual(expectedValue, dtoWithNullableProperty.PropertyToTest); } }
public void Should_Correctly_Map_Multiple_Rows() { var sut = BuildAndConfigureFor <PrimitiveNullableDto <string> >(); const string expectedValue = "ShouldBeThisAgain"; int expectedNumberOfMappedEntities = 5; using (var reader = PrimitiveNullableDto <string> .BuildReader(expectedValue, 5)) { var actual = sut.MapAll <PrimitiveNullableDto <string> >(reader).ToList(); Assert.AreEqual(expectedNumberOfMappedEntities, actual.Count); Assert.IsTrue(actual.All(x => x.PropertyToTest == expectedValue)); } }