예제 #1
0
 private void AssertFirstModel(SqlMapperTestModel model)
 {
     Assert.AreEqual(0, model.id);
     Assert.AreEqual(true, model.myBit.Value);
     Assert.AreEqual(0, model.myBigInt);
     Assert.AreEqual(0, model.myTinyInt);
     Assert.AreEqual(0, model.mySmallInt);
     Assert.AreEqual(null, model.myNullableInt);
     Assert.AreEqual(0, model.myFloat);
     Assert.AreEqual("0", model.myNvarchar);
 }
예제 #2
0
        /// <summary>
        /// Map a record to a SqlMapperTestModel, in the same way as the compiled expression in SqlMapper
        /// </summary>
        private static SqlMapperTestModel MapModelHardCoded(IDataRecord record)
        {
            var m = new SqlMapperTestModel();

            m.id            = GetField <int>(record, "id");
            m.otherId       = GetField <Guid>(record, "otherId");
            m.myBit         = GetField <bool>(record, "myBit");
            m.myBigInt      = GetField <long>(record, "myBigInt");
            m.myTinyInt     = GetField <byte>(record, "myTinyInt");
            m.mySmallInt    = GetField <short>(record, "mySmallInt");
            m.myNullableInt = GetField <int?>(record, "myNullableInt");
            m.myFloat       = GetField <float>(record, "myFloat");
            m.myNvarchar    = GetField <string>(record, "myNvarchar");
            m.myDateTime    = GetField <DateTime>(record, "myDateTime");
            return(m);
        }