public void DeckSizePersistedThroughTheGame() { var cardGameService = new CardGameService(_gameRules); while (!cardGameService.GameEnded) { cardGameService.DrawCard(); cardGameService.CalculateDrawOutcome(); Assert.Equal(_gameRules.DeckSize, cardGameService.Players.Sum(p => p.Total)); } }
public void SecondPlayerWinTheGame() { var cardGameService = new CardGameService(_gameRules); cardGameService.Players[0].Deck = new Stack <int>(new int[] { 1, 2, 3, 4, 5, 6 }); cardGameService.Players[1].Deck = new Stack <int>(new int[] { 1, 2, 10, 4, 5, 6 }); while (!cardGameService.GameEnded) { cardGameService.DrawCard(); cardGameService.CalculateDrawOutcome(); } Assert.Equal(cardGameService.Players[1], cardGameService.Winner); }
public void FirstPlayerWin2Cards() { var cardGameService = new CardGameService(_gameRules); cardGameService.Players[0].Deck = new Stack <int>(new int[] { 1, 2, 3, 4, 10 }); cardGameService.Players[1].Deck = new Stack <int>(new int[] { 1, 2, 3, 4, 5 }); cardGameService.DrawCard(); cardGameService.CalculateDrawOutcome(); var expected = new List <int> { 5, 10 }; Assert.Equal(expected, cardGameService.Players[0].Discard.OrderBy(x => x)); }
public void FirstPlayerWin6Cards() { var cardGameService = new CardGameService(_gameRules); cardGameService.Players[0].Deck = new Stack <int>(new int[] { 1, 2, 3, 9, 5, 6 }); cardGameService.Players[1].Deck = new Stack <int>(new int[] { 1, 2, 3, 4, 5, 6 }); for (int i = 0; i < 3; i++) { cardGameService.DrawCard(); cardGameService.CalculateDrawOutcome(); } var expected = new List <int> { 4, 5, 5, 6, 6, 9 }; Assert.Equal(expected, cardGameService.Players[0].Discard.OrderBy(x => x)); }