private void AssertExpression(Expression expression, string expectedOutput) { using (var writer = new IndentedTextWriter(new StringWriter(), " ")) { using (var tsql = new TSqlCodeProvider()) { tsql.GenerateCodeFromExpression(expression, writer, new CodeGeneratorOptions()); var output = writer.InnerWriter.ToString(); Assert.IsTrue(output == expectedOutput); } } }
private void AssertStatement(Statement statement, string expectedOutput) { using (var writer = new IndentedTextWriter(new StringWriter(), " ")) { writer.Indent += 1; // Adjust tab width; tests tab lineup for newlines. using (var tsql = new TSqlCodeProvider()) { tsql.GenerateCodeFromStatement(statement, writer, new CodeGeneratorOptions()); var output = writer.InnerWriter.ToString(); Assert.IsTrue(output.ToString() == expectedOutput); } } }
private void AssertClause(Clause clause, string expectedOutput) { using (var writer = new IndentedTextWriter(new StringWriter(), " ")) { using (var tsql = new TSqlCodeProvider()) { tsql.GenerateCodeFromStatement(clause, writer, new CodeGeneratorOptions()); var output = writer.InnerWriter.ToString(); Assert.IsTrue(output.ToString() == expectedOutput); } } }