Exemplo n.º 1
0
        private void Test_Add_ChainAdd()
        {
            var a = new Modifier();                   //0, 0
            var b = new Modifier(2);                  //2, 2
            var c = new Modifier(always1, rolld4, 1); //2, 3
            var d = new Modifier(always1, new List <RollType>()
            {
                RollType.d12, RollType.d12
            }, 3);                                                                                 //5, 7
            var e = new Modifier(always1, new List <RollType>()
            {
                RollType.d20, RollType.d20, RollType.d20
            }, 2);                                                                                               //5, 8

            IModifier res = null;

            Assert.DoesNotThrow(() => res = a.Add(b));
            Assert.DoesNotThrow(() => res = res.Add(c));
            Assert.DoesNotThrow(() => res = res.Add(d));
            Assert.DoesNotThrow(() => res = res.Add(e));

            Assert.IsNotNull(res);
            Assert.AreEqual(14, res.Get());     //0+2+2+5+5 = 14
            Assert.AreEqual(20, res.GetCrit()); //0+2+3+7+8 = 20
        }