Exemplo n.º 1
0
        public void ModifierTests(DiceResolver.DiceOperation?operation, int modifier)
        {
            var resolver = new DiceResolver
            {
                Count     = 4,
                Sides     = 6,
                Operation = operation,
                Modifier  = modifier
            };

            resolver.Roll();
            var sum = resolver.LastRolls.Sum();

            if (operation == DiceResolver.DiceOperation.Add)
            {
                sum += modifier;
            }
            if (operation == DiceResolver.DiceOperation.Subtract)
            {
                sum -= modifier;
            }

            Assert.AreEqual(sum, resolver.LastSum);
            Console.WriteLine(resolver.LastResult);
        }
Exemplo n.º 2
0
        public void BasicRoll()
        {
            var resolver = new DiceResolver
            {
                Count = 4,
                Sides = 6
            };

            resolver.Roll();
            Assert.IsTrue(resolver.LastRolls.Count == 4);
            Assert.IsTrue(resolver.LastRolls.All(x => x >= 1 && x <= 6));
            Console.WriteLine(resolver.LastResult);
        }