コード例 #1
0
        public void When_Shoe_Is_Created_Card_Count_Should_Be_A_Multiple_Of_Fifty_Two()
        {
            var numberOfDecks = new Random().Next(1, 5);

            _sut = new ShoeOfStandardDecksOfCards(_cardValueAssigner, numberOfDecks);

            Assert.AreEqual(0, _sut.Cards.Count % EXPECTED_MULTIPLE_SIZE);
        }
コード例 #2
0
        public ITableSimulation CreateTableSimulationFrom(SimulationProperties simulationProperties)
        {
            Validate(simulationProperties);

            var tableSettings = new TableSettings(simulationProperties.MinimumBetForTable,
                                                  simulationProperties.MaximumBetForTable, simulationProperties.MaximumPlayersForTable);
            var cardDeck        = new ShoeOfStandardDecksOfCards(new BlackjackCardValueAssigner(), simulationProperties.NumberOfDecksInShoe);
            var dealer          = new Dealer(cardDeck, new GameManager(), new StandardDealerStrategy());
            var tableSimulation = new TableSimulation(dealer, tableSettings);

            foreach (var playerProperties in simulationProperties.PlayerPropertiesCollection)
            {
                var strategy = (IPlayerStrategy)playerProperties.PlayerStrategy.GetConstructors()[0].Invoke(null);
                var player   = new Player(playerProperties.StartingCash, strategy);
                tableSimulation.Seat(player);
            }

            return(tableSimulation);
        }