public static void Serialize()
        {
            var type   = new SqlDayToSecondType();
            var result = BinarySerializeUtil.Serialize(type);

            Assert.Equal(type, result);
        }
        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);
        }
        private static void Binary(Func <SqlType, Func <ISqlValue, ISqlValue, ISqlValue> > selector,
                                   string value1,
                                   string value2,
                                   string expected)
        {
            var type = new SqlDayToSecondType();

            var a = SqlDayToSecond.Parse(value1);
            var b = SqlDayToSecond.Parse(value2);

            var op     = selector(type);
            var result = op(a, b);

            var exp = SqlDayToSecond.Parse(expected);

            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);
        }