Updated `DigitalData.Core.Tests.csproj` to include conditional package references for Entity Framework Core and its InMemory provider for net7.0, net8.0, and net9.0. Added `DbRepositoryTests` class with setup and teardown methods for managing the lifecycle of a host instance.
24 lines
430 B
C#
24 lines
430 B
C#
namespace DigitalData.Core.Tests.Infrastructure;
|
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
public class DbRepositoryTests
|
|
{
|
|
private IHost _host;
|
|
|
|
[SetUp]
|
|
public void Setup()
|
|
{
|
|
var builder = Host.CreateApplicationBuilder();
|
|
|
|
_host = builder.Build();
|
|
}
|
|
|
|
[TearDown]
|
|
public void TearDown()
|
|
{
|
|
if (_host is IDisposable disposableHost)
|
|
disposableHost.Dispose();
|
|
}
|
|
}
|