// static Dictionary<int, int> _CollatzLookup; static void Main(string[] args) { Console.WriteLine("Starting"); IUserInputOutput userInputOutput = new FileUserInputOutput(_fileOutLocation); IChallengeCalculator challengeCalculator = new Computer(); var inputs = userInputOutput.ReadInput(); var outputs = new HashSet<Output>(); var stopwatch = new Stopwatch(); stopwatch.Start(); foreach (var input in inputs) { var maxCycle = challengeCalculator.CalculateMaxCycles(input); outputs.Add(new Output { Input = input, MaxCycle = maxCycle }); } stopwatch.Stop(); Console.WriteLine(stopwatch.Elapsed); Console.WriteLine("Completed"); userInputOutput.PrintOutput(outputs); Console.WriteLine("Completed"); Console.ReadLine(); }
public void ReadFromFileInAppConfigTest() { var fileReader = new FileUserInputOutput(_fileOutLocation); var inputs = fileReader.ReadInput(); IEnumerable<Input> expected = new HashSet<Input> { new Input { Start = 1, End = 10 } }; CollectionAssert.AreEqual(expected.ToList(), inputs.ToList()); }