public void TestScore() { // ARRANGE IAxiom axiom = new Axiom(); IList <ICard> cards = new List <ICard> { new Card(Colour.Blue, Number.Five, axiom), new Card(Colour.Red, Number.Four, axiom), new Card(Colour.Green, Number.Four, axiom), new Card(Colour.Blue, Number.Two, axiom), }; IRule yellowRule = new YellowRule(); IPalette palette = new Palette(cards); // ACT IRuleScore ruleScore = yellowRule.Score(palette); // ASSERT Assert.IsNotNull(ruleScore); Assert.AreEqual(expected: 2, actual: ruleScore.NumberOfCards); Assert.IsNotNull(ruleScore.TopCard); Assert.AreEqual(Colour.Blue, ruleScore.TopCard.Colour); Assert.AreEqual(Number.Five, ruleScore.TopCard.Number); }
public void TestScoringCards() { // ARRANGE IAxiom axiom = new Axiom(); IList <ICard> cards = new List <ICard> { new Card(Colour.Blue, Number.Five, axiom), new Card(Colour.Red, Number.Four, axiom), new Card(Colour.Green, Number.Four, axiom), new Card(Colour.Blue, Number.Two, axiom), }; IList <ICard> expectedScoringCards = new List <ICard> { new Card(Colour.Blue, Number.Five, axiom), new Card(Colour.Blue, Number.Two, axiom), }; IRule yellowRule = new YellowRule(); IPalette palette = new Palette(cards); // ACT IList <ICard> scoringCards = yellowRule.ScoringCards(palette); // ASSERT Assert.IsNotNull(scoringCards); Assert.AreEqual(expected: 2, scoringCards.Count); foreach (ICard card in expectedScoringCards) { Assert.IsTrue(scoringCards.Any(c => c.CompareTo(card) == 0), card.ToString()); } }
public void TestConstructor() { // ACT IRule yellowRule = new YellowRule(); // ASSERT Assert.AreEqual("Most of one colour wins", yellowRule.Description); Assert.AreEqual(Colour.Yellow, yellowRule.Colour); }