Example #1
0
 public void ShouldReturnSuitExpectedRankingForEveryPermutation()
 {
     ISuit[] suits =
     {
         Suit.Club,
         Suit.Diamond,
         Suit.Heart,
         Suit.Spade
     };
     for (int thisIdx = 0; thisIdx < suits.Length; thisIdx++)
     {
         for (int otherIdx = 0; otherIdx < suits.Length; otherIdx++)
         {
             IValueCompare compare = suits[thisIdx].Compare(suits[otherIdx]);
             if (thisIdx == otherIdx)
             {
                 compare.IsEqual().Should().BeTrue();
                 compare.IsLesser().Should().BeFalse();
                 compare.IsGreater().Should().BeFalse();
             }
             if (thisIdx < otherIdx)
             {
                 compare.IsEqual().Should().BeFalse();
                 compare.IsLesser().Should().BeTrue();
                 compare.IsGreater().Should().BeFalse();
             }
             if (thisIdx > otherIdx)
             {
                 compare.IsEqual().Should().BeFalse();
                 compare.IsLesser().Should().BeFalse();
                 compare.IsGreater().Should().BeTrue();
             }
         }
     }
 }
Example #2
0
 public void ShouldReturnExpectedRankRankingForEveryPermutation()
 {
     ICard[] ranks =
     {
         new Card(Suit.Club, Rank.Two),
         new Card(Suit.Club, Rank.Three),
         new Card(Suit.Club, Rank.Four),
         new Card(Suit.Club, Rank.Five),
         new Card(Suit.Club, Rank.Six),
         new Card(Suit.Club, Rank.Seven),
         new Card(Suit.Club, Rank.Eight),
         new Card(Suit.Club, Rank.Nine),
         new Card(Suit.Club, Rank.Ten),
         new Card(Suit.Club, Rank.Jack),
         new Card(Suit.Club, Rank.Queen),
         new Card(Suit.Club, Rank.King),
         new Card(Suit.Club, Rank.Ace)
     };
     for (int thisIdx = 0; thisIdx < ranks.Length; thisIdx++)
     {
         for (int otherIdx = 0; otherIdx < ranks.Length; otherIdx++)
         {
             IValueCompare compare = ranks[thisIdx].Compare(ranks[otherIdx]);
             if (thisIdx == otherIdx)
             {
                 compare.IsEqual().Should().BeTrue();
                 compare.IsLesser().Should().BeFalse();
                 compare.IsGreater().Should().BeFalse();
             }
             if (thisIdx < otherIdx)
             {
                 compare.IsEqual().Should().BeFalse();
                 compare.IsLesser().Should().BeTrue();
                 compare.IsGreater().Should().BeFalse();
             }
             if (thisIdx > otherIdx)
             {
                 compare.IsEqual().Should().BeFalse();
                 compare.IsLesser().Should().BeFalse();
                 compare.IsGreater().Should().BeTrue();
             }
         }
     }
 }
Example #3
0
        public void ShouldReturnGreaterGivenSpadeVsHeart()
        {
            //Arrange
            ICard heart = new Card(Suit.Heart);
            ICard spade = new Card(Suit.Spade);

            //Act
            IValueCompare compared = spade.Compare(heart);

            //Assert
            compared.IsGreater().Should().BeTrue();
        }
Example #4
0
        public void ShouldReturnGreaterGivenDiamondVsClub()
        {
            //Arrange
            ICard club    = new Card(Suit.Club);
            ICard diamond = new Card(Suit.Diamond);

            //Act
            IValueCompare compared = diamond.Compare(club);

            //Assert
            compared.IsGreater().Should().BeTrue();
        }
Example #5
0
        public void ShouldReturnGreaterGivenAceVsKing()
        {
            //Arrange
            ICard ace  = new Card(Suit.Club, Rank.Ace);
            ICard king = new Card(Suit.Club, Rank.King);

            //Act
            IValueCompare compared = ace.Compare(king);

            //Assert
            compared.IsGreater().Should().BeTrue();
        }
Example #6
0
        public void ShouldReturnGreaterGivenThreeVsTwo()
        {
            //Arrange
            ICard two   = new Card(Suit.Club, Rank.Two);
            ICard three = new Card(Suit.Club, Rank.Three);

            //Act
            IValueCompare compared = three.Compare(two);

            //Assert
            compared.IsGreater().Should().BeTrue();
        }