Пример #1
0
        public async Task RollDice(string diceNotation)
        {
            var resolver = DiceResolver.FromDiceNotation(diceNotation);

            if (resolver == null)
            {
                await ReplyAsync("Invalid dice notation");

                return;
            }

            resolver.Roll();
            await ReplyAsync(resolver.LastResult);
        }
Пример #2
0
        public void DiceNotationTests(string diceNotation, int count, int sides, DiceResolver.DiceOperation?operation, int modifier, bool?removeLowest)
        {
            var resolver = DiceResolver.FromDiceNotation(diceNotation);

            Assert.IsNotNull(resolver);

            Assert.AreEqual(resolver.Count, count);
            Assert.AreEqual(resolver.Sides, sides);
            Assert.AreEqual(resolver.Operation, operation);
            Assert.AreEqual(resolver.Modifier, modifier);
            Assert.AreEqual(resolver.RemoveLowest, removeLowest);

            resolver.Roll();
            Console.WriteLine(resolver.LastResult);
        }