Пример #1
0
 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
        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
 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");
 }