コード例 #1
0
        public void SimpleSelectFromFact()
        {
            var fromTable = new Table("from", "f");

            var builder = new SqlExpressionBuilderSelect();

            builder.From(fromTable);

            Assert.Equal("SELECT * FROM from f", builder.ToString());

            var expr = new AliasedExpression <CountExpression>(
                new CountExpression(new ColumnExpression("Id", fromTable)), "Anzahl");

            Assert.Equal("SELECT COUNT(f.Id) AS Anzahl FROM from f", builder.GetSingleSelectString(expr));
            Assert.Equal("SELECT * FROM from f", builder.ToString());
        }