public void BuildPrimeFactorListTest() { List <int> expected = new List <int>() { 2, 2, 2, 2 }; List <int> actual = FunctionRepository.BuildPrimeFactorList(16); Assert.AreEqual(expected, actual); }
public void CheckProductsVsInputsOfTestFile() { bool actual = false; string filePath = Environment.CurrentDirectory + "\\UnitTestFile.txt"; IEnumerable <string> numbersString = File.ReadLines(filePath); IEnumerable <int> numbers = numbersString.Select(int.Parse).ToList(); numbers = numbers.Where(entry => FunctionRepository.IsPrime(entry) == false); foreach (int number in numbers) { int primeFactorListProduct = FunctionRepository.ListProduct(FunctionRepository.BuildPrimeFactorList(number)); if (primeFactorListProduct != number) { break; } actual = true; } Assert.IsTrue(actual); }