Skip to content

Commit

Permalink
Merge pull request #2120 from planetarium/release/1.0.0
Browse files Browse the repository at this point in the history
1.0.0 to main
  • Loading branch information
area363 authored Aug 31, 2023
2 parents 3968483 + d55cbce commit 32f22cf
Show file tree
Hide file tree
Showing 31 changed files with 4,197 additions and 573 deletions.
5 changes: 4 additions & 1 deletion .Lib9c.Tests/Action/ActionEvaluationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ private ActionBase GetAction(Type type)
AuthorizedMiners = Dictionary.Empty,
Credits = Dictionary.Empty,
},
ItemEnhancement _ => new ItemEnhancement(),
ItemEnhancement _ => new ItemEnhancement
{
materialIds = new List<Guid>(),
},
MigrationActivatedAccountsState _ => new MigrationActivatedAccountsState(),
MigrationAvatarState _ => new MigrationAvatarState
{
Expand Down
73 changes: 56 additions & 17 deletions .Lib9c.Tests/Action/BattleArena12Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public void Execute_Backward_Compatibility_Success()
[Fact]
public void Execute_InvalidAddressException()
{
var action = new BattleArena
var action = new BattleArena12
{
myAvatarAddress = _avatar1Address,
enemyAvatarAddress = _avatar1Address,
Expand All @@ -218,7 +218,7 @@ public void Execute_InvalidAddressException()
[Fact]
public void Execute_FailedLoadStateException()
{
var action = new BattleArena
var action = new BattleArena12
{
myAvatarAddress = _avatar2Address,
enemyAvatarAddress = _avatar1Address,
Expand All @@ -241,7 +241,7 @@ public void Execute_FailedLoadStateException()
[Fact]
public void Execute_NotEnoughClearedStageLevelException()
{
var action = new BattleArena
var action = new BattleArena12
{
myAvatarAddress = _avatar4Address,
enemyAvatarAddress = _avatar2Address,
Expand All @@ -266,11 +266,11 @@ public void Execute_NotEnoughClearedStageLevelException()
[Fact]
public void Execute_SheetRowNotFoundException()
{
var action = new BattleArena
var action = new BattleArena12
{
myAvatarAddress = _avatar1Address,
enemyAvatarAddress = _avatar2Address,
championshipId = 9999999,
championshipId = 0,
round = 1,
ticket = 1,
costumes = new List<Guid>(),
Expand All @@ -289,7 +289,7 @@ public void Execute_SheetRowNotFoundException()
[Fact]
public void Execute_ThisArenaIsClosedException()
{
var action = new BattleArena
var action = new BattleArena12
{
myAvatarAddress = _avatar1Address,
enemyAvatarAddress = _avatar2Address,
Expand All @@ -313,7 +313,7 @@ public void Execute_ThisArenaIsClosedException()
[Fact]
public void Execute_ArenaParticipantsNotFoundException()
{
var action = new BattleArena
var action = new BattleArena12
{
myAvatarAddress = _avatar1Address,
enemyAvatarAddress = _avatar2Address,
Expand Down Expand Up @@ -374,7 +374,7 @@ public void Execute_AddressNotFoundInArenaParticipantsException(bool excludeMe)
round,
random);

var action = new BattleArena
var action = new BattleArena12
{
myAvatarAddress = _avatar1Address,
enemyAvatarAddress = _avatar2Address,
Expand Down Expand Up @@ -444,7 +444,7 @@ public void Execute_ValidateScoreDifferenceException(bool isSigner)
arenaScore.AddScore(900);
previousStates = previousStates.SetState(arenaScoreAdr, arenaScore.Serialize());

var action = new BattleArena
var action = new BattleArena12
{
myAvatarAddress = _avatar1Address,
enemyAvatarAddress = _avatar2Address,
Expand Down Expand Up @@ -513,7 +513,7 @@ public void Execute_InsufficientBalanceException()
beforeInfo.UseTicket(beforeInfo.Ticket);
previousStates = previousStates.SetState(arenaInfoAdr, beforeInfo.Serialize());

var action = new BattleArena
var action = new BattleArena12
{
myAvatarAddress = _avatar1Address,
enemyAvatarAddress = _avatar2Address,
Expand Down Expand Up @@ -579,7 +579,7 @@ public void Execute_ExceedPlayCountException()
throw new ArenaInformationNotFoundException($"arenaInfoAdr : {arenaInfoAdr}");
}

var action = new BattleArena
var action = new BattleArena12
{
myAvatarAddress = _avatar1Address,
enemyAvatarAddress = _avatar2Address,
Expand Down Expand Up @@ -659,7 +659,7 @@ public void Execute_ExceedTicketPurchaseLimitException()
previousStates.GetGoldCurrency());
previousStates = previousStates.MintAsset(context, _agent1Address, price);

var action = new BattleArena
var action = new BattleArena12
{
myAvatarAddress = _avatar1Address,
enemyAvatarAddress = _avatar2Address,
Expand Down Expand Up @@ -744,7 +744,7 @@ public void Execute_ExceedTicketPurchaseLimitDuringIntervalException()
previousStates.GetGoldCurrency());
previousStates = previousStates.MintAsset(context, _agent1Address, price);

var action = new BattleArena
var action = new BattleArena12
{
myAvatarAddress = _avatar1Address,
enemyAvatarAddress = _avatar2Address,
Expand Down Expand Up @@ -823,7 +823,7 @@ public void Execute_CoolDownBlockException()
beforeInfo.BuyTicket(roundData.MaxPurchaseCount);
}

var action = new BattleArena
var action = new BattleArena12
{
myAvatarAddress = _avatar1Address,
enemyAvatarAddress = _avatar2Address,
Expand Down Expand Up @@ -922,7 +922,7 @@ public void ExecuteDuplicatedException(int slotIndex, int runeId, int slotIndex2
Random = new TestRandom(),
});

var action = new BattleArena
var action = new BattleArena12
{
myAvatarAddress = _avatar1Address,
enemyAvatarAddress = _avatar2Address,
Expand Down Expand Up @@ -1041,7 +1041,7 @@ public void Execute_ValidateDuplicateTicketPurchaseException()
previousStates.GetGoldCurrency());
previousStates = previousStates.MintAsset(context, _agent1Address, price);

var action = new BattleArena
var action = new BattleArena12
{
myAvatarAddress = _avatar1Address,
enemyAvatarAddress = _avatar2Address,
Expand All @@ -1063,6 +1063,45 @@ public void Execute_ValidateDuplicateTicketPurchaseException()
}));
}

[Fact]
public void Execute_Throw_ActionObsoleteException()
{
var action = new BattleArena12
{
myAvatarAddress = _avatar1Address,
enemyAvatarAddress = _avatar2Address,
championshipId = 6,
round = 2,
ticket = 1,
costumes = new List<Guid>(),
equipments = new List<Guid>(),
runeInfos = new List<RuneSlotInfo>(),
};

// Unavailable round
Assert.Throws<ActionObsoletedException>(() => action.Execute(new ActionContext
{
Signer = _agent1Address,
BlockIndex = 1L,
}));

action.championshipId = 7;
action.round = 1;
// Unavailable championship
Assert.Throws<ActionObsoletedException>(() => action.Execute(new ActionContext
{
Signer = _agent1Address,
BlockIndex = 1L,
}));

// Unavailable block index
Assert.Throws<ActionObsoletedException>(() => action.Execute(new ActionContext
{
Signer = _agent1Address,
BlockIndex = 7_716_401L,
}));
}

private static (AgentState AgentState, AvatarState AvatarState) GetAgentStateWithAvatarState(
IReadOnlyDictionary<string, string> sheets,
TableSheets tableSheets,
Expand Down Expand Up @@ -1157,7 +1196,7 @@ private void Execute(
}
}

var action = new BattleArena
var action = new BattleArena12
{
myAvatarAddress = myAvatarAddress,
enemyAvatarAddress = enemyAvatarAddress,
Expand Down
Loading

0 comments on commit 32f22cf

Please sign in to comment.