public void CompareUsingSortTest()
        {
            WarCardComparer target = new WarCardComparer(); // TODO: Initialize to an appropriate value

            Card[] unorderedCards = {
                Card.AceOfClubs,
                Card.TwoOfClubs,
                new Card(CardSuit.Clubs, CardFace.King),
                Card.AceOfDiamonds };

            CardList cardList = new CardList(unorderedCards);

            cardList.Sort(new WarCardComparer());

            Assert.AreEqual(cardList[0].Face, CardFace.Two);
            Assert.AreEqual(cardList[1].Face, CardFace.King);
            Assert.AreEqual(cardList[2].Face, CardFace.Ace);
            Assert.AreEqual(cardList[3].Face, CardFace.Ace);
        }
示例#2
0
        public void CompareUsingSortTest()
        {
            WarCardComparer target = new WarCardComparer(); // TODO: Initialize to an appropriate value

            Card[] unorderedCards =
            {
                Card.AceOfClubs,
                Card.TwoOfClubs,
                new Card(CardSuit.Clubs,CardFace.King),
                Card.AceOfDiamonds
            };

            CardList cardList = new CardList(unorderedCards);

            cardList.Sort(new WarCardComparer());

            Assert.AreEqual(cardList[0].Face, CardFace.Two);
            Assert.AreEqual(cardList[1].Face, CardFace.King);
            Assert.AreEqual(cardList[2].Face, CardFace.Ace);
            Assert.AreEqual(cardList[3].Face, CardFace.Ace);
        }