Пример #1
0
        public void FluentInterfaceTest()
        {
            SqlSelectBuilder builder = new SqlSelectBuilder();

            builder.Source = new TableOrSubQuery("something", "t1");
            builder.ResultColumns.Add("col1");

            builder.Join("something2", "Using (FKey)")
            .Join("something3", "Using (FKey2)")
            .Where("x > 1")
            .GroupBy("col1", "col2")
            .Limit(1, 0);

            var sql = builder.ToString();

            sql.Should().ContainEquivalentOf("JOIN");
            sql.Should().ContainEquivalentOf("WHERE");
            sql.Should().ContainEquivalentOf("GROUP BY");
            sql.Should().ContainEquivalentOf("LIMIT");

            VerifyCommandSyntex(sql + ";");
        }