public void CanPlayTrumperOnlyIfDontHaveSameColorInHand(List <Card> playedCards) { PlayerService ps = new PlayerService(); Player player = ps.CreatePlayer("ASD", true, true); RoundService rs = new RoundService(true, new List <Player>() { player }); Card queenHearts = new Card("hearts", 13); Card eighteenTrumper = new Card("trumpers", 18); player.Hand = new List <object> { eighteenTrumper, queenHearts, new Card("spades", 1) }; List <Card> playableCards = rs.GetPlayableCardsForPlayer(player, playedCards).ToList(); Assert.That(playableCards.Count, Is.EqualTo(1)); Assert.That(playableCards.First(), Is.EqualTo(queenHearts)); player.Hand.Remove(queenHearts); playableCards = rs.GetPlayableCardsForPlayer(player, playedCards).ToList(); Assert.That(playableCards.Count, Is.EqualTo(1)); Assert.That(playableCards.First(), Is.EqualTo(eighteenTrumper)); }
public void MustPlayHigherTrumperIfTrumperPlayed() { PlayerService ps = new PlayerService(); Player player = ps.CreatePlayer("ASD", true, true); RoundService rs = new RoundService(true, new List <Player>() { player }); Card eighteenTrumper = new Card("trumpers", 18); player.Hand = new List <object> { new Card("trumpers", 8), eighteenTrumper, new Card("spades", 14) }; List <Card> playedCards = new List <Card>() { new Card("hearts", 14), new Card("trumpers", 9), }; List <Card> playableCards = rs.GetPlayableCardsForPlayer(player, playedCards).ToList(); Assert.That(playableCards.Count, Is.EqualTo(1)); Assert.That(playableCards.First(), Is.EqualTo(eighteenTrumper)); }
public void ExcusePlayedFirstMakesColorMustFollowSecondCard(string secondCardColor, int secondCardRank) { PlayerService ps = new PlayerService(); Player player = ps.CreatePlayer("ASdASd", false, false); RoundService rs = new RoundService(true, new List <Player>() { player }); Card excuse = new Card("trumpers", 0); Card secondCardPlayed = new Card(secondCardColor, secondCardRank); Card expectedOnlyPlayableCard = new Card(secondCardColor, 14); player.Hand = new List <object>() { new Card("hearts", 2), new Card("spades", 4), expectedOnlyPlayableCard }; List <Card> playedCards = new List <Card>() { excuse, secondCardPlayed }; List <Card> playableCards = rs.GetPlayableCardsForPlayer(player, playedCards).ToList(); Assert.That(playableCards.Count, Is.EqualTo(1)); Assert.That(playableCards.First(), Is.EqualTo(expectedOnlyPlayableCard)); }
public void CanAlwaysPlayExcuse(List <Card> playedCards) { PlayerService ps = new PlayerService(); Player player = ps.CreatePlayer("ASD", true, true); Card excuse = new Card("trumpers", 0); player.Hand.Add(excuse); RoundService rs = new RoundService(true, new List <Player>() { player }); List <Card> playableCards = rs.GetPlayableCardsForPlayer(player, playedCards).ToList(); Assert.That(playableCards.Count, Is.EqualTo(1)); Assert.That(playableCards.First(), Is.EqualTo(excuse)); }
public void MustPlayBasicIfNoMoreTrumperAndNoFirstColorInHand(List <Card> playedCards) { PlayerService ps = new PlayerService(); Player player = ps.CreatePlayer("ASD", true, true); RoundService rs = new RoundService(true, new List <Player>() { player }); player.Hand = new List <object> { new Card("clubs", 8), new Card("spades", 1) }; List <Card> playableCards = rs.GetPlayableCardsForPlayer(player, playedCards).ToList(); Assert.That(playableCards.Count, Is.EqualTo(2)); Assert.That(playableCards, Is.EqualTo(player.Hand)); }