public static void CastToString(string value, SqlTypeCode destTypeCode, int size, string expexted) { var dts = SqlDayToSecond.Parse(value); var type = new SqlDayToSecondType(); var destType = PrimitiveTypes.Type(destTypeCode, new { size }); var result = type.Cast(dts, destType); var exp = SqlValueUtil.FromObject(expexted); Assert.NotNull(result); Assert.Equal(exp, result); }
public static void CastToBinary(string value, SqlTypeCode destTypeCode, int size) { var dts = SqlDayToSecond.Parse(value); var type = new SqlDayToSecondType(); var destType = PrimitiveTypes.Type(destTypeCode, new { size }); var result = type.Cast(dts, destType); Assert.IsType <SqlBinary>(result); var binary = (SqlBinary)result; var bytes = binary.ToByteArray(); var back = new SqlDayToSecond(bytes); Assert.Equal(dts, back); }