Skip to content

Commit

Permalink
Merge branch 'development' into v200250-latest-data
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene-doobu authored Dec 13, 2024
2 parents 24aedd5 + af4013a commit 14283af
Show file tree
Hide file tree
Showing 48 changed files with 9,016 additions and 97 deletions.
64 changes: 64 additions & 0 deletions .Lib9c.Tests/Action/BattleArenaTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,70 @@ public void Execute_ValidateDuplicateTicketPurchaseException()
}));
}

[Fact]
public void ExecuteRuneNotFoundException()
{
var previousStates = _initialStates;
var context = new ActionContext();
Assert.True(
previousStates.GetSheet<ArenaSheet>().TryGetValue(
1,
out var row));

if (!row.TryGetRound(1, out var roundData))
{
throw new RoundNotFoundException(
$"[{nameof(BattleArena)}] ChampionshipId({row.ChampionshipId}) - round({1})");
}

if (roundData.ArenaType != ArenaType.OffSeason)
{
throw new InvalidSeasonException(
$"[{nameof(BattleArena)}] This test is only for OffSeason. ArenaType : {roundData.ArenaType}");
}

var random = new TestRandom();
previousStates = JoinArena(
context,
previousStates,
_agent1Address,
_avatar1Address,
roundData.StartBlockIndex,
1,
1,
random);
previousStates = JoinArena(
context,
previousStates,
_agent2Address,
_avatar2Address,
roundData.StartBlockIndex,
1,
1,
random);

var action = new BattleArena
{
myAvatarAddress = _avatar1Address,
enemyAvatarAddress = _avatar2Address,
championshipId = 1,
round = 1,
ticket = 1,
costumes = new List<Guid>(),
equipments = new List<Guid>(),
runeInfos = new List<RuneSlotInfo> { new (0, 10035), },
};
Assert.Throws<RuneNotFoundException>(
() => action.Execute(
new ActionContext
{
BlockIndex = roundData.StartBlockIndex + 1,
PreviousState = previousStates,
Signer = _agent1Address,
RandomSeed = 0,
}));
}

[Theory]
[InlineData(8, null)]
[InlineData(100, null)]
Expand Down
Loading

0 comments on commit 14283af

Please sign in to comment.