Ejemplo n.º 1
0
        private DieRollResult GetResult(DieRoll die)
        {
            var diceSet      = new DiceRoll(FakeDiceRollFactory.GetSetOfRolls(die, 3));
            var threeOfAKind = new ThreeOfAKindRule();

            return(threeOfAKind.CountPoints(diceSet));
        }
Ejemplo n.º 2
0
        public void Awards1500PtsForAllRolls(DieRoll dice)
        {
            var diceSet     = new DiceRoll(FakeDiceRollFactory.GetSetOfRolls(dice, 5));
            var fiveOfAKind = new FiveOfAKindRule();

            var result = fiveOfAKind.CountPoints(diceSet);

            Assert.True(result.Points == _points);
        }
Ejemplo n.º 3
0
        public void CanBeAchievedByFiveOfAnyRoll(DieRoll dice)
        {
            var diceSet     = new DiceRoll(FakeDiceRollFactory.GetSetOfRolls(dice, 5));
            var fiveOfAKind = new FiveOfAKindRule();

            var result = fiveOfAKind.CountPoints(diceSet);

            Assert.True(result.Points == _points);
        }
Ejemplo n.º 4
0
        public void Awards1000PtsForAllRolls(DieRoll dice)
        {
            var diceSet     = FakeDiceRollFactory.GetSetOfRolls(dice, 4);
            var fourOfAKind = new FourOfAKindRule();

            var result = fourOfAKind.CountPoints(new DiceRoll(diceSet));

            Assert.True(result.Points == _points);
        }
Ejemplo n.º 5
0
        public void CanBeAchievedByFourOfAnyRoll(DieRoll dice)
        {
            var diceSet     = FakeDiceRollFactory.GetSetOfRolls(dice, 4);
            var fourOfAKind = new FourOfAKindRule();

            var result = fourOfAKind.CountPoints(new DiceRoll(diceSet));

            Assert.True(result.DiceCombination == _combination);
        }
Ejemplo n.º 6
0
        public void Awards2500PtsForAllRolls(DieRoll threeDice, DieRoll twoDice)
        {
            KeyValuePair <DieRoll, int> setOfThreeDice = new KeyValuePair <DieRoll, int>(threeDice, 3);
            KeyValuePair <DieRoll, int> setOfTwoDice   = new KeyValuePair <DieRoll, int>(twoDice, 2);
            var dice = FakeDiceRollFactory.GetSetOfRolls(setOfThreeDice, setOfTwoDice);

            var result = new FullHouseRule().CountPoints(new DiceRoll(dice));

            Assert.True(result.Points == _points, $"Awarded {result.Points} instead of {_points}.");
        }
Ejemplo n.º 7
0
        public void CanBeDoneThroughRollingAConsecutiveSequence(DieRoll threeDice, DieRoll twoDice)
        {
            KeyValuePair <DieRoll, int> setOfThreeDice = new KeyValuePair <DieRoll, int>(threeDice, 3);
            KeyValuePair <DieRoll, int> setOfTwoDice   = new KeyValuePair <DieRoll, int>(twoDice, 2);
            var dice = FakeDiceRollFactory.GetSetOfRolls(setOfThreeDice, setOfTwoDice);

            var result = new FullHouseRule().CountPoints(new DiceRoll(dice));

            Assert.True(result.DiceCombination == _combination, $"Expected {_combination} combination, but got {result.DiceCombination} instead.");
        }
Ejemplo n.º 8
0
        public void FakeDiceRollFactoryReturnsArrayOfDice()
        {
            var diceSet  = FakeDiceRollFactory.GetSetOfRolls(DieRoll.Five, 3);
            var fakeDice = new MockDiceProvider(diceSet).RollAllFiveDice();

            Assert.True(diceSet.Length == 5);
            Assert.True(diceSet.Take(3).All(x => x == DieRoll.Five));
            Assert.True(diceSet.Skip(3).All(x => x != DieRoll.Five));
            Assert.True(fakeDice.All(x => ((int)x).Between(1, 6)));
        }