public void Tests(int x, int y, int d, int expected)
        {
            FrogJump jump   = new FrogJump();
            var      result = jump.Solution(x, y, d);

            Assert.AreEqual(expected, result);
        }
Esempio n. 2
0
        public void XSmallerThenYTest()
        {
            bool catchException = false;

            try
            {
                FrogJump.Solution(15, 4, 5);
            }
            catch (ArgumentException)
            {
                catchException = true;
            }

            if (catchException)
            {
                Assert.Pass();
            }
            else
            {
                Assert.Fail();
            }
        }
Esempio n. 3
0
        public void TestFrogJump()
        {
            int s = _frogJump.Solution(10, 85, 30);

            Assert.AreEqual(3, s);
        }
Esempio n. 4
0
        public void NumberOutOfRangeTest()
        {
            int catchException = 0;

            try
            {
                FrogJump.Solution(int.MaxValue, 5, 5);
            }
            catch (ArgumentOutOfRangeException)
            {
                catchException++;
            }

            try
            {
                FrogJump.Solution(5, int.MaxValue, 5);
            }
            catch (ArgumentOutOfRangeException)
            {
                catchException++;
            }

            try
            {
                FrogJump.Solution(5, 5, int.MaxValue);
            }
            catch (ArgumentOutOfRangeException)
            {
                catchException++;
            }


            try
            {
                FrogJump.Solution(0, 5, 5);
            }
            catch (ArgumentOutOfRangeException)
            {
                catchException++;
            }
            try
            {
                FrogJump.Solution(5, 0, 5);
            }
            catch (ArgumentOutOfRangeException)
            {
                catchException++;
            }
            try
            {
                FrogJump.Solution(0, 0, 0);
            }
            catch (ArgumentOutOfRangeException)
            {
                catchException++;
            }
            try
            {
                FrogJump.Solution(5, 5, 0);
            }
            catch (ArgumentOutOfRangeException)
            {
                catchException++;
            }

            if (catchException == 7)
            {
                Assert.Pass();
            }
            else
            {
                Assert.Fail();
            }
        }
Esempio n. 5
0
 public void ZeroJumpTest()
 {
     Assert.AreEqual(0, FrogJump.Solution(30, 30, 10));
 }
Esempio n. 6
0
 public void OneJumpTest()
 {
     Assert.AreEqual(1, FrogJump.Solution(30, 60, 80));
 }
Esempio n. 7
0
 public void WitheZeroStartTest()
 {
     Assert.AreEqual(128, FrogJump.Solution(1, 256, 2));
 }
Esempio n. 8
0
 public void ExactlyOnPostionTest()
 {
     Assert.AreEqual(2, FrogJump.Solution(20, 50, 15));
 }
Esempio n. 9
0
 public void ExampleTest()
 {
     Assert.AreEqual(3, FrogJump.Solution(10, 85, 30));
 }