Example #1
0
        public void ExpectCanExecuteAlwaysFalseIfIfTurnNotStarted(GameCommand command)
        {
            var player = new Mock<IPlayer>();
            var provider = new Mock<IStateProvider>();

            var turn = new Turn(player.Object, provider.Object);
            Assert.False(turn.CanExecute(command));
        }
Example #2
0
        public void CanExecuteIfCurrentStateHasCommand(GameCommand command, IEnumerable<GameCommand> stateCommands, bool expected)
        {
            var player = new Mock<IPlayer>();
            var state = new Mock<ITurnState>();
            state.Setup(s => s.Commands).Returns(stateCommands);
            var provider = new Mock<IStateProvider>();
            provider.Setup(p => p.HasNext()).Returns(true);
            provider.Setup(p => p.GetNext()).Returns(state.Object);

            var turn = new Turn(player.Object, provider.Object);
            turn.NextFlowState();

            bool result = turn.CanExecute(command);

            Assert.Equal(expected, result);
        }