Exemple #1
0
        public void ExpectNothingToHappenIfCommandNotRollDice(GameCommand command)
        {
            var player = new Mock<IPlayer>();
            var dice = new Mock<IDice>();
            dice.Setup(d => d.Current).Returns(new DiceRoll(new int[] { 3, 4 }));

            var turn = new HighRollTurn(player.Object, dice.Object);
            bool ended = false;
            turn.Ended += (sender, args) => { ended = true; };

            turn.AfterExecute(command);

            Assert.Equal(0, turn.Result);
            Assert.False(ended);
        }
Exemple #2
0
        public void ExpectResultToBeSetOnAfterExecute()
        {
            var player = new Mock<IPlayer>();
            var dice = new Mock<IDice>();
            dice.Setup(d => d.Current).Returns(new DiceRoll(new int[] { 3, 4 }));

            var turn = new HighRollTurn(player.Object, dice.Object);
            bool ended = false;
            turn.Ended += (sender, args) => { ended = true; };

            turn.AfterExecute(GameCommand.RollDice);

            Assert.Equal(7, turn.Result);
            Assert.True(ended);
        }