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); }
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); }