test(card): SetRedEtherAsync helper for create-path tests
This commit is contained in:
@@ -315,6 +315,20 @@ internal sealed class SVSimTestFactory : WebApplicationFactory<Program>
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the viewer's RedEther balance to <paramref name="amount"/>. Call this AFTER
|
||||
/// <see cref="SeedOwnedCardAsync"/>, which resets RedEther to 0. Create tests use this
|
||||
/// to give the viewer enough vials to craft.
|
||||
/// </summary>
|
||||
public async Task SetRedEtherAsync(long viewerId, ulong amount)
|
||||
{
|
||||
using var scope = Services.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<SVSimDbContext>();
|
||||
var viewer = await db.Viewers.FirstAsync(v => v.Id == viewerId);
|
||||
viewer.Currency.RedEther = amount;
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Puts <paramref name="count"/> copies of <paramref name="cardId"/> into the viewer's deck
|
||||
/// in the given format + slot. Tests use this to set up deck-strip scenarios for /card/destruct.
|
||||
|
||||
Reference in New Issue
Block a user