public static void CreateNewTableSource(string tableName, string alias, string expected)
        {
            var name   = ObjectName.Parse(tableName);
            var source = new SqlQueryExpressionSource(name, alias);

            Assert.True(source.IsTable);
            Assert.False(source.IsQuery);
            Assert.Equal(!String.IsNullOrWhiteSpace(alias), source.IsAliased);
            Assert.Equal(expected, source.ToString());
        }
        public static void CreateNewQuerySource()
        {
            var fromTable = ObjectName.Parse("table1");
            var query     = new SqlQueryExpression();

            query.AllItems = true;
            query.From.Table(fromTable);
            var source = new SqlQueryExpressionSource(query, "a");

            Assert.True(source.IsQuery);
            Assert.False(source.IsTable);
            Assert.True(source.IsAliased);
            Assert.Equal("a", source.Alias);
            Assert.True(source.Query.AllItems);

            var expected = new SqlStringBuilder();

            expected.AppendLine("(SELECT *");
            expected.Append("  FROM table1) AS a");

            Assert.Equal(expected.ToString(), source.ToString());
        }