I have an Entity Framework expression that is working as expected when running the actual code, but it is failing when running tests.
The query is attempting to find all of the rows where a certain field end in a letter.
var bars = await context.Bars.Where(b => EF.Functions.Like(b.Foo, "%[a-z]")).ToListAsync();
In my tests, I am using an in-memory database by calling UseInMemoryDatabase. All of the test cases work as expected except for those using a like expression that contains a character range (such as [a-z]).
In my example, the in-memory database will not match "123a" but will match "123[a-z]". It appears that the in-memory database does not understand characters ranges in a Like clause.
Is there a way to make the in-memory database understand character ranges when using EF.Functions.Like?