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); }
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); } }
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); }
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); }
public Game StartNewGame() { IGameService gameService = new GameService(); gameService.StartNewGame(); return gameService.Game; }
public void GetNewDeck_ShouldReturnAllCards() { IGameService gameService = new GameService(); var cards = gameService.GetNewDeck(); Assert.IsTrue(cards.Count == ExpectedTotalCards); }
public void CreateNewPlayers_ShouldCreateNewPlayers() { IGameService gameService = new GameService(); var players = gameService.CreateNewPlayers(); Assert.IsTrue(players.Count == ExpectedPlayerCount); }