Пример #1
0
 public void CardsProvider_ShouldReturnEndlessStreamOfCards([Frozen(As = typeof(IDeckCreator))] FullDeckCreator deckCreator, EndlessCardsProvider cardsProvider)
 {
     for (int i = 0; i < 1000; i++)
     {
         Assert.NotNull(cardsProvider.Deal());
     }
 }
Пример #2
0
 public void NewGameHasNoCards(
     [Frozen(As = typeof(IDeckCreator))] FullDeckCreator deckCreator,
     [Frozen(As = typeof(IEndlessCardsProvider))] EndlessCardsProvider cardsProvider,
     [Frozen(As = typeof(IDealerStrategy))] LeveledDealerStrategy dealerStrategy,
     Game game)
 {
     Assert.Null(game.PlayersCards);
     Assert.Null(game.DealersCards);
 }
Пример #3
0
 public void NewGameHasInitialPositiveMoney(
     [Frozen(As = typeof(IDeckCreator))] FullDeckCreator deckCreator,
     [Frozen(As = typeof(IEndlessCardsProvider))] EndlessCardsProvider cardsProvider,
     [Frozen(As = typeof(IDealerStrategy))] LeveledDealerStrategy dealerStrategy,
     Game game)
 {
     Assert.True(game.PlayerMoney > 0);
     Assert.True(game.DealerMoney > 0);
 }
Пример #4
0
 public void NewRoundHasNoCards(
     [Frozen(As = typeof(IDeckCreator))] FullDeckCreator deckCreator,
     [Frozen(As = typeof(IEndlessCardsProvider))] EndlessCardsProvider cardsProvider,
     [Frozen(As = typeof(IDealerStrategy))] LeveledDealerStrategy dealerStrategy,
     Round round)
 {
     Assert.Null(round.PlayersCards);
     Assert.Null(round.DealersCards);
 }
Пример #5
0
 public void NewRoundIsInCorrectState(
     [Frozen(As = typeof(IDeckCreator))] FullDeckCreator deckCreator,
     [Frozen(As = typeof(IEndlessCardsProvider))] EndlessCardsProvider cardsProvider,
     [Frozen(As = typeof(IDealerStrategy))] LeveledDealerStrategy dealerStrategy,
     Round round)
 {
     Assert.Equal(RoundResults.RoundNotStarted, round.RoundResult);
     Assert.Equal(RoundStates.RoundIsOver, round.RoundState);
 }
Пример #6
0
        public void StartRound_SetsCorrectBet(
            [Frozen(As = typeof(IDeckCreator))] FullDeckCreator deckCreator,
            [Frozen(As = typeof(IEndlessCardsProvider))] EndlessCardsProvider cardsProvider,
            [Frozen(As = typeof(IDealerStrategy))] LeveledDealerStrategy dealerStrategy,
            Game game)
        {
            game.StartRound(2);

            Assert.Equal(2, game.CurrentBet);
        }
Пример #7
0
 public void NewGameIsInCorrectState(
     [Frozen(As = typeof(IDeckCreator))] FullDeckCreator deckCreator,
     [Frozen(As = typeof(IEndlessCardsProvider))] EndlessCardsProvider cardsProvider,
     [Frozen(As = typeof(IDealerStrategy))] LeveledDealerStrategy dealerStrategy,
     Game game)
 {
     Assert.Equal(RoundResults.RoundNotStarted, game.RoundResult);
     Assert.Equal(RoundStates.RoundIsOver, game.RoundState);
     Assert.Equal(GameStates.GameIsInProgress, game.GameState);
 }
Пример #8
0
        public void StartRound_DealsTwoCardsToEachPlayer(
            [Frozen(As = typeof(IDeckCreator))] FullDeckCreator deckCreator,
            [Frozen(As = typeof(IEndlessCardsProvider))] EndlessCardsProvider cardsProvider,
            [Frozen(As = typeof(IDealerStrategy))] LeveledDealerStrategy dealerStrategy,
            Game game)
        {
            game.StartRound(2);

            Assert.Equal(2, game.PlayersCards.Count());
            Assert.Equal(2, game.DealersCards.Count());
        }
        public void Play_ShouldAddCardsUntil17(LeveledDealerStrategy dealerStrategy,
                                               Hand dealerHand,
                                               [Frozen(As = typeof(IDeckCreator))] FullDeckCreator deckCreator,
                                               EndlessCardsProvider cardsProvider)
        {
            dealerStrategy.Play(dealerHand, cardsProvider);

            _outputHelper.WriteLine(string.Join(", ", dealerHand.Cards));

            Assert.True(dealerHand.GetValue() >= 17);
        }