-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests that assert that the new methods work
- Loading branch information
Showing
2 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using FluentAssertions; | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
using Xunit; | ||
|
||
using static LiteDB.Tests.Issues.Issue1838_Tests; | ||
|
||
namespace LiteDB.Tests.Issues; | ||
|
||
public class Pull2468_Tests | ||
{ | ||
// tests if lowerinvariant works | ||
[Fact] | ||
public void Supports_LowerInvariant() | ||
{ | ||
using var db = new LiteDatabase(":memory:"); | ||
var collection = db.GetCollection<TestType>(nameof(TestType)); | ||
|
||
collection.Insert(new TestType() | ||
{ | ||
Foo = "Abc", | ||
Timestamp = DateTimeOffset.UtcNow, | ||
}); | ||
|
||
collection.Insert(new TestType() | ||
{ | ||
Foo = "Def", | ||
Timestamp = DateTimeOffset.UtcNow, | ||
}); | ||
|
||
var result = collection.Query() | ||
.Where(x => x.Foo.ToLowerInvariant() == "abc") | ||
.ToList(); | ||
|
||
Assert.NotNull(result); | ||
Assert.Single(result); | ||
} | ||
|
||
// tests if upperinvariant works | ||
[Fact] | ||
public void Supports_UpperInvariant() | ||
{ | ||
using var db = new LiteDatabase(":memory:"); | ||
var collection = db.GetCollection<TestType>(nameof(TestType)); | ||
|
||
collection.Insert(new TestType() | ||
{ | ||
Foo = "Abc", | ||
Timestamp = DateTimeOffset.UtcNow, | ||
}); | ||
|
||
collection.Insert(new TestType() | ||
{ | ||
Foo = "Def", | ||
Timestamp = DateTimeOffset.UtcNow, | ||
}); | ||
|
||
var result = collection.Query() | ||
.Where(x => x.Foo.ToUpperInvariant() == "ABC") | ||
.ToList(); | ||
|
||
Assert.NotNull(result); | ||
Assert.Single(result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters