public void FiboGenerated_NumberOfElementsLessThenZero_ArgumentOutOfRangeException(int numberOfElements) { var ex = Assert.Catch <ArgumentOutOfRangeException>(() => { List <int> list = new List <int>(FibonacciNumbers.FiboGenerate(numberOfElements)); } ); StringAssert.Contains($"{nameof(numberOfElements)} must be a positive number", ex.Message); }
public void FiboGenerate_NumberOfElementsToBeGenerated_IEnumerableObjectOfFibonacciNumbers (int numberOfElements, IEnumerable <int> expectedCollection) { List <int> result = new List <int>(FibonacciNumbers.FiboGenerate(numberOfElements)); int index = 0; Assert.AreEqual(result.Count(), expectedCollection.Count()); foreach (int i in expectedCollection) { Assert.AreEqual(result.ElementAt(index++), i); } }