Path: redb/redb.Tests.Integration/Tests/Base/TreeSqlPreviewTestsBase.cs Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Tests.Integration/Tests/Base/TreeSqlPreviewTestsBase.cs ---- using redb.Core; using redb.Core.Query; using redb.Tests.Integration.Models; namespace redb.Tests.Integration.Tests.Base; /// /// SQL preview of a tree query, for the Free providers. The base implementation of /// TreeQueryProviderBase.GetSqlPreviewAsync asked the database for a preview routine of the retired search /// module (get_search_tree_sql_preview_base / dbo.get_search_tree_sql_preview_base), which no provider /// installs any more, so ToSqlStringAsync on a tree query failed instead of returning SQL. Each Free provider /// now returns the statement its pvt module compiles for the query, and these tests pin that down. /// public abstract class TreeSqlPreviewTestsBase { protected readonly IRedbService Redb; protected TreeSqlPreviewTestsBase(IRedbService redb) => Redb = redb; [Fact] public async Task Preview_TreeQuery_ReturnsCompiledSql() { var sql = await Redb.TreeQuery() .Where(n => n.IsActive) .Take(10) .ToSqlStringAsync(); sql.Should().NotBeNullOrWhiteSpace("the preview of a tree query must return the statement the provider compiles"); sql.ToUpperInvariant().Should().Contain("SELECT"); sql.Should().Contain("_values", "the Props filter is read from the value rows"); sql.Should().NotContain("get_search_tree_sql_preview_base", "no provider installs the preview routine of the retired search module"); } [Fact] public async Task Preview_TreeQueryWithOrdering_ContainsOrderBy() { var sql = await Redb.TreeQuery() .Where(n => n.IsActive) .OrderBy(n => n.Budget) .Take(10) .ToSqlStringAsync(); sql.Should().NotBeNullOrWhiteSpace(); sql.ToUpperInvariant().Should().Contain("ORDER BY"); } }