You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.6 KiB
C#
45 lines
1.6 KiB
C#
using System;
|
|
using EntityFramework.Jet.FunctionalTests.TestUtilities;
|
|
using EntityFrameworkCore.Jet;
|
|
using Extensions.DependencyInjection;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Query;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace EntityFramework.Jet.FunctionalTests
|
|
{
|
|
public class OwnedQueryJetFixture : OwnedQueryFixtureBase, IDisposable
|
|
{
|
|
private readonly DbContextOptions _options;
|
|
private readonly JetTestStore _testStore;
|
|
|
|
public TestSqlLoggerFactory TestSqlLoggerFactory { get; } = new TestSqlLoggerFactory();
|
|
|
|
public OwnedQueryJetFixture()
|
|
{
|
|
_testStore = JetTestStore.Create("OwnedQueryTest");
|
|
|
|
_options = new DbContextOptionsBuilder()
|
|
.UseJet(_testStore.ConnectionString, b => b.ApplyConfiguration())
|
|
.UseInternalServiceProvider(
|
|
new ServiceCollection()
|
|
.AddEntityFrameworkJet()
|
|
.AddSingleton(TestModelSource.GetFactory(OnModelCreating))
|
|
.AddSingleton<ILoggerFactory>(TestSqlLoggerFactory)
|
|
.BuildServiceProvider(validateScopes: true))
|
|
.Options;
|
|
|
|
using (var context = new DbContext(_options))
|
|
{
|
|
context.Database.EnsureCreated();
|
|
|
|
AddTestData(context);
|
|
}
|
|
}
|
|
|
|
public DbContext CreateContext() => new DbContext(_options);
|
|
|
|
public void Dispose() => _testStore.Dispose();
|
|
}
|
|
} |