public void ReturnFibonacciNumberWhenInputIsLessThanOne()
        {
            FibonacciCalculator fibonacciCalculator = new FibonacciCalculator();
            const int           ExpectedResult      = -1;
            var result = fibonacciCalculator.Fibonacci(0);

            Assert.AreEqual(ExpectedResult, result);
        }
        public void ReturnFibonacciNumberWhenRegularCase()
        {
            FibonacciCalculator fibonacciCalculator = new FibonacciCalculator();
            const int           ExpectedResult      = 2;
            var result = fibonacciCalculator.Fibonacci(3);

            Assert.AreEqual(ExpectedResult, result);
        }
        public void ReturnFibonacciNumberWhenTestFails()
        {
            FibonacciCalculator fibonacciCalculator = new FibonacciCalculator();
            const int           ExpectedResult      = -1;
            var result = fibonacciCalculator.Fibonacci(10);

            Assert.AreEqual(ExpectedResult, result);
        }
    static void Main(string[] args)
    {
        FibonacciInput      input      = new FibonacciInput();
        FibonacciCalculator calculator = new FibonacciCalculator();

        input.GetParam();
        long n = input.TotNum;

        Console.WriteLine("Fib ({0}) = {1}", n, calculator.Fibonacci(n, input.MyNumbers));
        Console.ReadKey();
    }
예제 #5
0
 public IActionResult GetFibonacci(int n)
 {
     Log.Information($"GetFibonacci method called at {DateTime.Now}");
     return(Ok(_calculator.Fibonacci(n)));
 }