Beispiel #1
0
        public void FibonacciListTests()
        {
            List <int> lst1 = new List <int> {
                1
            };
            List <int> lst2 = new List <int> {
                1, 1
            };
            List <int> lst3 = new List <int> {
                1, 1, 2
            };
            List <int> lst4 = new List <int> {
                1, 1, 2, 3
            };
            List <int> lst7 = new List <int> {
                1, 1, 2, 3, 5, 8, 13
            };
            List <int> lst10 = new List <int> {
                1, 1, 2, 3, 5, 8, 13, 21, 34, 55
            };

            CollectionAssert.AreEquivalent(lst1, MyFibonacci.FibonacciList(1));
            CollectionAssert.AreEquivalent(lst2, MyFibonacci.FibonacciList(2));
            CollectionAssert.AreEquivalent(lst3, MyFibonacci.FibonacciList(3));
            CollectionAssert.AreEquivalent(lst4, MyFibonacci.FibonacciList(4));
            CollectionAssert.AreEquivalent(lst7, MyFibonacci.FibonacciList(7));
            CollectionAssert.AreEquivalent(lst10, MyFibonacci.FibonacciList(10));
            Assert.Throws <ArgumentException>(() => MyFibonacci.FibonacciList(0));
            Assert.Throws <ArgumentException>(() => MyFibonacci.FibonacciList(-5));
        }
Beispiel #2
0
 public int FibonacciTests(int number) => MyFibonacci.Fibonacci(number);
Beispiel #3
0
 public void Fibonacci_Negative_Numbers_ThrowArgumentException()
 {
     Assert.Throws <ArgumentException>(() => MyFibonacci.FibonacciRec(-1));
     Assert.Throws <ArgumentException>(() => MyFibonacci.Fibonacci(-12));
 }
Beispiel #4
0
 public int FibonacciRecTests(int number) => MyFibonacci.FibonacciRec(number);