Exemple #1
0
        public void TestDerivedTableRemovesSemicolons()
        {
            var table  = new SqlDerivedTable("SELECT * FROM [Foo];");
            var args   = new SqlBuildArguments();
            var writer = new SqlTextWriter();

            args.AssignAlias(table);

            ((ISqlTable)table).Render(writer, args);

            Assert.AreEqual("(SELECT * FROM [Foo]) AS [" + args.TableName(table) + "]", writer.ToString());
        }
Exemple #2
0
        public void TestDerivedTableWrapsWithParens()
        {
            var table  = new SqlDerivedTable("SELECT * FROM [Foo]");
            var args   = new SqlBuildArguments();
            var writer = new SqlTextWriter();

            args.AssignAlias(table);

            ((ISqlTable)table).Render(writer, args);

            Assert.IsTrue(string.Equals(writer.ToString(), "(SELECT * FROM [Foo]) AS [" + args.TableName(table) + "]"));
        }