示例#1
0
        public void ToString_ChooseThree_RepresentationIsCorrect()
        {
            var diceTerm = new DiceTerm(4, 6, 3, 1);

            string stringRepresentation = diceTerm.ToString();

            Assert.AreEqual("4d6k3", stringRepresentation);
        }
示例#2
0
        public void ToString_ScalarOfOne_RepresentationIsCorrect()
        {
            const int multiplicity = 3;
            const int sides        = 6;
            var       diceTerm     = new DiceTerm(multiplicity, sides, 1);

            string stringRepresentation = diceTerm.ToString();

            Assert.AreEqual("3d6", stringRepresentation);
        }
        public void DiceTerm_ToStringAllTermsTest()
        {
            // setup test
            IExpressionTerm term = new DiceTerm(4, 6, 10, 3, 6);

            // run test
            string result = term.ToString();

            // validate results
            Assert.IsFalse(string.IsNullOrEmpty(result));
            Assert.AreEqual("4d6k3!6x10", result);
        }
        public void DiceTerm_ToStringExplodingLowerThanMaxTest()
        {
            // setup test
            IExpressionTerm term = new DiceTerm(10, 12, exploding: 9);

            // run test
            string result = term.ToString();

            // validate results
            Assert.IsFalse(string.IsNullOrEmpty(result));
            Assert.AreEqual("10d12!9", result);
        }
        public void DiceTerm_ToStringExplodingNoneDiceTest()
        {
            // setup test
            IExpressionTerm term = new DiceTerm(5, 6, exploding: 6);

            // run test
            string result = term.ToString();

            // validate results
            Assert.IsFalse(string.IsNullOrEmpty(result));
            Assert.AreEqual("5d6!6", result);
        }
        public void DiceTerm_ToStringMultiplierTest()
        {
            // setup test
            IExpressionTerm term = new DiceTerm(2, 8, 10);

            // run test
            string result = term.ToString();

            // validate results
            Assert.IsFalse(string.IsNullOrEmpty(result));
            Assert.AreEqual("2d8x10", result);
        }
        public void DiceTerm_ToStringChooseTest()
        {
            // setup test
            IExpressionTerm term = new DiceTerm(5, 6, choose: 3);

            // run test
            string result = term.ToString();

            // validate results
            Assert.IsFalse(string.IsNullOrEmpty(result));
            Assert.AreEqual("5d6k3", result);
        }
示例#8
0
        public void StringRepresentationIsCorrectForScalarOfTwo()
        {
            const int multiplicity = 3;
            const int sides        = 6;
            const int scalar       = 2;

            var diceTerm = new DiceTerm(multiplicity, sides, scalar);

            string stringRepresentation = diceTerm.ToString();

            Assert.AreEqual("2*3d6", stringRepresentation);
        }