-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
TwoDatabasesSqliteTest.cs
37 lines (30 loc) · 1.35 KB
/
TwoDatabasesSqliteTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Microsoft.EntityFrameworkCore;
public class TwoDatabasesSqliteTest : TwoDatabasesTestBase, IClassFixture<TwoDatabasesSqliteTest.TwoDatabasesFixture>
{
public TwoDatabasesSqliteTest(TwoDatabasesFixture fixture)
: base(fixture)
{
}
protected new TwoDatabasesFixture Fixture
=> (TwoDatabasesFixture)base.Fixture;
protected override DbContextOptionsBuilder CreateTestOptions(
DbContextOptionsBuilder optionsBuilder,
bool withConnectionString = false,
bool withNullConnectionString = false)
=> withConnectionString
? withNullConnectionString
? optionsBuilder.UseSqlite((string)null)
: optionsBuilder.UseSqlite(DummyConnectionString)
: optionsBuilder.UseSqlite();
protected override TwoDatabasesWithDataContext CreateBackingContext(string databaseName)
=> new(Fixture.CreateOptions(SqliteTestStore.Create(databaseName)));
protected override string DummyConnectionString
=> "DataSource=DummyDatabase";
public class TwoDatabasesFixture : ServiceProviderFixtureBase
{
protected override ITestStoreFactory TestStoreFactory
=> SqliteTestStoreFactory.Instance;
}
}