Initial build: WishNinja self-hosted gift wishlist manager
ASP.NET Core Blazor (.NET 10) + EF Core/SQLite + Identity. Features: - Wishlists & items with local image storage (upload, clipboard paste, or URL fetched and stored locally) - Owner-hidden claims (enforced at the query layer) to preserve surprises - Admin-invite-only onboarding with email-based password resets - All state under /data; ships as a single Docker image Includes Dockerfile, docker-compose, Gitea Actions CI (test + push image), Unraid template, and xUnit tests (claim privacy, invite lifecycle, image validation). Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WishNinja.Data;
|
||||
|
||||
namespace WishNinja.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="IDbContextFactory{TContext}"/> backed by a single shared in-memory SQLite
|
||||
/// connection, so data written by one context is visible to the next. Dispose to tear down.
|
||||
/// </summary>
|
||||
public sealed class TestDb : IDbContextFactory<ApplicationDbContext>, IDisposable
|
||||
{
|
||||
private readonly SqliteConnection _connection;
|
||||
private readonly DbContextOptions<ApplicationDbContext> _options;
|
||||
|
||||
public TestDb()
|
||||
{
|
||||
_connection = new SqliteConnection("DataSource=:memory:");
|
||||
_connection.Open();
|
||||
_options = new DbContextOptionsBuilder<ApplicationDbContext>()
|
||||
.UseSqlite(_connection)
|
||||
.Options;
|
||||
using var ctx = CreateDbContext();
|
||||
ctx.Database.EnsureCreated();
|
||||
}
|
||||
|
||||
public ApplicationDbContext CreateDbContext() => new(_options);
|
||||
|
||||
public void Dispose() => _connection.Dispose();
|
||||
}
|
||||
Reference in New Issue
Block a user