You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Or I made some stupid mistake in my code and don’t understand it. Or, a comparison condition with an index is not processed correctly.
Take a look at the test below: it adds 10 elements, and then all the elements from the collection are queried in different ways. The first two tests are successful. And the last 2 for some reason fail.
Code to Reproduce
public class StateModel
{
[BsonId]
public int Id { get; set; }
}
[Fact]
public void StateTest()
{
using (var db = new LiteDatabase(":memory:"))
{
var col = db.GetCollection<StateModel>("col");
var count = 10;
var firstId = 5;
var lastId = firstId + count - 1;
for (var i = firstId; i <= lastId; i++)
{
col.Insert(new StateModel
{
Id = i
});
}
var list = col.Query().ToList();
list.Should().HaveCount(count);
list = col.Query()
.Where(x => firstId <= x.Id)
.ToList();
list.Should().HaveCount(count);
list = col.Query()
.Where(x => x.Id <= lastId)
.ToList();
list.Should().HaveCount(count);
list = col.Query()
.Where(x => firstId <= x.Id && x.Id <= lastId)
.ToList();
list.Should().HaveCount(count);
}
}
Expected behavior
Test passed.
The text was updated successfully, but these errors were encountered:
Version
5.0.8
Describe the bug
Hi.
Or I made some stupid mistake in my code and don’t understand it. Or, a comparison condition with an index is not processed correctly.
Take a look at the test below: it adds 10 elements, and then all the elements from the collection are queried in different ways. The first two tests are successful. And the last 2 for some reason fail.
Code to Reproduce
Expected behavior
Test passed.
The text was updated successfully, but these errors were encountered: