コード例 #1
0
        public void RollIsOutOfRange()
        {
            var roller = new DiceRoller();

            //Test if max is less than 0.
            roller.Invoking(f => f.Roll(-1)).ShouldThrow <ArgumentOutOfRangeException>();

            //Test if min is less than 0.
            roller.Invoking(f => f.Roll(100, -1)).ShouldThrow <ArgumentOutOfRangeException>();

            //Test if max is less than min. (Default min is 1).
            roller.Invoking(f => f.Roll(1, 5)).ShouldThrow <ArgumentOutOfRangeException>();
        }