Add project reference for TeleWave.Infrastructure: include TeleWave.Infrastructure.csproj in TeleWave.Application.Tests project to support additional testing capabilities.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using TeleWave.Infrastructure.Persistence;
|
||||
|
||||
namespace TeleWave.Application.Tests.Support;
|
||||
|
||||
/// <summary>
|
||||
/// Общий InMemory-стенд поверх реального <see cref="AppDbContext"/> (с настоящими EF-конфигурациями).
|
||||
/// Каждый экземпляр — своя изолированная БД; <see cref="New"/> отдаёт новый контекст на ту же БД,
|
||||
/// чтобы можно было перечитать сохранённое свежим контекстом.
|
||||
/// </summary>
|
||||
internal sealed class TestDb
|
||||
{
|
||||
private readonly string _name = $"tw-{Guid.NewGuid():N}";
|
||||
|
||||
public AppDbContext New() =>
|
||||
new(new DbContextOptionsBuilder<AppDbContext>().UseInMemoryDatabase(_name).Options);
|
||||
}
|
||||
Reference in New Issue
Block a user