示例#1
0
 public void CreateNewPlayers_ShouldCreateUniquePlayers()
 {
     IGameService gameService = new GameService();
     var players = gameService.CreateNewPlayers();
     var distinctPlayers = players.Select(p => p.Name).Distinct().ToList();
     Assert.IsTrue(distinctPlayers.Count == ExpectedPlayerCount);
 }
示例#2
0
        public void DealCards_ShouldReturnCorrectCardCountForEachPlayer()
        {
            IGameService gameService = new GameService();
            var deckOfCards = gameService.GetNewDeck();
            var players = gameService.CreateNewPlayers();

            gameService.DealCards(deckOfCards, players);

            foreach (var player in players)
            {
                Assert.IsTrue(player.Cards.Count == ExpectedCardsPerPlayer);
            }
        }
示例#3
0
        public void StartNewGame_ShouldReturnPlayersAndCards()
        {
            IGameService gameService = new GameService();
            gameService.StartNewGame();
            var dealtCards = new List<Card>();
            foreach (var player in gameService.Game.Players)
            {

                dealtCards.AddRange(player.Cards);

            }
            var uniqueCards = dealtCards.Select(c => c.Id).Distinct();
            Assert.IsTrue(uniqueCards.Count() == ExpectedTotalCards);
        }
示例#4
0
        public void DealCards_ShouldReturnNoDuplicates()
        {
            IGameService gameService = new GameService();
            var deckOfCards = gameService.GetNewDeck();
            var players = gameService.CreateNewPlayers();

            gameService.DealCards(deckOfCards, players);
            var dealtCards = new List<Card>();
            foreach (var player in players)
            {

                dealtCards.AddRange(player.Cards);
                
            }
            var uniqueCards = dealtCards.Select(c => c.Id).Distinct();
            Assert.IsTrue(uniqueCards.Count() == ExpectedTotalCards);
        }
示例#5
0
 public Game StartNewGame()
 {
     IGameService gameService = new GameService();
     gameService.StartNewGame();
     return gameService.Game;
 }
示例#6
0
 public void GetNewDeck_ShouldReturnAllCards()
 {
     IGameService gameService = new GameService();
     var cards = gameService.GetNewDeck();
     Assert.IsTrue(cards.Count == ExpectedTotalCards);
 }
示例#7
0
 public void CreateNewPlayers_ShouldCreateNewPlayers()
 {
     IGameService gameService = new GameService();
     var players = gameService.CreateNewPlayers();
     Assert.IsTrue(players.Count == ExpectedPlayerCount);   
 }