forked from npgsql/efcore.pg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow DbConnection or connection string to be changed on existing DbC…
…ontext Closes npgsql#1174 Following dotnet/efcore#8427
- Loading branch information
Showing
3 changed files
with
104 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using Npgsql.EntityFrameworkCore.PostgreSQL.TestUtilities; | ||
using Xunit; | ||
|
||
namespace Npgsql.EntityFrameworkCore.PostgreSQL | ||
{ | ||
public class TwoDatabasesNpgsqlTest : TwoDatabasesTestBase, IClassFixture<NpgsqlFixture> | ||
{ | ||
public TwoDatabasesNpgsqlTest(NpgsqlFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
protected new NpgsqlFixture Fixture => (NpgsqlFixture)base.Fixture; | ||
|
||
protected override DbContextOptionsBuilder CreateTestOptions( | ||
DbContextOptionsBuilder optionsBuilder, bool withConnectionString = false) | ||
=> withConnectionString | ||
? optionsBuilder.UseNpgsql(DummyConnectionString) | ||
: optionsBuilder.UseNpgsql(); | ||
|
||
protected override TwoDatabasesWithDataContext CreateBackingContext(string databaseName) | ||
=> new TwoDatabasesWithDataContext(Fixture.CreateOptions(NpgsqlTestStore.Create(databaseName))); | ||
|
||
protected override string DummyConnectionString { get; } = "Database=DoesNotExist"; | ||
} | ||
} |