Ejemplo n.º 1
0
        public void Next_GivenMixedMinMax_ReturnsValueBetweenMinMax()
        {
            var min = -15;
            var max = 5;
            var safeRandomizerService = new SafeRandomizerService();
            var randomResult          = safeRandomizerService.Next(min, max);

            Assert.InRange(randomResult, min, max);
        }
Ejemplo n.º 2
0
        public void Next_GivenGreaterMinThanMax_ReturnsArgumentOutOfRange()
        {
            var min = 10;
            var max = 5;
            var safeRandomizerService = new SafeRandomizerService();

            Exception testException = null;

            try
            {
                var randomResult = safeRandomizerService.Next(min, max);
            }
            catch (Exception ex)
            {
                testException = ex;
            }

            Assert.True(testException is ArgumentOutOfRangeException, "Specifying a greater min than max value should return an ArgumentOutOfRangeException");
        }