public void MultiplesOfTheSameDiceCanBeAdded() { var cup = new Cup(); cup.AddDice( Die.GetDice(DiceSides.d6, 4) ); Assert.AreEqual(new Die[] { Die.D6(), Die.D6(), Die.D6(), Die.D6() }, cup.Dice); }
public void ResultsCanBeFilteredByTakingTheHighestNumberOfDice() { //For stats we frequently roll 4d6 and want the top 3... var cup = new Cup(Die.GetDice(DiceSides.d6, 4)); cup.Roll(); var sumTop3 = cup.SumTop(3); var manualSum = 0; var lowest = 100; foreach (var d in cup.Dice) { manualSum += d.LastRoll; if (d.LastRoll < lowest) { lowest = d.LastRoll; } } Assert.AreEqual(manualSum - lowest, sumTop3); }
public void CreateAnArrayOfDiceByPassingANumberIntoTheHelperMethod() { var diceArray = Die.GetDice(DiceSides.d12, 4); Assert.AreEqual(new Die[] { Die.D12(), Die.D12(), Die.D12(), Die.D12() }, diceArray); }
public void CupCanBeCreatedWithArrayOfDice() { var cup = new Cup(Die.GetDice(DiceSides.d6, 4)); Assert.AreEqual(new Die[] { Die.D6(), Die.D6(), Die.D6(), Die.D6() }, cup.Dice); }