Esempio n. 1
0
        public void CreateMetaData()
        {
            var meta = SqlInt.GetTypeHandler().CreateMetaData("Test");

            Assert.AreEqual(SqlDbType.Int, meta.SqlDbType);
            Assert.AreEqual("Test", meta.Name);
        }
Esempio n. 2
0
        public void Length()
        {
            var type = new SqlInt(CompressionContext.NoCompression);

            Assert.Throws <ArgumentException>(() => type.GetValue(new byte[3]));
            Assert.Throws <ArgumentException>(() => type.GetValue(new byte[5]));
        }
Esempio n. 3
0
        public void GetRawValue()
        {
            SqlType type = new SqlInt(5, ParameterDirection.Input);
            Assert.AreEqual(5, type.GetRawValue());

            type = new SqlInt(null, ParameterDirection.Input);
            Assert.Null(type.GetRawValue());
        }
Esempio n. 4
0
        public void GetParameter()
        {
            SqlType type = new SqlInt(5, ParameterDirection.Input);
            TestHelper.AssertSqlParameter(type.GetParameter(), SqlDbType.Int, 5);

            type = new SqlInt(null, ParameterDirection.Input);
            TestHelper.AssertSqlParameter(type.GetParameter(), SqlDbType.Int, DBNull.Value);
        }
Esempio n. 5
0
        public void GetRawValue()
        {
            SqlType type = new SqlInt(5, ParameterDirection.Input);

            Assert.AreEqual(5, type.GetRawValue());

            type = new SqlInt(null, ParameterDirection.Input);
            Assert.Null(type.GetRawValue());
        }
Esempio n. 6
0
        public void GetParameter()
        {
            SqlType type = new SqlInt(5, ParameterDirection.Input);

            TestHelper.AssertSqlParameter(type.GetParameter(), SqlDbType.Int, 5);

            type = new SqlInt(null, ParameterDirection.Input);
            TestHelper.AssertSqlParameter(type.GetParameter(), SqlDbType.Int, DBNull.Value);
        }
Esempio n. 7
0
        public void GetValue()
        {
            var type = new SqlInt(CompressionContext.NoCompression);

            byte[] input;

            input = new byte[] { 0x5e, 0x3b, 0x27, 0x2a };
            Assert.AreEqual(707214174, Convert.ToInt32(type.GetValue(input)));

            input = new byte[] { 0x8d, 0xf9, 0xaa, 0x30 };
            Assert.AreEqual(816511373, Convert.ToInt32(type.GetValue(input)));

            input = new byte[] { 0x7a, 0x4a, 0x72, 0xe2 };
            Assert.AreEqual(-495826310, Convert.ToInt32(type.GetValue(input)));
        }
Esempio n. 8
0
 public void GetTypeHandler()
 {
     Assert.IsInstanceOf <SqlTypeHandler>(SqlInt.GetTypeHandler());
 }