public void GetPairs_NotAll_ReturnsListContainingFirstValidPair() { var expectedPairList = new List <Tuple <int, int> > { new Tuple <int, int>(3, 7) }; var testCalculator = new GoldbachPairCalculator(TestCache); var calculatedPairList = testCalculator.GetPairsFor(10).ToList(); Assert.AreEqual(expectedPairList.Count, calculatedPairList.Count); CollectionAssert.AreEqual(expectedPairList, testCalculator.GetPairsFor(10)); }
static void Main(string[] args) { string inputNumber; int castNumber; if (!args.Any()) { Console.Write("No number specidied in arguments. Please enter a number: "); inputNumber = Console.ReadLine(); } else { inputNumber = args.First(); } try { castNumber = InputValidator.ValidateAndConvert(inputNumber); } catch (Exception ex) { Console.WriteLine($"Validation or conversion failed. Exception message was:\n{ex.Message}"); Console.ReadLine(); return; } var calculator = new GoldbachPairCalculator(); Console.WriteLine($"Goldbach pairs for {castNumber}:"); foreach (var pair in calculator.GetPairsFor(castNumber, args.CheckFor(AllPairArguments))) { Console.WriteLine($"{pair.Item1} & {pair.Item2}"); } #if DEBUG Console.ReadLine(); #endif }