public void GetRawValue() { SqlType type = new SqlVarBinary(data, 10, ParameterDirection.Input); Assert.AreEqual(data, type.GetRawValue()); type = new SqlVarBinary(null, 10, ParameterDirection.Input); Assert.Null(type.GetRawValue()); }
public void GetValue() { var type = new SqlVarBinary(CompressionContext.NoCompression); byte[] input; input = new byte[] { 0x25, 0xF8, 0x32 }; Assert.AreEqual(new byte[] { 0x25, 0xF8, 0x32 }, type.GetValue(input)); }
public void GetRawValue() { SqlType type = new SqlVarBinary(data, 10, ParameterDirection.Input); Assert.AreEqual(data, type.GetRawValue()); type = new SqlVarBinary(null, 10, ParameterDirection.Input); Assert.Null(type.GetRawValue()); }
public void CreateMetaData() { Assert.Throws<TypeCannotBeUsedAsAClrTypeException>(() => SqlVarBinary.GetTypeHandler().CreateMetaData("Test")); SqlTypeHandler col = new SqlVarBinary(data, null, ParameterDirection.Input); Assert.Throws<TypePropertiesMustBeSetExplicitlyException>(() => col.CreateMetaData("Test")); col = new SqlVarBinary(data, 10, ParameterDirection.Input); var meta = col.CreateMetaData("Test"); Assert.AreEqual(SqlDbType.VarBinary, meta.SqlDbType); Assert.AreEqual(10, meta.MaxLength); Assert.AreEqual("Test", meta.Name); }
public void CreateMetaData() { Assert.Throws <TypeCannotBeUsedAsAClrTypeException>(() => SqlVarBinary.GetTypeHandler().CreateMetaData("Test")); SqlTypeHandler col = new SqlVarBinary(data, null, ParameterDirection.Input); Assert.Throws <TypePropertiesMustBeSetExplicitlyException>(() => col.CreateMetaData("Test")); col = new SqlVarBinary(data, 10, ParameterDirection.Input); var meta = col.CreateMetaData("Test"); Assert.AreEqual(SqlDbType.VarBinary, meta.SqlDbType); Assert.AreEqual(10, meta.MaxLength); Assert.AreEqual("Test", meta.Name); }
public void CreateParamFromValue() { Assert.Throws <TypeCannotBeUsedAsAClrTypeException>(() => SqlVarBinary.GetTypeHandler().CreateParamFromValue("Test", null)); }
public void GetTypeHandler() { Assert.IsInstanceOf <SqlTypeHandler>(SqlVarBinary.GetTypeHandler()); }