Add AutoMapper setup to DbRepositoryTests
This commit introduces a using directive for `System.Reflection` in `DbRepositoryTests.cs` to support reflection features. The `Setup` method is updated to include `AddAutoMapper`, ensuring AutoMapper services are registered for dependency injection in the test environment.
This commit is contained in:
parent
561a751de4
commit
e752c6f6ab
@ -1,15 +1,17 @@
|
|||||||
namespace DigitalData.Core.Tests.Infrastructure;
|
namespace DigitalData.Core.Tests.Infrastructure;
|
||||||
|
|
||||||
|
using Bogus;
|
||||||
using DigitalData.Core.Infrastructure;
|
using DigitalData.Core.Infrastructure;
|
||||||
using DigitalData.Core.Tests.Mock;
|
using DigitalData.Core.Tests.Mock;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
public class DbRepositoryTests
|
public class DbRepositoryTests
|
||||||
{
|
{
|
||||||
private IHost _host;
|
private IHost _host;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
@ -19,6 +21,8 @@ public class DbRepositoryTests
|
|||||||
|
|
||||||
builder.Services.AddDbRepository<MockDbContext, User>(context => context.Users);
|
builder.Services.AddDbRepository<MockDbContext, User>(context => context.Users);
|
||||||
|
|
||||||
|
builder.Services.AddAutoMapper(Assembly.GetExecutingAssembly());
|
||||||
|
|
||||||
_host = builder.Build();
|
_host = builder.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user