Пример #1
0
        public void DiceResultConverter_ConvertErrorValueNullTest()
        {
            // setup test
            DiceResultConverter conv = new DiceResultConverter();

            // run test
            Assert.ThrowsException <ArgumentNullException>(() => conv.Convert(null, typeof(string), null, "en-us"));

            // validate results
        }
Пример #2
0
        public void DiceResultConverter_ConvertErrorTargetTypeTest()
        {
            // setup test
            DiceResultConverter conv       = new DiceResultConverter();
            DiceResult          diceResult = this.dice.Roll("d20", this.roller);

            // run test
            Assert.ThrowsException <ArgumentException>(() => conv.Convert(diceResult, typeof(int), null, "en-us"));

            // validate results
        }
Пример #3
0
        public void DiceResultConverter_ConvertComplexTextTest()
        {
            // setup test
            DiceResultConverter conv       = new DiceResultConverter();
            DiceResult          diceResult = this.dice.Roll("4d6k3 + d8 + 5", this.roller);

            // run test
            string result = conv.Convert(diceResult, typeof(string), null, "en-us") as string;

            // validate results
            Assert.IsNotNull(result);
            Assert.AreEqual("17 (4d6k3+d8+5)", result);
        }