public void DiceCupSetNumberOfDiceTo5() { const int numDice = 5; DiceCup diceCup = new DiceCup(numDice); const int expectedResult = 5; Assert.AreEqual(diceCup.NumDice(),expectedResult); }
public void DiceCupSetNumberOfSidesTo4() { const int numDice = 3; const int numSides = 4; int i; DiceCup diceCup = new DiceCup(numDice,numSides); const int expectedResult = 4; for (i = 1; i <= diceCup.NumDice(); i++) { Assert.AreEqual(diceCup.Dice(i).Sides(), expectedResult); } Assert.AreEqual(i,numSides); }
public void DiceCupRoll5Dice() { const int numDice = 5; const int minValue = 1; const int maxValue = 6; DiceCup diceCup = new DiceCup(numDice,maxValue); diceCup.Toss(); var dice = diceCup.Dice(); Assert.IsInstanceOf<Die[]>(dice); for (int i = 0; i < diceCup.NumDice(); i++) { Assert.GreaterOrEqual(dice[i].Value(),minValue); Assert.LessOrEqual(dice[i].Value(),maxValue); } }
public void DiceCupDefaultNumberOfDiceIs1() { DiceCup diceCup = new DiceCup(); const int expectedResult = 1; Assert.AreEqual(diceCup.NumDice(), expectedResult); }