-
Notifications
You must be signed in to change notification settings - Fork 139
Expand file tree
/
Copy pathLocalSqlServerFixture.cs
More file actions
34 lines (28 loc) · 972 Bytes
/
LocalSqlServerFixture.cs
File metadata and controls
34 lines (28 loc) · 972 Bytes
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
using Microsoft.Extensions.Configuration;
using System.Threading.Tasks;
using Xunit;
namespace Shesha.Testing.Fixtures
{
/// <summary>
/// xUnit fixture for a local SQL Server instance. Reads connection from appsettings.Test.json.
/// </summary>
public class LocalSqlServerFixture : IDatabaseFixture, IAsyncLifetime
{
public string ConnectionString { get; private set; } = default!;
public DbmsType DbmsType { get; private set; } = DbmsType.SQLServer;
public LocalSqlServerFixture()
{
}
public Task InitializeAsync()
{
var config = new ConfigurationBuilder().AddJsonFile("appsettings.Test.json").Build();
DbmsType = config.GetDbmsType();
ConnectionString = config.GetRequiredConnectionString("TestDB");
return Task.CompletedTask;
}
public Task DisposeAsync()
{
return Task.CompletedTask;
}
}
}