Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added boolean join and orderby test #503

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion test/YesSql.Tests/CoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public async Task InitializeAsync()
if (_configuration == null)
{
_configuration = CreateConfiguration();

CleanDatabase(_configuration, false);

_store = await StoreFactory.CreateAndInitializeAsync(_configuration);
Expand Down Expand Up @@ -2834,6 +2834,49 @@ public async Task CanCountThenListOrdered()
}
}

[Fact]
public async Task CanJoinAndOrderByBoolean()
{
_store.RegisterIndexes<PersonIndexProvider>();
_store.RegisterIndexes<PersonAgeIndexProvider>();

using (var session = _store.CreateSession())
{
for (var i = 0; i < 100; i++)
{
var person = new Person
{
Firstname = "Bill" + i,
Lastname = "Gates" + i,
Age = i
};

session.Save(person);
}

await session.SaveChangesAsync();
}

using (var session = _store.CreateSession())
{
var query = session.Query().For<Person>()
.All(
x => x.With<PersonByName>(x => x.SomeName.Contains("Bill")),
x => x.With<PersonByAge>(x => x.Age >= 0).OrderByDescending(x => x.Adult)
);

var results = await query.ListAsync();

Assert.Equal(100, await query.CountAsync());
Assert.Equal(100, (results).Count());

for (int i = 0; i < 82; i++)
{
Assert.True(results.ElementAt(i).Age >= 18);
}
}
}

[Fact]
public async Task ShouldPageResults()
{
Expand Down
Loading