public void diceFormulaNumberOfDiceExtract() { DiceInterpreter diceEngine = new DiceInterpreter(); Dictionary <string, int> numberOfDice = new Dictionary <string, int>(); numberOfDice.Add("2", 0); numberOfDice.Add("1w6", 1); numberOfDice.Add("3w2+1", 3); numberOfDice.Add("9w4-3", 9); numberOfDice.Add("10w31-20", 10); numberOfDice.Add("123w456+789", 123); foreach (string testStr in numberOfDice.Keys) { int extractedDice = diceEngine.GetDiceAmount(testStr); TestContext.WriteLine("TestString: \t{0}, Extracted dice: \t{1}, Matches?: \t{2}", testStr, extractedDice, extractedDice == numberOfDice[testStr]); Assert.True(extractedDice == numberOfDice[testStr]); } }