Exemplo n.º 1
0
        public void Length()
        {
            var type = new SqlSmallInt(CompressionContext.NoCompression);

            Assert.Throws <ArgumentException>(() => type.GetValue(new byte[1]));
            Assert.Throws <ArgumentException>(() => type.GetValue(new byte[3]));
        }
Exemplo n.º 2
0
        public void CreateMetaData()
        {
            var meta = SqlSmallInt.GetTypeHandler().CreateMetaData("Test");

            Assert.AreEqual(SqlDbType.SmallInt, meta.SqlDbType);
            Assert.AreEqual("Test", meta.Name);
        }
Exemplo n.º 3
0
        public void GetRawValue()
        {
            SqlType type = new SqlSmallInt(5, ParameterDirection.Input);
            Assert.AreEqual((short)5, type.GetRawValue());

            type = new SqlSmallInt(null, ParameterDirection.Input);
            Assert.Null(type.GetRawValue());
        }
Exemplo n.º 4
0
        public void GetParameter()
        {
            SqlType type = new SqlSmallInt(5, ParameterDirection.Input);
            TestHelper.AssertSqlParameter(type.GetParameter(), SqlDbType.SmallInt, (short)5);

            type = new SqlSmallInt(null, ParameterDirection.Input);
            TestHelper.AssertSqlParameter(type.GetParameter(), SqlDbType.SmallInt, DBNull.Value);
        }
Exemplo n.º 5
0
        public void GetRawValue()
        {
            SqlType type = new SqlSmallInt(5, ParameterDirection.Input);

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

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

            TestHelper.AssertSqlParameter(type.GetParameter(), SqlDbType.SmallInt, (short)5);

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

            byte[] input;

            input = new byte[] { 0x16, 0x33 };
            Assert.AreEqual(13078, Convert.ToInt16(type.GetValue(input)));

            input = new byte[] { 0xf9, 0x0d };
            Assert.AreEqual(3577, Convert.ToInt16(type.GetValue(input)));

            input = new byte[] { 0xa4, 0xd6 };
            Assert.AreEqual(-10588, Convert.ToInt16(type.GetValue(input)));
        }
Exemplo n.º 8
0
 public void GetTypeHandler()
 {
     Assert.IsInstanceOf <SqlTypeHandler>(SqlSmallInt.GetTypeHandler());
 }