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])); }
public void CreateMetaData() { var meta = SqlSmallInt.GetTypeHandler().CreateMetaData("Test"); Assert.AreEqual(SqlDbType.SmallInt, meta.SqlDbType); Assert.AreEqual("Test", meta.Name); }
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()); }
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); }
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))); }
public void GetTypeHandler() { Assert.IsInstanceOf <SqlTypeHandler>(SqlSmallInt.GetTypeHandler()); }