Skip to content

Commit

Permalink
Merge pull request #2753 from planetarium/feature/fix-unlockruneslottest
Browse files Browse the repository at this point in the history
Feature/fix unlockruneslottest
  • Loading branch information
eugene-doobu authored Aug 16, 2024
2 parents cc420c8 + f1b6b04 commit 5f3cf7d
Showing 1 changed file with 5 additions and 40 deletions.
45 changes: 5 additions & 40 deletions .Lib9c.Tests/Action/UnlockRuneSlotTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,19 @@ namespace Lib9c.Tests.Action

public class UnlockRuneSlotTest
{
private readonly Currency _goldCurrency;

public UnlockRuneSlotTest()
{
_goldCurrency = Currency.Legacy("NCG", 2, null);
}
private readonly Currency _goldCurrency = Currency.Legacy("NCG", 2, null);

// ReSharper disable once MemberCanBePrivate.Global
public IWorld Init(out Address agentAddress, out Address avatarAddress, out long blockIndex)
{
agentAddress = new PrivateKey().Address;
avatarAddress = new PrivateKey().Address;
var sheets = TableSheetsImporter.ImportSheets();
var tableSheets = new TableSheets(sheets);
blockIndex = tableSheets.WorldBossListSheet.Values
.OrderBy(x => x.StartedBlockIndex)
blockIndex = tableSheets.ArenaSheet.Values.First().Round
.OrderBy(x => x.StartBlockIndex)
.First()
.StartedBlockIndex;
.StartBlockIndex;

var goldCurrencyState = new GoldCurrencyState(_goldCurrency);
var state = new World(MockUtil.MockModernWorldState)
Expand All @@ -46,13 +42,6 @@ public IWorld Init(out Address agentAddress, out Address avatarAddress, out long
}

var gameConfigState = new GameConfigState(sheets[nameof(GameConfigSheet)]);
var avatarState = new AvatarState(
avatarAddress,
agentAddress,
0,
tableSheets.GetAvatarSheets(),
default
);
return state.SetLegacyState(gameConfigState.address, gameConfigState.Serialize());
}

Expand Down Expand Up @@ -125,14 +114,6 @@ public void Execute_InsufficientBalanceException()
SlotIndex = 1,
};

var ctx = new ActionContext
{
BlockIndex = blockIndex,
PreviousState = state,
RandomSeed = 0,
Signer = agentAddress,
};

Assert.Throws<InsufficientBalanceException>(() =>
action.Execute(new ActionContext()
{
Expand All @@ -153,14 +134,6 @@ public void Execute_SlotNotFoundException()
SlotIndex = 99,
};

var ctx = new ActionContext
{
BlockIndex = blockIndex,
PreviousState = state,
RandomSeed = 0,
Signer = agentAddress,
};

Assert.Throws<SlotNotFoundException>(() =>
action.Execute(new ActionContext()
{
Expand All @@ -181,14 +154,6 @@ public void Execute_MismatchRuneSlotTypeException()
SlotIndex = 0,
};

var ctx = new ActionContext
{
BlockIndex = blockIndex,
PreviousState = state,
RandomSeed = 0,
Signer = agentAddress,
};

Assert.Throws<MismatchRuneSlotTypeException>(() =>
action.Execute(new ActionContext()
{
Expand Down

0 comments on commit 5f3cf7d

Please sign in to comment.