// "Fake" RNG for addition of stat modifier and proficiency bonus public void rollTestStatProficiencyAdditionCorrect() { DiceForTesting tester = new DiceForTesting("4D6", 13, 17); int rollResultExpected = 54; int rollResultActual = tester.rollFixedAdditionTest(); Assert.AreEqual(rollResultExpected, rollResultActual, 0, "DiceTest.rollTestStatProficiencyAdditionCorrect():" + "rollResult not computed " + "correctly - expected " + rollResultExpected + ", got " + rollResultActual + "."); }
public void parseDiceStringTestDoubleDigitRollsSides() { DiceForTesting tester = new DiceForTesting("10D12", 0, 0); int numRollsExpected = 10; int numSidesExpected = 12; Assert.AreEqual(numRollsExpected, tester.numRolls, 0, "DiceTest.parseDiceStringTestDoubleDigitRollsSides():" + "diceString was not parsed correctly - expected " + numRollsExpected + ", got " + tester.numRolls + "."); Assert.AreEqual(numSidesExpected, tester.numSides, 0, "DiceTest.parseDiceStringTestDoubleDigitRollsSides():" + "diceString was not parsed correctly - expected " + numSidesExpected + ", got " + tester.numSides + "."); }
public void rollTestWithinCorrectRNGRange() { DiceForTesting tester = new DiceForTesting("2D4", 10, 10); int rollResultActual = tester.roll(); // (2 * 4) + 20 = 28 int rollResultExpectedMax = 28; // (2 * 1) + 20 = 22 int rollResultExpectedMin = 22; Assert.IsTrue(rollResultActual <= rollResultExpectedMax && rollResultActual >= rollResultExpectedMin, "DiceTest.rollTestWithinCorrectRNGRange():" + "rollResult out of range - expected 22 <= " + "rollResult <= 28, got " + rollResultActual + "."); }