示例#1
0
        // "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 + ".");
        }
示例#2
0
        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 + ".");
        }
示例#3
0
        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 + ".");
        }