public void SmokeTestWithVisitor() { var visitor = new TopRowFilterVisitor(); TSqlScript script = Parse("TsqlSample1.sql"); script.Accept(visitor); Assert.IsTrue(visitor.HasParenthesis); visitor = new TopRowFilterVisitor(); script = Parse("TsqlSample2.sql"); script.Accept(visitor); Assert.IsFalse(visitor.HasParenthesis); }
public override IList<RuleProblem> Analyze(RuleContext context) { TSqlScript script = context.ScriptFragment as TSqlScript; Debug.Assert(script != null, "TSqlScript is expected"); Visitor = new TopRowFilterVisitor(); script.Accept(Visitor); if (Visitor.WasVisited && !(Visitor as TopRowFilterVisitor).HasParenthesis) { AddProblem(Resources.TopRule); } return Problems; }
public override IList <RuleProblem> Analyze(RuleContext context) { TSqlScript script = context.ScriptFragment as TSqlScript; Debug.Assert(script != null, "TSqlScript is expected"); Visitor = new TopRowFilterVisitor(); script.Accept(Visitor); if (Visitor.WasVisited && !(Visitor as TopRowFilterVisitor).HasParenthesis) { AddProblem(Resources.TopRule); } return(Problems); }