コード例 #1
0
ファイル: TSqlCodeProvider.cs プロジェクト: jgshort/SqlDom
 private void GenerateUnaryExpression(Unary expression, TextWriter writer, CodeGeneratorOptions options)
 {
     string op = string.Empty;
     switch (expression.Operator)
     {
         case UnaryOperators.Negative:
             op = "-";
             break;
         case UnaryOperators.Positive:
             op = "+";
             break;
         case UnaryOperators.OnesComplement:
             op = "~";
             break;
     }
     writer.Write(op);
     GenerateCodeFromExpression(expression.Expression, writer, options);
 }
コード例 #2
0
ファイル: SqlTests.cs プロジェクト: jgshort/SqlDom
        public void TestSqlUnaryExpression()
        {
            Unary[] ops = new Unary[4] {
                new Unary(UnaryOperators.Positive, 123.456M),
                new Unary(UnaryOperators.Negative, 123.456M),
                new Unary(UnaryOperators.OnesComplement, 123.456M),
                new Unary("+", 123.456M),
            };
            string[] tests = new string[4] {
            "+123.456",
            "-123.456",
            "~123.456",
            "+123.456",
            };

            int i = 0;
            foreach (Unary op in ops)
            {
                AssertExpression(op, tests[i++]);
            }
        }
コード例 #3
0
ファイル: UnaryTest.cs プロジェクト: jgshort/SqlDom
 public void UnaryConstructorTest1()
 {
     UnaryOperators op = new UnaryOperators(); // TODO: Initialize to an appropriate value
     int expression = 0; // TODO: Initialize to an appropriate value
     Unary target = new Unary(op, expression);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }