예제 #1
0
        public void GivenTheDealersHandContainsTheFollowingCards(Table table)
        {
            var mapper = new TableObjectMapper();
            var game_builder = new GameBuilder().find_game_by_player_id(PlayerToken.player_id);
            var cards = new List<CardInHandRow>();
            foreach (var row in table.Rows)
                cards.Add(mapper.create_card_in_hand_row_from(row));

            game_builder.add_cards_to_dealers_hand(cards);

            var game = game_builder.build();

            DataBaseHelper.save_or_add(game);
        }
예제 #2
0
        public void GivenIHaveStartedANewGameAndBet(decimal bet_amount)
        {            
            var game = new GameBuilder().create_for(PlayerToken.player_id)
                                         .add_dealers_hand()
                                            .with_status_of(HandStatus.in_play)
                                            .build()
                                         .add_hand_with_bet_of(bet_amount)
                                            .with_status_of(HandStatus.in_play)
                                            .set_as_active()
                                            .build()                                        
                                        .set_game_state_to(TableStatus.full_table)
                                        .build();

            DataBaseHelper.save_or_add(game);                             
        }
예제 #3
0
        public void GivenTheDeckContainsTheFollowingCards(Table table)
        {
            var mapper = new TableObjectMapper();
            var game_builder = new GameBuilder().find_game_by_player_id(PlayerToken.player_id);

            int card_position = 1;
            foreach(var row in table.Rows)
            {                
                game_builder.add_to_deck(mapper.create_deck_row_from(row, card_position));
                card_position++;
            }            

            var game = game_builder.build();

            DataBaseHelper.save_or_add<BlackJackTableRow>(game);
        }
 public DealersHandBuilder(HandTableRow hand_table_row, GameBuilder game_builder)
 {
     _hand_table_row = hand_table_row;
     _game_builder = game_builder;            
 }
 public DealersHandBuilder(HandTableRow hand_table_row, GameBuilder game_builder)
 {
     _hand_table_row = hand_table_row;
     _game_builder   = game_builder;
 }
예제 #6
0
        public void GivenIHaveBeenDealtMyInitalTwoCards()
        {
            var game_builder = new GameBuilder().find_game_by_player_id(PlayerToken.player_id);

            var game = game_builder.set_game_state_to(TableStatus.hands_dealt)
                                    .mark_cards_as_dealt()
                                    .add_dealers_hand()
                                        .with_status_of(HandStatus.in_play)                                           
                                        .build()
                                    .build();
                                                    
            DataBaseHelper.save_or_add(game);
        }