public void IsPlayable_WrongColourAndSameNumber_ReturnsTrue() { var cardInHand = new PlayableCard(new Card { Value = 5, Colour = CardColour.Yellow }); var activeCard = new Card { Value = 5, Colour = CardColour.Blue }; Assert.That(PlayableCards.IsPlayable(cardInHand, activeCard), Is.True); }
/// <summary> /// Returns boolean indicating whether the playable card is playable /// against the active card. /// </summary> public static bool IsPlayable(PlayableCard card, Card activeCard) { if (card.Type == CardType.Wild) return true; if (card.Type == CardType.WildDraw) return true; return (card.Colour == activeCard.Colour || (card.Value < 20 && card.Value == activeCard.Value)); }