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 orangeRule = new OrangeRule(); IPalette palette = new Palette(cards); // ACT IRuleScore ruleScore = orangeRule.Score(palette); // ASSERT Assert.IsNotNull(ruleScore); Assert.AreEqual(expected: 2, actual: ruleScore.NumberOfCards); Assert.IsNotNull(ruleScore.TopCard); Assert.AreEqual(Colour.Red, ruleScore.TopCard.Colour); Assert.AreEqual(Number.Four, 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.Red, Number.Four, axiom), new Card(Colour.Green, Number.Four, axiom), }; IRule orangeRule = new OrangeRule(); IPalette palette = new Palette(cards); // ACT IList <ICard> scoringCards = orangeRule.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 orangeRule = new OrangeRule(); // ASSERT Assert.AreEqual("Most of one number wins", orangeRule.Description); Assert.AreEqual(Colour.Orange, orangeRule.Colour); }