Esempio n. 1
0
        public static void SubtractNumber(string value1, object value2, string expected)
        {
            var a = SqlYearToMonth.Parse(value1);
            var b = SqlValueUtil.FromObject(value2);

            Binary(type => type.Subtract, a, b, expected);
        }
Esempio n. 2
0
        public static void SubtractYearToMonth(string value1, string value2, string expected)
        {
            var a = SqlYearToMonth.Parse(value1);
            var b = SqlYearToMonth.Parse(value2);

            Binary(type => type.Subtract, a, b, expected);
        }
Esempio n. 3
0
        public static void GetString(string input, string expected)
        {
            var type = PrimitiveTypes.YearToMonth();
            var ytm  = SqlYearToMonth.Parse(input);
            var s    = type.ToSqlString(ytm);

            Assert.Equal(expected, s);
        }
Esempio n. 4
0
        private static void Binary(Func <SqlType, Func <ISqlValue, ISqlValue, ISqlValue> > selector,
                                   object value1,
                                   object value2,
                                   string expected)
        {
            var type = new SqlYearToMonthType();

            var a = value1 is SqlYearToMonth ? (ISqlValue)(SqlYearToMonth)value1 : (SqlNumber)value1;
            var b = value2 is SqlYearToMonth ? (ISqlValue)(SqlYearToMonth)value2 : (SqlNumber)value2;

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

            var exp = SqlYearToMonth.Parse(expected);

            Assert.Equal(exp, result);
        }