Example #1
0
        public DefaultSnapGameType(ICardDealerLogic cardDealer, ICardCollectionFactory cardCollectionFactory)
        {
            Check.NotNull(cardDealer, "cardDealer");
            Check.NotNull(cardCollectionFactory, "cardCollectionFactory");

            var decksOfPlayers = cardDealer.DealCards(PlayerCount);

            Players = new List <ICardGamePlayer>()
            {
                new Player("Ray", decksOfPlayers[0], cardCollectionFactory.CreateCardCollection()),
                new Player("Lucy", decksOfPlayers[1], cardCollectionFactory.CreateCardCollection()),
                new Player("Steve", decksOfPlayers[2], cardCollectionFactory.CreateCardCollection()),
                new Player("Player 1", decksOfPlayers[3], cardCollectionFactory.CreateCardCollection()),
            };

            DealingLogic = cardDealer;
        }
        private static void SetupMocks(out IUnitySnapBehavior snapBehavior, out IGameTurnManager gameTurnManager,
                                       out ISlapjackGame game, out ICardDealerLogic cardDealerLogic)
        {
            snapBehavior = Substitute.For <IUnitySnapBehavior>();
            snapBehavior.TurnUpCard(Arg.Any <ICardObject>()).Returns(true);

            gameTurnManager = SetupTurnManagerMock();
            var player = gameTurnManager.PlayerTurnManager.PlayerTurns.First().AssociatedPlayer;

            game = Substitute.For <ISlapjackGame>();
            game.Players.Returns(new List <ICardGamePlayer>()
            {
                player
            });

            cardDealerLogic = Substitute.For <ICardDealerLogic>();
            cardDealerLogic.DealCards(Arg.Any <int>()).Returns(new List <ICardCollection>());
        }