Example #1
0
        public void ShouldFreezePlayerAndThenUnfreeze(
            int iterations,
            int expectedIndexPlayer,
            bool shouldFreeze)
        {
            //Arrange
            _dice.
            Setup(_ => _.Roll()).
            Returns(_twoDiceSame);

            var cursor = new PlayerCursor(_players, _dice.Object);

            //Act
            PlayerMove playerMove = null;

            for (var i = 0; i < iterations; i++)
            {
                playerMove = cursor.Next();
            }

            //Assert
            playerMove.Total.Should().Be(shouldFreeze ? 0 : _twoDiceSame.Sum());
            playerMove.Frozen.Should().Be(shouldFreeze);
            playerMove.Player.Should().Be(_players[expectedIndexPlayer]);
        }
Example #2
0
        public void ShouldCyclePlayers(int iterations, int expectedIndexPlayer)
        {
            //Arrange
            _dice.
            Setup(_ => _.Roll()).
            Returns(_twoDiceDifferent);

            var cursor = new PlayerCursor(_players, _dice.Object);

            //Act
            PlayerMove playerMove = null;

            for (var i = 0; i < iterations; i++)
            {
                playerMove = cursor.Next();
            }

            //Assert
            playerMove.Total.Should().Be(_twoDiceDifferent.Sum());
            playerMove.Player.Should().Be(_players[expectedIndexPlayer]);
        }