Exemplo n.º 1
0
        public void FindNextBiggerNumber_ReturnNumberIsBiggerThanHighestInteger_MinusOneReturned(int initialNumber)
        {
            int actual   = NumericUtils.FindNextBiggerNumber(initialNumber);
            int expected = -1;

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 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));
        }
Exemplo n.º 3
0
 public void FindNextBiggerNumber_NonPositiveNumberPassed_ArgumentOutOfRangeExceptionThrown(int initialNumber)
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => NumericUtils.FindNextBiggerNumber(initialNumber));
 }
Exemplo n.º 4
0
        public void FindNextBiggerNumber_CorrectNumberPassed_WorksCorrectly(int initialNumber, int expected)
        {
            int actual = NumericUtils.FindNextBiggerNumber(initialNumber);

            Assert.AreEqual(expected, actual);
        }