private static DbContextOptions<HighFiveContext> CreateNewContextOptions()
{
// Create a fresh service provider, and therefore a fresh
// InMemory database instance.
var serviceProvider = new ServiceCollection()
.AddEntityFrameworkInMemoryDatabase()
.BuildServiceProvider();
// Create a new options instance telling the context to use an
// InMemory database and the new service provider.
var builder = new DbContextOptionsBuilder<HighFiveContext>();
builder.UseInMemoryDatabase()
.UseInternalServiceProvider(serviceProvider);
return builder.Options;
}
<RunSettings>
<!-- Without these settings, the tests fail with "attempt to access unloaded AppDomain exception -->
<!-- CKS: Note everything runs fine under resharper test runner -->
<MSTest>
<ForcedLegacyMode>true</ForcedLegacyMode>
<InProcMode>true</InProcMode>
</MSTest>
</RunSettings>