LANCommander/LANCommander.Launcher.IntegrationTests/Helpers/InMemoryDatabaseFactory.cs
Pat Hartl b183e4b18c Remove old launcher, rename Avalonia launcher
Also adds ARM builds for Linux + Windows launcher
2026-06-06 05:49:24 -05:00

21 lines
724 B
C#

using LANCommander.Launcher.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging.Abstractions;
namespace LANCommander.Launcher.IntegrationTests.Helpers;
/// <summary>
/// Direct EF InMemory DatabaseContext for tests that don't need the full launcher DI graph.
/// Each call returns a context bound to a unique in-memory database — fully isolated.
/// </summary>
internal static class InMemoryDatabaseFactory
{
public static DatabaseContext Create()
{
var options = new DbContextOptionsBuilder<DatabaseContext>()
.UseInMemoryDatabase($"launcher-{Guid.NewGuid()}")
.Options;
return new DatabaseContext(NullLoggerFactory.Instance, options);
}
}