Minor changes
This commit is contained in:
@@ -24,9 +24,9 @@ internal static class ControllerTestContext
|
||||
return new EventsContext(options);
|
||||
}
|
||||
|
||||
public static IOptions<PagingSettings> CreatePagingOptions(int pageSize = 10)
|
||||
public static IOptionsSnapshot<PagingSettings> CreatePagingOptions(int pageSize = 10)
|
||||
{
|
||||
return Options.Create(new PagingSettings { PageSize = pageSize });
|
||||
return new TestOptionsSnapshot<PagingSettings>(new PagingSettings { PageSize = pageSize });
|
||||
}
|
||||
|
||||
public static SieveModel EmptySieveModel()
|
||||
@@ -95,4 +95,12 @@ internal static class ControllerTestContext
|
||||
Name = name
|
||||
};
|
||||
}
|
||||
|
||||
private sealed class TestOptionsSnapshot<TOptions>(TOptions value) : IOptionsSnapshot<TOptions>
|
||||
where TOptions : class
|
||||
{
|
||||
public TOptions Value => value;
|
||||
|
||||
public TOptions Get(string? name) => value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,13 +14,13 @@ public class ProviderSpecificQueryShould
|
||||
ctx.People.Add(ControllerTestContext.CreatePerson());
|
||||
await ctx.SaveChangesAsync();
|
||||
|
||||
var people = await ctx.People
|
||||
.Where(person => person.FirstName != null && Microsoft.EntityFrameworkCore.EF.Functions.ILike(person.FirstName, "%iv%"))
|
||||
.ToListAsync();
|
||||
var people = await ctx.People
|
||||
.Where(person => person.FirstName != null && Microsoft.EntityFrameworkCore.EF.Functions.ILike(person.FirstName, "%iv%"))
|
||||
.ToListAsync();
|
||||
|
||||
Assert.Single(people);
|
||||
Assert.Equal("Ivan", people[0].FirstName);
|
||||
}
|
||||
Assert.Single(people);
|
||||
Assert.Equal("Ivan", people[0].FirstName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ThrowInvalidOperationExceptionWhenUsingILikeWithInMemoryProvider()
|
||||
|
||||
Reference in New Issue
Block a user