Example #1
0
        public void ToString_WithAlias_GeneratesCorrectSQLClause()
        {
            Tables_Blogs table = new Tables_Blogs().As("MyTable");

            var from = new FromClause(table);

            string expected =
                @"FROM
                [dbo].[Blogs] AS [MyTable]
            ";

            Assert.AreEqual(expected, from.ToString());
        }
Example #2
0
        public void ToString_Always_GeneratesCorrectSQLClause()
        {
            var table = new Tables_Blogs();

            var from = new FromClause(table);

            string expected =
                @"FROM
                [dbo].[Blogs]
            ";

            Assert.AreEqual(expected, from.ToString());
        }
Example #3
0
        public void ToString_WithJoin_GeneratesCorrectSQLClause()
        {
            var blogs = new Tables_Blogs();
            var posts = new Tables_Posts();

            FromClause from = new FromClause(blogs).Join(posts, blogs.Id == posts.BlogId);

            string expected =
                @"FROM
                [dbo].[Blogs]
            JOIN		[dbo].[Posts] ON
                    ([dbo].[Blogs].[Id] = [dbo].[Posts].[BlogId])
            ";

            Assert.AreEqual(expected, from.ToString());
        }