Esempio n. 1
0
        private TableSimulation GetTableSimulationWithMaximumPlayerCountOf(int tableMaximum)
        {
            var tableSettings = new TableSettings(10, 100, tableMaximum);
            var sut           = new TableSimulation(_mockDealer.Object, tableSettings);

            return(sut);
        }
Esempio n. 2
0
        public void When_Table_Simulator_Created_Should_Give_Table_Settings_To_Dealer()
        {
            var tableSettings = new TableSettings(10, 100, 1);
            var dealer        = new Dealer(new Mock <IGroupOfCards>().Object,
                                           new Mock <IGameManager>().Object, new Mock <IDealerStrategy>().Object);
            var sut = new TableSimulation(dealer, tableSettings);

            Assert.AreSame(tableSettings, dealer.TableSettings);
        }
Esempio n. 3
0
        public void When_Running_Simulation_Should_Tell_Dealer_To_Play_Until_Registered_Players_Are_Empty()
        {
            var strictDealerMock = new Mock <IDealer>(MockBehavior.Strict);
            var tableSettings    = new TableSettings(10, 100, 2);

            strictDealerMock.Setup(sdm => sdm.SetTableSettingsWith(tableSettings));
            var sut        = new TableSimulation(strictDealerMock.Object, tableSettings);
            var mockPlayer = new Mock <IPlayer>();

            sut.Seat(mockPlayer.Object);

            strictDealerMock.SetupSequence(sdm => sdm.RegisteredPlayers)
            .Returns(new List <IPlayer> {
                mockPlayer.Object
            })
            .Returns(new List <IPlayer>());
            strictDealerMock.Setup(sdm => sdm.PlaySingleGame());

            sut.RunSimulationUntilAllPlayersUnregister();
        }