Beispiel #1
0
        public void FourOfAKindCheck_WhenRollDoesNotContainFourOfAKind_ReturnsFalse(int die1, int die2, int die3, int die4, int die5)
        {
            int[] diceRoll = { die1, die2, die3, die4, die5 };

            var actual = _sut.IsMatch(diceRoll);

            Assert.IsFalse(actual);
        }
Beispiel #2
0
        public void HandFourOfAKindTestDuplicate()
        {
            //Arrange
            List <Card> cards = new List <Card>();

            cards.Add(new Card(Suits.Clubes, "A"));
            cards.Add(new Card(Suits.Clubes, "A"));

            //Act
            FourOfAKind hand = new FourOfAKind();

            //Assert
            Assert.ThrowsException <InvalidOperationException>(() => hand.IsMatch(cards));
        }
Beispiel #3
0
        public void HandIsNotHandFourOfAKind()
        {
            //Arrange
            List <Card> cards = new List <Card>();

            cards.Add(new Card(Suits.Hearts, 3));
            cards.Add(new Card(Suits.Hearts, "A"));
            cards.Add(new Card(Suits.Spades, 4));
            cards.Add(new Card(Suits.Clubes, 3));
            cards.Add(new Card(Suits.Hearts, "K"));
            cards.Add(new Card(Suits.Dimensions, 3));
            cards.Add(new Card(Suits.Hearts, "J"));

            //Act
            FourOfAKind fourOfAKind = new FourOfAKind();

            //Assert
            Assert.IsFalse(fourOfAKind.IsMatch(cards).HasValue);
        }
Beispiel #4
0
        public void HandIsHandFourOfAKind()
        {
            //Arrange
            List <Card> cards = new List <Card>();

            cards.Add(new Card(Suits.Hearts, 3));
            cards.Add(new Card(Suits.Hearts, "A"));
            cards.Add(new Card(Suits.Spades, 3));
            cards.Add(new Card(Suits.Clubes, 3));
            cards.Add(new Card(Suits.Hearts, "K"));
            cards.Add(new Card(Suits.Dimensions, 3));
            cards.Add(new Card(Suits.Hearts, "J"));

            //Act
            FourOfAKind h           = new FourOfAKind();
            Hand        fourOfAKind = h.IsMatch(cards).Value;

            //Assert
            Assert.IsNotNull(fourOfAKind);
            Assert.AreEqual(5, fourOfAKind.CardsInTheHand.Count);
            Assert.AreEqual <int>(14, fourOfAKind.CardsInTheHand[4].Value);
            Assert.AreEqual(Constancts.HandRanks.FourOfAKind, fourOfAKind.Rank);
        }