From a851e6aa20fca3380b510fcfd06ea367a59fb52d Mon Sep 17 00:00:00 2001 From: gamer147 Date: Thu, 28 May 2026 01:01:26 -0400 Subject: [PATCH] test(card): SetRedEtherAsync helper for create-path tests --- SVSim.UnitTests/Infrastructure/SVSimTestFactory.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/SVSim.UnitTests/Infrastructure/SVSimTestFactory.cs b/SVSim.UnitTests/Infrastructure/SVSimTestFactory.cs index 08bddeb..ba6b73e 100644 --- a/SVSim.UnitTests/Infrastructure/SVSimTestFactory.cs +++ b/SVSim.UnitTests/Infrastructure/SVSimTestFactory.cs @@ -315,6 +315,20 @@ internal sealed class SVSimTestFactory : WebApplicationFactory await db.SaveChangesAsync(); } + /// + /// Sets the viewer's RedEther balance to . Call this AFTER + /// , which resets RedEther to 0. Create tests use this + /// to give the viewer enough vials to craft. + /// + public async Task SetRedEtherAsync(long viewerId, ulong amount) + { + using var scope = Services.CreateScope(); + var db = scope.ServiceProvider.GetRequiredService(); + var viewer = await db.Viewers.FirstAsync(v => v.Id == viewerId); + viewer.Currency.RedEther = amount; + await db.SaveChangesAsync(); + } + /// /// Puts copies of into the viewer's deck /// in the given format + slot. Tests use this to set up deck-strip scenarios for /card/destruct.