public void Test_SemiColon_Inside_Inline_Comment()
        {
            //arrange
            var traceService    = new Mock <ITraceService>();
            var sqlStatementRaw =
                $@"--; inline comment
SELECT 1
SELECT 2;

SELECT 3;
";

            //act
            var sut     = new SqlBatchParser(traceService.Object, new SemiColonSqlBatchLineAnalyzer(), new CommentAnalyzer());
            var results = sut.Parse(sqlStatementRaw);

            //assert
            results.Count.ShouldBe(2);
            results[0].BatchText.ShouldBe(
                $@"--; inline comment
SELECT 1
SELECT 2;");
            results[1].BatchText.ShouldBe(
                $@"SELECT 3;");
        }
        public void Test_Go_Inside_Nested_Multiline_Block_Comment()
        {
            //arrange
            var traceService    = new Mock <ITraceService>();
            var sqlStatementRaw =
                $@"/* multiline comment block
/*
GO
*/
*/
SELECT 1;
SELECT 2;
GO

SELECT 3;
GO
";

            //act
            var sut     = new SqlBatchParser(traceService.Object, new GoSqlBatchLineAnalyzer(), new CommentAnalyzer());
            var results = sut.Parse(sqlStatementRaw);

            //assert
            results.Count.ShouldBe(2);
            results.First().BatchText.ShouldBe(
                $@"/* multiline comment block
/*
GO
*/
*/
SELECT 1;
SELECT 2;");
            results[1].BatchText.ShouldBe(
                $@"SELECT 3;");
        }
        public void Test_SemiColon_Inside_Sql_Statement_Literal()
        {
            //arrange
            var traceService    = new Mock <ITraceService>();
            var sqlStatementRaw =
                $@"SELECT 1
SELECT 'This is ; inside valid sql statement';

SELECT 3;
";
            //act
            var sut     = new SqlBatchParser(traceService.Object, new SemiColonSqlBatchLineAnalyzer(), new CommentAnalyzer());
            var results = sut.Parse(sqlStatementRaw);

            //assert
            results.Count.ShouldBe(2);
            results[0].BatchText.ShouldBe(
                $@"SELECT 1
SELECT 'This is ; inside valid sql statement';");
            results[1].BatchText.ShouldBe(
                $@"SELECT 3;");
        }
        public void Test_Go_Without_Go_In_Last_Line()
        {
            //arrange
            var traceService    = new Mock <ITraceService>();
            var sqlStatementRaw =
                $@"SELECT 1;
SELECT 2;
GO

SELECT 3;
";
            //act
            var sut     = new SqlBatchParser(traceService.Object, new GoSqlBatchLineAnalyzer(), new CommentAnalyzer());
            var results = sut.Parse(sqlStatementRaw);

            //assert
            results.Count.ShouldBe(2);
            results[0].BatchText.ShouldBe(
                $@"SELECT 1;
SELECT 2;");
            results[1].BatchText.ShouldBe(
                $@"SELECT 3;");
        }
        public List <string> BreakStatements(string sqlStatementRaw)
        {
            var sqlBatchParser = new SqlBatchParser(_traceService, new GoSqlBatchLineAnalyzer(), new CommentAnalyzer());

            return(sqlBatchParser.Parse(sqlStatementRaw).Select(s => s.BatchText).ToList());
        }