Exemplo n.º 1
0
        public void TestNullableViaResultClass2()
        {
            NullableClass clazz = new NullableClass();
            clazz.TestBool = true;
            clazz.TestByte = 155;
            clazz.TestChar = 'a';
            DateTime? date = new DateTime?(DateTime.Now);
            clazz.TestDateTime = date;
            clazz.TestDecimal = 99.53M;
            clazz.TestDouble = 99.5125;
            Guid? guid = new Guid?(Guid.NewGuid());
            clazz.TestGuid = guid;
            clazz.TestInt16 = 45;
            clazz.TestInt32 = 99;
            clazz.TestInt64 = 1234567890123456789;
            clazz.TestSingle = 4578.46445454112f;

            dataMapper.Insert("InsertNullable", clazz);
            clazz = null;
            clazz = dataMapper.QueryForObject<NullableClass>("GetClassNullable", 1);

            Assert.IsNotNull(clazz);
            Assert.AreEqual(1, clazz.Id);
            Assert.IsTrue(clazz.TestBool.Value);
            Assert.AreEqual(155, clazz.TestByte);
            Assert.AreEqual('a', clazz.TestChar);
            Assert.AreEqual(date.Value.ToString(), clazz.TestDateTime.Value.ToString());
            Assert.AreEqual(99.53M, clazz.TestDecimal);
            Assert.AreEqual(99.5125, clazz.TestDouble);
            Assert.AreEqual(guid, clazz.TestGuid);
            Assert.AreEqual(45, clazz.TestInt16);
            Assert.AreEqual(99, clazz.TestInt32);
            Assert.AreEqual(1234567890123456789, clazz.TestInt64);
            Assert.AreEqual(4578.46445454112f, clazz.TestSingle);
        } 
Exemplo n.º 2
0
        public void TestNullableViaResultClass()
        {
            NullableClass clazz = new NullableClass();

            dataMapper.Insert("InsertNullable", clazz);
            clazz = null;
            clazz = dataMapper.QueryForObject<NullableClass>("GetClassNullable", 1);

            Assert.IsNotNull(clazz);
            Assert.AreEqual(1, clazz.Id);
            Assert.IsNull(clazz.TestBool);
            Assert.IsNull(clazz.TestByte);
            Assert.IsNull(clazz.TestChar);
            Assert.IsNull(clazz.TestDateTime);
            Assert.IsNull(clazz.TestDecimal);
            Assert.IsNull(clazz.TestDouble);
            Assert.IsNull(clazz.TestGuid);
            Assert.IsNull(clazz.TestInt16);
            Assert.IsNull(clazz.TestInt32);
            Assert.IsNull(clazz.TestInt64);
            Assert.IsNull(clazz.TestSingle);
        }
Exemplo n.º 3
0
        public void TestNotNullableTimeSpan()
        {
            NullableClass clazz = new NullableClass();
            TimeSpan? span = new TimeSpan?(new TimeSpan(1, 2, 3, 4, 5));
            clazz.TestTimeSpan = span;

            dataMapper.Insert("InsertNullable", clazz);
            clazz = null;
            clazz = dataMapper.QueryForObject<NullableClass>("GetNullable", 1);

            Assert.IsNotNull(clazz);
            Assert.AreEqual(1, clazz.Id);
            Assert.AreEqual(span.Value.ToString(), clazz.TestTimeSpan.Value.ToString());
        }
Exemplo n.º 4
0
        public void TestNullableTimeSpan()
        {
            NullableClass clazz = new NullableClass();
            dataMapper.Insert("InsertNullable", clazz);
            clazz = null;
            clazz = dataMapper.QueryForObject<NullableClass>("GetNullable", 1);

            Assert.IsNotNull(clazz);
            Assert.AreEqual(1, clazz.Id);
            Assert.IsNull(clazz.TestTimeSpan);
        }
Exemplo n.º 5
0
        public void TestNotNullableSingle()
        {
            NullableClass clazz = new NullableClass();
            clazz.TestSingle = 4578.46445454112f;

            dataMapper.Insert("InsertNullable", clazz);
            clazz = null;
            clazz = dataMapper.QueryForObject<NullableClass>("GetNullable", 1);

            Assert.IsNotNull(clazz);
            Assert.AreEqual(1, clazz.Id);
            Assert.AreEqual(4578.46445454112f, clazz.TestSingle);
        }
Exemplo n.º 6
0
        public void TestNotNullableInt64()
        {
            NullableClass clazz = new NullableClass();
            clazz.TestInt64 = 1234567890123456789;

            dataMapper.Insert("InsertNullable", clazz);
            clazz = null;
            clazz = dataMapper.QueryForObject<NullableClass>("GetNullable", 1);

            Assert.IsNotNull(clazz);
            Assert.AreEqual(1, clazz.Id);
            Assert.AreEqual(1234567890123456789, clazz.TestInt64);
        }
Exemplo n.º 7
0
        public void TestNotNullableInt16()
        {
            NullableClass clazz = new NullableClass();
            clazz.TestInt16 = 45;

            dataMapper.Insert("InsertNullable", clazz);
            clazz = null;
            clazz = dataMapper.QueryForObject<NullableClass>("GetNullable", 1);

            Assert.IsNotNull(clazz);
            Assert.AreEqual(1, clazz.Id);
            Assert.AreEqual(45, clazz.TestInt16);
        }
Exemplo n.º 8
0
        public void TestNotNullableGuid()
        {
            NullableClass clazz = new NullableClass();
            Guid? guid = new Guid?(Guid.NewGuid());
            clazz.TestGuid = guid;

            dataMapper.Insert("InsertNullable", clazz);
            clazz = null;
            clazz = dataMapper.QueryForObject<NullableClass>("GetNullable", 1);

            Assert.IsNotNull(clazz);
            Assert.AreEqual(1, clazz.Id);
            Assert.AreEqual(guid, clazz.TestGuid);
        }
Exemplo n.º 9
0
        public void TestNotNullableDouble()
        {
            NullableClass clazz = new NullableClass();
            clazz.TestDouble = 99.5125;

            dataMapper.Insert("InsertNullable", clazz);
            clazz = null;
            clazz = dataMapper.QueryForObject<NullableClass>("GetNullable", 1);

            Assert.IsNotNull(clazz);
            Assert.AreEqual(1, clazz.Id);
            Assert.AreEqual(99.5125, clazz.TestDouble);
        }
Exemplo n.º 10
0
        public void TestNotNullableDateTime()
        {
            NullableClass clazz = new NullableClass();
            DateTime? date = new DateTime?(DateTime.Now);
            clazz.TestDateTime = date;

            dataMapper.Insert("InsertNullable", clazz);
            clazz = null;
            clazz = dataMapper.QueryForObject<NullableClass>("GetNullable", 1);

            Assert.IsNotNull(clazz);
            Assert.AreEqual(1, clazz.Id);
            Assert.AreEqual(date.Value.ToString(), clazz.TestDateTime.Value.ToString());
        }
Exemplo n.º 11
0
        public void TestNotNullableChar()
        {
            NullableClass clazz = new NullableClass();
            clazz.TestChar = 'a';

            dataMapper.Insert("InsertNullable", clazz);
            clazz = null;
            clazz = dataMapper.QueryForObject<NullableClass>("GetNullable", 1);

            Assert.IsNotNull(clazz);
            Assert.AreEqual(1, clazz.Id);
            Assert.AreEqual('a', clazz.TestChar);
        } 
Exemplo n.º 12
0
        public void TestNotNullableBool()
        {
            NullableClass clazz = new NullableClass();
            clazz.TestBool = false;

            dataMapper.Insert("InsertNullable", clazz);
            clazz = null;
            clazz = dataMapper.QueryForObject<NullableClass>("GetNullable", 1);

            Assert.IsNotNull(clazz);
            Assert.AreEqual(1, clazz.Id);
            Assert.AreEqual(false, clazz.TestBool);
        }