Пример #1
0
        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.Seven, axiom),
                new Card(Colour.Red, Number.Six, axiom),
                new Card(Colour.Red, Number.Two, axiom),
                new Card(Colour.Green, Number.Seven, axiom),
                new Card(Colour.Blue, Number.Two, axiom)
            };

            IList <ICard> expectedScoringCards = new List <ICard>
            {
                new Card(Colour.Red, Number.Seven, axiom),
                new Card(Colour.Blue, Number.Five, axiom),
                new Card(Colour.Green, Number.Seven, axiom)
            };

            IRule blueRule = new BlueRule();

            IPalette palette = new Palette(cards);

            // ACT
            IList <ICard> scoringCards = blueRule.ScoringCards(palette);

            // ASSERT
            Assert.IsNotNull(scoringCards);
            Assert.AreEqual(expected: 3, scoringCards.Count);

            foreach (ICard card in expectedScoringCards)
            {
                Assert.IsTrue(scoringCards.Any(c => c.CompareTo(card) == 0), card.ToString());
            }
        }