Exemple #1
0
        public void Should_Always_Beat_Flush()
        {
            var high = new FullHouseScore(CardValue.Two, CardValue.Three);
            var low = new FlushScore(CardSuit.Clubs, CardValue.Ace);

            Assert.Greater(high, low);
        }
Exemple #2
0
        public void Two_Flushes_Revert_To_HighCard_Rules()
        {
            var high = new FlushScore(CardSuit.Clubs, CardValue.Three);
            var low = new FlushScore(CardSuit.Diamonds, CardValue.Two);

            Assert.Greater(high, low);
        }
Exemple #3
0
        public void Should_Always_Beat_Straight()
        {
            var high = new FlushScore(CardSuit.Clubs, CardValue.Two);
            var low = new StraightScore(CardValue.Ace);

            Assert.Greater(high, low);
        }
Exemple #4
0
        public void Same_Flush_Should_Tie()
        {
            var high = new FlushScore(CardSuit.Clubs, CardValue.Three);
            var low = new FlushScore(CardSuit.Diamonds, CardValue.Three);

            Assert.AreEqual(0, high.CompareTo(low));
        }
Exemple #5
0
        public void Score_FlushCardsWithOneWrongCardColor_Failed()
        {
            // Arrange
            var setValidator  = GenerateSetValidator();
            var unitUnderTest = new FlushScore(setValidator);

            setValidator.Validate(Arg.Any <CardSet>()).Returns(false);
            CardSet set = new CardSet(new HashSet <Card>()
            {
                GenerateCard(CardValue.Ten),
                GenerateCard(CardValue.Three),
                GenerateCard(CardValue.Queen, CardColor.Goblet),
                GenerateCard(CardValue.Two),
                GenerateCard(CardValue.Ace)
            });

            // Act
            var result = unitUnderTest.Score(
                set);

            // Assert
            Assert.False(result.IsValid);
        }
Exemple #6
0
        public void Score_ValidFlushCards_SuccessAndScore()
        {
            // Arrange
            var setValidator  = GenerateSetValidator();
            var unitUnderTest = new FlushScore(setValidator);

            setValidator.Validate(Arg.Any <CardSet>()).Returns(true);
            CardSet set = new CardSet(new HashSet <Card>()
            {
                GenerateCard(CardValue.Ten),
                GenerateCard(CardValue.Three),
                GenerateCard(CardValue.Queen),
                GenerateCard(CardValue.Two),
                GenerateCard(CardValue.Ace)
            });

            // Act
            var result = unitUnderTest.Score(
                set);

            // Assert
            Assert.True(result.IsValid);
        }