Ejemplo n.º 1
0
        public void CanParseSimpleScriptEndingInNewLine()
        {
            string        script  = "Test" + Environment.NewLine + "GO" + Environment.NewLine;
            List <string> scripts = new ScriptSplitter(script).ToList();

            Assert.AreEqual(1, scripts.Count());
            Assert.AreEqual("Test", scripts.First());
        }
Ejemplo n.º 2
0
        public void CanParseQuotedCorrectly()
        {
            const string script = @"INSERT INTO #Indexes
	EXEC sp_helpindex 'dbo.subtext_URLs'"    ;

            var scripts = new ScriptSplitter(script);

            Assert.AreEqual(script, scripts.First(), "Script text should not be modified");
        }
Ejemplo n.º 3
0
        public void MultiLineQuoteShouldNotBeSplitByGoKeyword()
        {
            string script = "PRINT '" + Environment.NewLine
                            + "GO" + Environment.NewLine
                            + "SELECT * FROM BLAH" + Environment.NewLine
                            + "GO" + Environment.NewLine
                            + "'";

            var scripts = new ScriptSplitter(script);

            Assert.AreEqual(script, scripts.First());
            Assert.AreEqual(1, scripts.Count(), "expected only one script");
        }
Ejemplo n.º 4
0
        public void MultiLineQuoteShouldNotIgnoreDoubleQuote()
        {
            string script = "PRINT '" + Environment.NewLine
                            + "''" + Environment.NewLine
                            + "GO" + Environment.NewLine
                            + "/*" + Environment.NewLine
                            + "GO"
                            + "'";

            var scripts = new ScriptSplitter(script);

            Assert.AreEqual(1, scripts.Count());
            Assert.AreEqual(script, scripts.First());
        }
        public void MultiLineQuoteShouldNotIgnoreDoubleQuote()
        {
            string script = "PRINT '" + Environment.NewLine
                            + "''" + Environment.NewLine
                            + "GO" + Environment.NewLine
                            + "/*" + Environment.NewLine
                            + "GO"
                            + "'";

            var scripts = new ScriptSplitter(script);

            Assert.AreEqual(1, scripts.Count());
            Assert.AreEqual(script, scripts.First());
        }
        public void MultiLineQuoteShouldNotBeSplitByGoKeyword()
        {
            string script = "PRINT '" + Environment.NewLine
                            + "GO" + Environment.NewLine
                            + "SELECT * FROM BLAH" + Environment.NewLine
                            + "GO" + Environment.NewLine
                            + "'";

            var scripts = new ScriptSplitter(script);

            Assert.AreEqual(script, scripts.First());
            Assert.AreEqual(1, scripts.Count(), "expected only one script");
        }
 public void CanParseSimpleScriptEndingInNewLine()
 {
     string script = "Test" + Environment.NewLine + "GO" + Environment.NewLine;
     List<string> scripts = new ScriptSplitter(script).ToList();
     Assert.AreEqual(1, scripts.Count());
     Assert.AreEqual("Test", scripts.First());
 }
        public void CanParseQuotedCorrectly()
        {
            const string script = @"INSERT INTO #Indexes
            EXEC sp_helpindex 'dbo.subtext_URLs'";

            var scripts = new ScriptSplitter(script);
            Assert.AreEqual(script, scripts.First(), "Script text should not be modified");
        }