Exemplo n.º 1
0
        public void SeventhPlayerCanNotJoinAGame()
        {
            RollDiceGame game    = Create.Game.With(6.Players());
            var          player7 = new Player();

            Assert.Catch <TooManyPlayersException>(() => player7.Join(game));
        }
Exemplo n.º 2
0
        public void Join_IsInGame()
        {
            var player = new Player();
            var game   = new RollDiceGame();

            player.Join(game);

            Assert.True(player.IsInGame);
        }
Exemplo n.º 3
0
        public void JoinTheSameGame_AlreadyInGame_ThrowsInvalidOperationException()
        {
            var player = new Player();
            var game   = new RollDiceGame();

            player.Join(game);

            Assert.Catch <InvalidOperationException>(() =>
                                                     player.Join(game));
        }
Exemplo n.º 4
0
        public void TwoPlayersCanJoinAGame()
        {
            var game = new RollDiceGame();

            new Player().Join(game);
            var player = new Player();

            player.Join(game);

            Assert.True(player.IsInGame);
        }
Exemplo n.º 5
0
        public void CanBetMoreThanOne_Player_Bet() // 2.4
        {
            var game   = new RollDiceGame();
            var player = Create.Player().In(game).WithChips(600).WithBets(new int[] { 1, 2, 3, 4, 5, 6 }).Please();

            int playerChips = player.availableChips.Amount;

            game.Play(new Dice());

            Assert.AreEqual(6 * 100 + playerChips, player.availableChips.Amount);
        }
Exemplo n.º 6
0
        public void CanJoinGame_AfterLeavingPreviousGame()
        {
            var player = new Player();
            var game   = new RollDiceGame();

            player.Join(game);
            player.LeaveGame();

            player.Join(game);

            Assert.True(player.IsInGame);
        }
Exemplo n.º 7
0
 public PlayerBuilder InGame(RollDiceGame game)
 {
     player.Join(game);
     return(this);
 }
Exemplo n.º 8
0
 public GameBuilder FakeGameWithScore(int score)
 {
     _game = new RollDiceGameFake(score);
     return(this);
 }