refactor(arena-two-pick): route entry/finish through InventoryService
Replace RewardGrantService + ICurrencySpendService + IViewerEntitlements with IInventoryService. tx.IsFreeplay replaces FakeEntitlements.IsFreeplay; debit helpers take IInventoryTransaction. ComputePostStateRewardList deleted (replaced by result.RewardList from CommitAsync). Update 5 test files to new 8-arg ctor. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ using SVSim.Database.Models;
|
||||
using SVSim.Database.Repositories.Globals;
|
||||
using SVSim.Database.Repositories.Viewer;
|
||||
using SVSim.Database.Services;
|
||||
using SVSim.Database.Services.Inventory;
|
||||
using SVSim.EmulatedEntrypoint.Services;
|
||||
using SVSim.UnitTests.Infrastructure;
|
||||
|
||||
@@ -25,19 +26,6 @@ public class ArenaTwoPickServiceDraftTests
|
||||
};
|
||||
}
|
||||
|
||||
private sealed class FakeEntitlements : IViewerEntitlements
|
||||
{
|
||||
public bool IsFreeplay { get; init; }
|
||||
|
||||
public long EffectiveBalance(SVSim.Database.Models.Viewer viewer, SpendCurrency currency) => 0;
|
||||
public bool OwnsCard(SVSim.Database.Models.Viewer viewer, long cardId) => IsFreeplay;
|
||||
public bool OwnsCosmetic(SVSim.Database.Models.Viewer viewer, CosmeticType type, int id) => IsFreeplay;
|
||||
public Task<IReadOnlyList<OwnedCardEntry>> EffectiveOwnedCardsAsync(SVSim.Database.Models.Viewer viewer, CancellationToken ct = default)
|
||||
=> Task.FromResult<IReadOnlyList<OwnedCardEntry>>(new List<OwnedCardEntry>());
|
||||
public Task<EffectiveCosmetics> EffectiveCosmeticsAsync(SVSim.Database.Models.Viewer viewer, CancellationToken ct = default)
|
||||
=> throw new NotSupportedException();
|
||||
}
|
||||
|
||||
private static async Task<(IArenaTwoPickService, IArenaTwoPickRunRepository, long viewerId)> SetupWithActiveRunAsync(int classChosen = 0)
|
||||
{
|
||||
var factory = new SVSimTestFactory();
|
||||
@@ -73,11 +61,9 @@ public class ArenaTwoPickServiceDraftTests
|
||||
new FakePool(),
|
||||
scope.ServiceProvider.GetRequiredService<IGameConfigService>(),
|
||||
scope.ServiceProvider.GetRequiredService<IViewerRepository>(),
|
||||
scope.ServiceProvider.GetRequiredService<RewardGrantService>(),
|
||||
new FakeEntitlements(),
|
||||
scope.ServiceProvider.GetRequiredService<IInventoryService>(),
|
||||
new SystemRandom(seed: 1),
|
||||
db,
|
||||
scope.ServiceProvider.GetRequiredService<ICurrencySpendService>());
|
||||
db);
|
||||
|
||||
return (svc, runs, 7);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user