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

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

            player.Join(game);

            Assert.True(player.IsInGame);
        }
Esempio 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));
        }
Esempio 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);
        }
Esempio 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);
        }
Esempio 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);
        }
Esempio n. 7
0
 public PlayerBuilder InGame(RollDiceGame game)
 {
     player.Join(game);
     return(this);
 }
Esempio n. 8
0
 public GameBuilder FakeGameWithScore(int score)
 {
     _game = new RollDiceGameFake(score);
     return(this);
 }