コード例 #1
0
        public void TestGetDateTime()
        {
            var reader = new CrateDataReader(new SqlResponse
            {
                Rows = new[] { new object[] { 1388534400000 } },
                Cols = new[] { "dt" }
            });

            reader.Read();
            var dt = new DateTime(2014, 01, 01);

            Assert.AreEqual(dt, reader.GetDateTime(0));
        }
コード例 #2
0
        public void TestGetDouble()
        {
            var reader = new CrateDataReader(new SqlResponse
            {
                Rows = new[] { new object[] { 1.2D } },
                Cols = new[] { "flag" },
            });

            reader.Read();

            Assert.AreEqual(1.2D, reader.GetDouble(0));
            Assert.AreEqual((float)1.2, reader.GetFloat(0));
            Assert.AreEqual((decimal)1.2, reader.GetDecimal(0));
        }
コード例 #3
0
        public void TestGetInt()
        {
            var reader = new CrateDataReader(new SqlResponse
            {
                Rows = new[] { new object[] { 1L } },
                Cols = new[] { "flag" },
            });

            reader.Read();

            Assert.AreEqual((byte)1, reader.GetByte(0));
            Assert.AreEqual((Int16)1, reader.GetInt16(0));
            Assert.AreEqual((Int32)1, reader.GetInt32(0));
            Assert.AreEqual((Int64)1, reader.GetInt64(0));
        }