public void Verify_Fibonacci_Terms_That_Do_Not_Exceed_OneHundred()
        {
            List <long> expected = new List <long> {
                1, 2, 3, 5, 8, 13, 21, 34, 55, 89
            };

            List <long> series = FibonacciSeriesCalculator.GetFibonacciSeriesWithValuesNotExceeding(100);

            CollectionAssert.AreEquivalent(expected, series);
        }
Esempio n. 2
0
        public long Solve(long solveFor)
        {
            List <long> series = FibonacciSeriesCalculator.GetFibonacciSeriesWithValuesNotExceeding(solveFor);
            long        sum    = 0;

            foreach (long element in series)
            {
                if (element % 2 == 0)
                {
                    sum += element;
                }
            }

            return(sum);
        }