예제 #1
0
        public void FindNextBiggerNumber_ReturnNumberIsBiggerThanHighestInteger_MinusOneReturned(int initialNumber)
        {
            int actual   = NumericUtils.FindNextBiggerNumber(initialNumber);
            int expected = -1;

            Assert.AreEqual(expected, actual);
        }
예제 #2
0
        public void FindNextBiggerNumber_CorrectNumberPassed_ExecutionTimeIsApproximatelyCorrect(int initialNumber)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            NumericUtils.FindNextBiggerNumber(initialNumber, out long actualMilliseconds);
            sw.Stop();

            Assert.That(sw.ElapsedMilliseconds, Is.InRange(actualMilliseconds, actualMilliseconds + 1));
        }
예제 #3
0
 public void FindNextBiggerNumber_NonPositiveNumberPassed_ArgumentOutOfRangeExceptionThrown(int initialNumber)
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => NumericUtils.FindNextBiggerNumber(initialNumber));
 }
예제 #4
0
        public void FindNextBiggerNumber_CorrectNumberPassed_WorksCorrectly(int initialNumber, int expected)
        {
            int actual = NumericUtils.FindNextBiggerNumber(initialNumber);

            Assert.AreEqual(expected, actual);
        }