Пример #1
0
        public void DiceParser_ParseDiceFudgeDropTest()
        {
            // setup test
            DiceParser parser = new DiceParser();

            // run test
            DiceResult result = parser.Parse("6fp3", this.config, this.roller);

            // validate results
            Assert.IsNotNull(result);
            AssertHelpers.AssertDiceChoose(result, "6fp3", "FudgeDiceTerm.dF", 6, 3);
        }
        public void DiceParser_ParseDiceWithChainedOrderTest()
        {
            // setup test
            DiceParser parser = new DiceParser();

            // run test
            DiceResult result = parser.Parse("2 + 4d6k3 + d8", this.config, this.testRoller);

            // validate results
            Assert.IsNotNull(result);
            AssertHelpers.AssertDiceChoose(result, "2+4d6k3+d8", "DiceTerm", 5, 4, 2);
        }
        public void DiceParser_ParseDiceWithWhitepaceTest()
        {
            // setup test
            DiceParser parser = new DiceParser();

            // run test
            DiceResult result = parser.Parse(" 4  d6 k 3+  2    ", this.config, this.testRoller);

            // validate results
            Assert.IsNotNull(result);
            AssertHelpers.AssertDiceChoose(result, "4d6k3+2", "DiceTerm.d6", 4, 3, 2);
        }
        public void DiceParser_ParseDiceWithEquivalentKeepLowestTest()
        {
            // setup test
            DiceParser parser = new DiceParser();

            // run test
            DiceResult result = parser.Parse("4d6l1", this.config, this.testRoller);

            // validate results
            Assert.IsNotNull(result);
            AssertHelpers.AssertDiceChoose(result, "4d6l1", "DiceTerm.d6", 4, 1);
        }
        public void DiceParser_ParseDiceWithDropLowestTest()
        {
            // setup test
            DiceParser parser = new DiceParser();

            // run test
            DiceResult result = parser.Parse("6d6p2", this.config, this.testRoller);

            // validate results
            Assert.IsNotNull(result);
            AssertHelpers.AssertDiceChoose(result, "6d6p2", "DiceTerm.d6", 6, 4);
        }
        public void DiceParser_ParseParensChooseTest()
        {
            // setup test
            DiceParser parser = new DiceParser();

            // run test
            DiceResult result = parser.Parse("4d(2x3)k(1+2)", this.config, this.testRoller);

            // validate results
            Assert.IsNotNull(result);
            AssertHelpers.AssertDiceChoose(result, "4d(2x3)k(1+2)", "DiceTerm.d6", 4, 3);
        }
Пример #7
0
        public void DiceConfiguration_SetDefaultDieSidesTest()
        {
            // setup test
            IDice dice = new Dice();

            // run test
            dice.Configuration.DefaultDieSides = 10;
            DiceResult result = dice.Roll("4dk3+3", this.roller);

            // validate results
            Assert.IsNotNull(result);
            AssertHelpers.AssertDiceChoose(result, "4dk3+3", "DiceTerm.d10", 4, 3, 3);
        }
Пример #8
0
        public void Dice_ParseChainedDiceTest()
        {
            // setup test
            IDice dice = new Dice();

            // run test
            DiceResult result = dice.Roll("4d6k3 + 1d8 + 5", new ConstantDieRoller(1));

            // validate results
            Assert.IsNotNull(result);
            Assert.AreEqual("OnePlat.DiceNotation.DieRoller.ConstantDieRoller", result.DieRollerUsed);
            Assert.AreEqual(9, result.Value);
            AssertHelpers.AssertDiceChoose(result, "4d6k3+1d8+5", "DiceTerm", 5, 4, 5);
        }
Пример #9
0
        public void Dice_RollFudgeChooseDiceTest()
        {
            // setup test
            IDice dice = new Dice();

            dice.FudgeDice(6, 3);

            // run test
            DiceResult result = dice.Roll(this.roller);

            // validate results
            Assert.IsNotNull(result);
            Assert.AreEqual("OnePlat.DiceNotation.DieRoller.RandomDieRoller", result.DieRollerUsed);
            AssertHelpers.IsWithinRangeInclusive(-3, 3, result.Value);
            AssertHelpers.AssertDiceChoose(result, "6fk3", "FudgeDiceTerm.dF", 6, 3);
        }
Пример #10
0
        public void Dice_RollChooseDiceTest()
        {
            // setup test
            IDice dice = new Dice();

            dice.Dice(6, 4, choose: 3);

            // run test
            DiceResult result = dice.Roll(roller);

            // validate results
            Assert.IsNotNull(result);
            Assert.AreEqual("OnePlat.DiceNotation.DieRoller.RandomDieRoller", result.DieRollerUsed);
            AssertHelpers.IsWithinRangeInclusive(3, 18, result.Value);
            AssertHelpers.AssertDiceChoose(result, "4d6k3", "DiceTerm.d6", 4, 3);
        }