namespace DigitalData.Core.Tests.Infrastructure; using Bogus; using DigitalData.Core.Infrastructure; using DigitalData.Core.Tests.Mock; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using System.Reflection; public class DbRepositoryTests { private IHost _host; [SetUp] public void Setup() { var builder = Host.CreateApplicationBuilder(); builder.Services.AddDbContext(opt => opt.UseInMemoryDatabase("MockDB")); builder.Services.AddDbRepository(context => context.Users); builder.Services.AddAutoMapper(Assembly.GetExecutingAssembly()); _host = builder.Build(); } [TearDown] public void TearDown() { if (_host is IDisposable disposableHost) disposableHost.Dispose(); } }