public DiceCup(int numDice, int numSides) : this(numDice) { for (int i = 0; i < NumDice(); i++) { _dice[i] = new Die(numSides); } }
public DiceCup(int numDice = 1) { _dice = new Die[numDice <= 0 ? 1 : numDice]; for (int i = 0; i < NumDice(); i++) { _dice[i] = new Die(); } }
public void DieRolls() { Die die = new Die(); bool test = true; int numTests = 0; while (numTests++ <= 100 && test) { die.Roll(); test = (die.Value() >= 1 && die.Value() <= die.Sides()); } Assert.IsTrue(test); }
public void DieToggleLock() { Die die = new Die(); die.ToggleLock(); Assert.IsTrue(die.Locked()); die.ToggleLock(); Assert.IsFalse(die.Locked()); }
public void DieNewInstanceIsUnlocked() { Die die = new Die(); Assert.IsFalse(die.Locked()); }
public void DieLock() { Die die = new Die(); die.Lock(); Assert.IsTrue(die.Locked()); }
public void DieDefaultValueIs1() { Die die = new Die(); const int expectedResult = 1; Assert.AreEqual(die.Value(), expectedResult); }
public void DieDefaultNumberOfSidesIs6() { Die die = new Die(); const int expectedResult = 6; Assert.AreEqual(die.Sides(), expectedResult); }
public void DieAssignValue() { Die die = new Die(6,4); const int expectedResult = 4; Assert.AreEqual(die.Value(), expectedResult); }
public void DieAssignNumberOfSides() { Die die = new Die(8); const int expectedResult = 8; Assert.AreEqual(die.Sides(), expectedResult); }
public void DieAssignNegativeValue() { Die die = new Die(6,-5); const int expectedResult = 1; Assert.AreEqual(die.Value(), expectedResult); }
public void DieAssignExcessiveValue() { Die die = new Die(6,8); const int expectedResult = 6; Assert.AreEqual(die.Value(), expectedResult); }
public void DieUnlock() { Die die = new Die(); die.Lock(); Assert.IsTrue(die.Locked()); die.Unlock(); Assert.IsFalse(die.Locked()); }