static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("Please enter file name."); return; } string filename = args[0]; Console.WriteLine(File.Exists(filename) ? "File exists." : "File does not exist."); var primeFactors = new CalculatePrimeFactors(); var numbers = GetNumbers(filename); foreach (string s in numbers) { try { primeFactors.Calculate(int.Parse(s)); } catch { continue; } Console.WriteLine(string.Join(",", primeFactors.PrimeNumbers.ToArray())); } }
public void IsAnyPrimeNumbersGenerated() { var primeFactors = new CalculatePrimeFactors(); int number = 90; primeFactors.Calculate(number); Assert.IsTrue(primeFactors.PrimeNumbers.Count > 0); }