-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTestFixture.cs
More file actions
23 lines (18 loc) · 868 Bytes
/
TestFixture.cs
File metadata and controls
23 lines (18 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright (c) Fusonic GmbH. All rights reserved.
// Licensed under the MIT License. See LICENSE file in the project root for license information.
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
namespace Fusonic.Extensions.UnitTests.EntityFrameworkCore.SqlServer.Tests;
public class TestFixture : ServiceProviderTestFixture
{
protected override void RegisterCoreDependencies(IServiceCollection services)
{
var testStore = new SqlServerDatabasePerTestStore(TestStartup.ConnectionString);
services.AddSingleton<ITestStore>(testStore);
AddDbContext(services, testStore);
}
protected virtual void AddDbContext(IServiceCollection services, SqlServerDatabasePerTestStore testStore)
{
services.AddDbContext<TestDbContext>(b => b.UseSqlServerDatabasePerTest(testStore));
}
}