コード例 #1
0
        public void Roll_StaysWithinBounds()
        {
            var diceTray = new DiceTray("d20", "1", "0", VantageType.NoVantage);

            var actual = diceTray.Rolls;

            Assert.InRange(actual[0], 1, 20);
        }
コード例 #2
0
        public void VantageType_LimitsDiceCount(VantageType vantageType)
        {
            var diceTray = new DiceTray("d20", "5", "0", vantageType);
            int expected = 2;

            var actual = diceTray.DiceCount;

            Assert.Equal(expected, actual);
        }
コード例 #3
0
        public void Roll_LengthIsSetByDice(string diceCount)
        {
            var diceTray = new DiceTray("d20", diceCount, "0", VantageType.NoVantage);
            int expected = int.Parse(diceCount);

            var actual = diceTray.Rolls.Length;

            Assert.Equal(expected, actual);
        }
コード例 #4
0
        private void RollButton_Click(object sender, RoutedEventArgs e)
        {
            VantageType vantageType = GetVantage();
            var         diceTray    = new DiceTray(diceSelector.Text, diceCount.Text, modifier.Text, vantageType);
            var         rollMessage = new RollMessage(diceTray);
            string      message     = $"You Rolled {rollMessage.RollMade}\n" +
                                      $"Your rolls were {rollMessage.Rolls}\n" +
                                      $"Result = {rollMessage.Result}";

            MessageBox.Show(this, message, rollMessage.CritMessage);
        }