Beispiel #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.Six, axiom),
                new Card(Colour.Red, Number.Two, axiom),
                new Card(Colour.Blue, Number.Two, axiom)
            };

            IRule greenRule = new GreenRule(axiom);

            IPalette palette = new Palette(cards);

            // ACT
            IList <ICard> scoringCards = greenRule.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());
            }
        }
Beispiel #2
0
        public void TestScoringCardsWithNoEvenCards()
        {
            // 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.Green, Number.Seven, axiom)
            };

            IRule greenRule = new GreenRule(axiom);

            IPalette palette = new Palette(cards);

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

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