public void RerollsDiceOne() { var sut = new DiceRollGenerator(new DiceProvider()); var diceRoll = sut.Roll(); var newRoll = sut.RerollDiceOne(diceRoll); Assert.True(diceRoll != newRoll); }
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 IsOnlyPossibleWhenAllDiceAreTheSame() { 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 Awards1500Pts() { 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 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 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 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 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 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 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 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 ShouldCreateNumbersWithin1And6ForAllDice() { var listOfRolls = new List <int[]>(); var diceGen = new DiceRollGenerator(new DiceProvider()); for (int i = 0; i < 100; i++) { listOfRolls.Add(diceGen.Roll().AllDice.ToIntArray()); } Assert.True(listOfRolls.All(x => x.All(y => y >= _min && y <= _max))); }
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."); }