public When_StringValueIsNull() { this.value = DBNull.Value; this.reader = new Mock <IDataReader>(); this.reader.SetupGet(x => x.FieldCount).Returns(1).Verifiable(); this.reader.Setup(x => x.GetName(0)).Returns(nameof(TestClass.Property)).Verifiable(); this.reader.Setup(x => x[0]).Returns(this.value).Verifiable(); this.instance = DataReaderConvert.Deserialize <TestClass>(this.reader.Object); }
public When_GuidPropertyMapsExactly() { this.value = Guid.NewGuid(); this.reader = new Mock <IDataReader>(); this.reader.SetupGet(x => x.FieldCount).Returns(1).Verifiable(); this.reader.Setup(x => x.GetName(0)).Returns(nameof(TestClass.Property)).Verifiable(); this.reader.Setup(x => x[0]).Returns(this.value).Verifiable(); this.instance = DataReaderConvert.Deserialize <TestClass>(this.reader.Object); }
public When_StringPropertyMapsExactly() { this.value = Any.StringValue(Any.Int32Value(50, 500)); this.reader = new Mock <IDataReader>(); this.reader.SetupGet(x => x.FieldCount).Returns(1).Verifiable(); this.reader.Setup(x => x.GetName(0)).Returns(nameof(TestClass.Property)).Verifiable(); this.reader.Setup(x => x[0]).Returns(this.value).Verifiable(); this.instance = DataReaderConvert.Deserialize <TestClass>(this.reader.Object); }
public When_Int16PropertyMappingFromInt32() { this.value = Any.Int32Value(); this.reader = new Mock <IDataReader>(); this.reader.SetupGet(x => x.FieldCount).Returns(1).Verifiable(); this.reader.Setup(x => x.GetName(0)).Returns(nameof(TestClass.Property)).Verifiable(); this.reader.Setup(x => x[0]).Returns(this.value).Verifiable(); try { this.instance = DataReaderConvert.Deserialize <TestClass>(this.reader.Object); } catch (Exception e) { this.exception = e; } }