Esempio n. 1
0
        public void TestSearchedCase()
        {
            var c1 = (Expression)1;
            var c2 = Sql.Integer(2);

            var kvp = new KeyValuePair<Predicate, Expression>(c1.LessThan(c2), Sql.String("Foo"));
            var @case = new SearchedCase(kvp);

            AssertExpression(@case, "\r\n  CASE \r\n    WHEN 1 < 2 THEN 'Foo'\r\n  END\r\n");
        }
Esempio n. 2
0
 public void SearchedCaseConstructorTest3()
 {
     ExpressionList<SearchedCaseExpression> searchCases = null; // TODO: Initialize to an appropriate value
     Expression elseCase = null; // TODO: Initialize to an appropriate value
     SearchedCase target = new SearchedCase(searchCases, elseCase);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
Esempio n. 3
0
 public void SearchedCaseConstructorTest1()
 {
     KeyValuePair<Predicate, Expression>[] cases = null; // TODO: Initialize to an appropriate value
     SearchedCase target = new SearchedCase(cases);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
Esempio n. 4
0
        private void GenerateCodeFromSearchedCase(SearchedCase expression, TextWriter writer, CodeGeneratorOptions options)
        {
            if (expression != null)
            {
                if (expression.SearchCases != null && expression.SearchCases.Count > 0)
                {
                    using (new IndentHelper(writer))
                    {
                        writer.WriteLine();
                        writer.Write("CASE ");
                        using (new IndentHelper(writer))
                        {
                            writer.WriteLine();
                            foreach (SearchedCaseExpression sce in expression.SearchCases)
                            {
                                writer.Write("WHEN ");
                                GenerateCodeFromExpression(sce.BooleanExpression, writer, options);
                                writer.Write(" THEN ");
                                GenerateCodeFromExpression(sce.ResultExpression, writer, options);
                                writer.WriteLine();
                            }
                        }
                        if (expression.ElseCase != null)
                        {
                            writer.Write("ELSE ");
                            GenerateCodeFromExpression(expression.ElseCase, writer, options);

                        }
                        writer.Write("END");
                        writer.WriteLine();
                    }
                }
            }
        }