mirror of
https://github.com/zoriya/EntityFrameworkCore.Projectables.git
synced 2026-08-15 18:44:57 +00:00
Fixed broken tests
This commit is contained in:
@@ -79,7 +79,7 @@ namespace EntityFrameworkCore.Projectables.FunctionalTests
|
||||
[Fact]
|
||||
public Task ProjectOverMethodTakingDbContext()
|
||||
{
|
||||
using var dbContext = new SampleDbContext<User>();
|
||||
using var dbContext = new SampleDbContext<User>(Infrastructure.CompatibilityMode.Full);
|
||||
|
||||
var query = dbContext.Set<User>()
|
||||
.Select(x => x.GetLastOrderFromExternalDbContext(dbContext));
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ namespace EntityFrameworkCore.Projectables.FunctionalTests.ExtensionMethods
|
||||
[Fact]
|
||||
public Task ExtensionMethodAcceptingDbContext()
|
||||
{
|
||||
using var dbContext = new SampleDbContext<Entity>();
|
||||
using var dbContext = new SampleDbContext<Entity>(Infrastructure.CompatibilityMode.Full);
|
||||
|
||||
var sampleQuery = dbContext.Set<Entity>()
|
||||
.Select(x => dbContext.Set<Entity>().Where(y => y.Id > x.Id).FirstOrDefault());
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using EntityFrameworkCore.Projectables.Extensions;
|
||||
using EntityFrameworkCore.Projectables.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace EntityFrameworkCore.Projectables.FunctionalTests.Helpers
|
||||
@@ -12,11 +13,18 @@ namespace EntityFrameworkCore.Projectables.FunctionalTests.Helpers
|
||||
public class SampleDbContext<TEntity> : DbContext
|
||||
where TEntity : class
|
||||
{
|
||||
readonly CompatibilityMode _compatibilityMode;
|
||||
|
||||
public SampleDbContext(CompatibilityMode compatibilityMode = CompatibilityMode.Limited)
|
||||
{
|
||||
_compatibilityMode = compatibilityMode;
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseSqlServer("Server=(localdb)\v11.0;Integrated Security=true"); // Fake connection string as we're actually never connecting
|
||||
optionsBuilder.UseProjectables(options => {
|
||||
options.CompatibilityMode(Infrastructure.CompatibilityMode.Full); // Needed by our ComplexModelTests
|
||||
options.CompatibilityMode(_compatibilityMode); // Needed by our ComplexModelTests
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user