feat(gift): add GiftRewardTypes supported-set helper

Centralizes which UserGoodsType values IInventoryTransaction.GrantAsync
can handle in the gift-inbox flow; both GiftController (post-fix) and
CampaignController will consult this instead of duplicating the set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-09 20:39:10 -04:00
parent 0d32d2167b
commit 366a71688d
2 changed files with 85 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
using SVSim.Database.Enums;
using SVSim.EmulatedEntrypoint.Services;
namespace SVSim.UnitTests.Services;
public class GiftRewardTypesTests
{
[TestCase(UserGoodsType.Crystal)]
[TestCase(UserGoodsType.Rupy)]
[TestCase(UserGoodsType.RedEther)]
[TestCase(UserGoodsType.SpotCardPoint)]
[TestCase(UserGoodsType.Item)]
[TestCase(UserGoodsType.Card)]
[TestCase(UserGoodsType.Sleeve)]
[TestCase(UserGoodsType.Emblem)]
[TestCase(UserGoodsType.Degree)]
[TestCase(UserGoodsType.Skin)]
[TestCase(UserGoodsType.MyPageBG)]
public void IsSupported_returns_true_for_inventory_service_grant_set(UserGoodsType type)
{
Assert.That(GiftRewardTypes.IsSupported(type), Is.True);
}
[TestCase(UserGoodsType.SpotCard)]
[TestCase(UserGoodsType.SpotCardOnlyLatestCardPack)]
[TestCase(UserGoodsType.FreeGachaCount)]
public void IsSupported_returns_false_for_inventory_service_unsupported_types(UserGoodsType type)
{
Assert.That(GiftRewardTypes.IsSupported(type), Is.False);
}
[TestCase(1, ExpectedResult = true)] // RedEther
[TestCase(2, ExpectedResult = true)] // Crystal
[TestCase(3, ExpectedResult = false)] // gap in UserGoodsType enum
[TestCase(4, ExpectedResult = true)] // Item
[TestCase(11, ExpectedResult = false)] // SpotCard
[TestCase(14, ExpectedResult = false)] // FreeGachaCount
[TestCase(15, ExpectedResult = true)] // MyPageBG
[TestCase(99, ExpectedResult = false)] // out of range
[TestCase(-1, ExpectedResult = false)] // negative
public bool IsSupported_int_overload_validates_enum_definition(int wireType) =>
GiftRewardTypes.IsSupported(wireType);
}