-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerSetUpFixture.cs
More file actions
42 lines (36 loc) · 1.18 KB
/
DockerSetUpFixture.cs
File metadata and controls
42 lines (36 loc) · 1.18 KB
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
38
39
40
41
42
using DotNet.Testcontainers.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TestContainersSQL.TestHelpers;
using TestContainersSQL.TestHelpers.Configuration;
namespace TestContainersSQL
{
[SetUpFixture]
public class DockerSetUpFixture
{
private static MsSqlTestcontainer? _msSqlContainer;
internal static MsSqlTestcontainer MsSqlContainer
{
get => _msSqlContainer ??
throw new InconclusiveException("Test fixture has not created a container for the MsSql server");
private set => _msSqlContainer = value;
}
[OneTimeSetUp]
public async Task OneTimeSetUp()
{
MsSqlContainer = new TestcontainersBuilder<MsSqlTestcontainer>()
.WithBizzkitDatabase(new MsSql2019TestcontainerDatabaseConfiguration(1451))
.Build();
await MsSqlContainer.StartAsync();
}
[OneTimeTearDown]
public async Task OneTimeTearDown()
{
await MsSqlContainer.StopAsync();
await MsSqlContainer.CleanUpAsync();
}
}
}