public void Awards2500Pts() { var diceProvider = new MockDiceProvider(new DieRoll[] { DieRoll.Five, DieRoll.Five, DieRoll.Five, DieRoll.Two, DieRoll.Two }); var diceProc = new RulesProcessor(diceProvider); var diceGen = new DiceRollGenerator(diceProvider); var roll = diceGen.Roll(); var result = diceProc.CheckRollResult(roll); Assert.True(result.Points == _points, $"Awarded {result.Points} instead of {_points}."); }
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))); }
public void DoesNotOccurWhenRollingAPair() { var diceProvider = new MockDiceProvider(new DieRoll[] { DieRoll.Five, DieRoll.Five, DieRoll.Six, DieRoll.One, DieRoll.Two }); var diceProc = new RulesProcessor(diceProvider); var diceGen = new DiceRollGenerator(diceProvider); var roll = diceGen.Roll(); var result = diceProc.CheckRollResult(roll); Assert.True(result.DiceCombination != _combination, $"Expected combination different from {_combination}, but got {result.DiceCombination} instead."); }
public void DoesNotOccurWhenRollingFourOrMoreOfTheSameDie(DieRoll[] dice, DiceCombination diceCombination) { var diceProvider = new MockDiceProvider(dice); var diceProc = new RulesProcessor(diceProvider); var diceGen = new DiceRollGenerator(diceProvider); var roll = diceGen.Roll(); var result = diceProc.CheckRollResult(roll); Assert.True(result.DiceCombination == diceCombination, $"Expected {diceCombination} combination, but got {result.DiceCombination} instead."); }
public void OccursWhenRollingThreeOfTheSameDie() { var diceProvider = new MockDiceProvider(new DieRoll[] { DieRoll.Five, DieRoll.Five, DieRoll.Five, DieRoll.One, DieRoll.Two }); var diceProc = new RulesProcessor(diceProvider); var diceGen = new DiceRollGenerator(diceProvider); var roll = diceGen.Roll(); var result = diceProc.CheckRollResult(roll); Assert.True(result.DiceCombination == _combination, $"Expected {_combination} combination, but got {result.DiceCombination} instead."); }
public void Awards300Pts() { IDiceProvider diceProvider = new MockDiceProvider(dice); IDiceGenerator diceGen = new DiceRollGenerator(diceProvider); RulesProcessor rules = new RulesProcessor(diceProvider); var roll = diceGen.Roll(); var result = rules.CheckRollResult(roll); Assert.True(result.Points == _points); }
public void OccursWhenRollingTwoOnesAndTwoFives() { IDiceProvider diceProvider = new MockDiceProvider(dice); IDiceGenerator diceGen = new DiceRollGenerator(diceProvider); RulesProcessor rules = new RulesProcessor(diceProvider); var roll = diceGen.Roll(); var result = rules.CheckRollResult(roll); Assert.True(result.DiceCombination == _combination); }
public void OnlyHappensWhenRollingTwoThroughSix(DieRoll[] dice, bool isHighStraight) { var diceProvider = new MockDiceProvider(dice); var diceProc = new RulesProcessor(diceProvider); var diceGen = new DiceRollGenerator(diceProvider); var roll = diceGen.Roll(); var result = diceProc.CheckRollResult(roll); Assert.True((result.DiceCombination == _combination) == isHighStraight, $"Expected {_combination} combination, but got {result.DiceCombination} instead."); }
public void OccurForNonOneOrNonFiveDice(DieRoll[] dice) { IDiceProvider diceProvider = new MockDiceProvider(dice); IDiceGenerator diceGen = new DiceRollGenerator(diceProvider); RulesProcessor rules = new RulesProcessor(diceProvider); var roll = diceGen.Roll(); var result = rules.CheckRollResult(roll); Assert.True(result.DiceCombination == _combination); }
public void IsOnlyPossibleIfThereAreFourOfTheSameDie() { var diceProvider = new MockDiceProvider(_dice); var diceProc = new RulesProcessor(diceProvider); var diceGen = new DiceRollGenerator(diceProvider); var roll = diceGen.Roll(); var result = diceProc.CheckRollResult(roll); Assert.True(result.Points == _points, $"Awarded {result.Points} instead of {_points}."); }
public void Awards1000Pts() { var diceProvider = new MockDiceProvider(_dice); var diceProc = new RulesProcessor(diceProvider); var diceGen = new DiceRollGenerator(diceProvider); var roll = diceGen.Roll(); var result = diceProc.CheckRollResult(roll); Assert.True(result.DiceCombination == _combination, $"Expected {_combination} combination, but got {result.DiceCombination} instead."); }
public void OccursWhenTwoDiceAreTheSameAndThreeDifferentDiceAreTheSame(DieRoll[] dice, bool isFullHouse) { var diceProvider = new MockDiceProvider(dice); var diceProc = new RulesProcessor(diceProvider); var diceGen = new DiceRollGenerator(diceProvider); var roll = diceGen.Roll(); var result = diceProc.CheckRollResult(roll); Assert.True((result.DiceCombination == _combination) == isFullHouse, $"Expected {_combination} combination, but got {result.DiceCombination} instead."); }
public void Awards500PtsIfThreeFivesAreRolled() { int expectedPoints = 500; var diceProvider = new MockDiceProvider(new DieRoll[] { DieRoll.Five, DieRoll.Five, DieRoll.Five, DieRoll.Three, DieRoll.Two }); var diceProc = new RulesProcessor(diceProvider); var diceGen = new DiceRollGenerator(diceProvider); var roll = diceGen.Roll(); var result = diceProc.CheckRollResult(roll); Assert.True(result.Points == expectedPoints, $"Awarded {result.Points} instead of {expectedPoints}."); }
public void Awards100PtsMultipliedByTheDieValue() { int expectedPoints = _pointsBase * 5; var diceProvider = new MockDiceProvider(new DieRoll[] { DieRoll.Five, DieRoll.Five, DieRoll.Five, DieRoll.One, DieRoll.Two }); var diceProc = new RulesProcessor(diceProvider); var diceGen = new DiceRollGenerator(diceProvider); var roll = diceGen.Roll(); var result = diceProc.CheckRollResult(roll); Assert.True(result.Points == expectedPoints, $"Awarded {result.Points} instead of {expectedPoints}."); }
public void IsNotAwardedIfAtLeastOneDieIsDifferent() { var diceProvider = new MockDiceProvider(_dice) { DiceFive = (DieRoll)1 }; var diceProc = new RulesProcessor(diceProvider); var diceGen = new DiceRollGenerator(diceProvider); var roll = diceGen.Roll(); var result = diceProc.CheckRollResult(roll); Assert.True(result.DiceCombination != _combination, $"Expected non Five of a kind combination, but got {result.DiceCombination} instead."); }