コード例 #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);
        }