public void Execute() { var dailyRewardAction = new DailyReward2 { avatarAddress = _avatarAddress, }; var nextState = dailyRewardAction.Execute(new ActionContext { BlockIndex = 0, PreviousStates = _initialState, Random = new TestRandom(), Rehearsal = false, Signer = _agentAddress, }); var gameConfigState = nextState.GetGameConfigState(); var nextAvatarState = nextState.GetAvatarState(_avatarAddress); Assert.Equal(gameConfigState.ActionPointMax, nextAvatarState.actionPoint); Assert.Single(nextAvatarState.mailBox); var mail = nextAvatarState.mailBox.First(); var rewardMail = mail as DailyRewardMail; Assert.NotNull(rewardMail); var rewardResult = rewardMail.attachment as DailyReward2.DailyRewardResult; Assert.NotNull(rewardResult); Assert.Single(rewardResult.materials); var material = rewardResult.materials.First(); Assert.Equal(400000, material.Key.Id); Assert.Equal(10, material.Value); }
public void ExecuteThrowFailedLoadStateException() { var action = new DailyReward2 { avatarAddress = _avatarAddress, }; Assert.Throws <FailedLoadStateException>(() => action.Execute(new ActionContext() { PreviousStates = new State(), Signer = _agentAddress, BlockIndex = 0, }) ); }
public void Execute() { var dailyRewardAction = new DailyReward2 { avatarAddress = _avatarAddress, }; var nextState = dailyRewardAction.Execute(new ActionContext { BlockIndex = 0, PreviousStates = _initialState, Rehearsal = false, Signer = _agentAddress, }); var gameConfigState = nextState.GetGameConfigState(); var nextAvatarState = nextState.GetAvatarState(_avatarAddress); Assert.Equal(gameConfigState.ActionPointMax, nextAvatarState.actionPoint); }