예제 #1
0
        public void FactorFinderTest(int number, int[] expected)
        {
            FactorFinder ff = new FactorFinder();

            int[] actual = ff.GetFactors2(number);
            Assert.AreEqual(expected, actual);
        }
예제 #2
0
        public static void DisplayFactors(int number)
        {
            FactorFinder ff      = new FactorFinder();
            string       factors = "";

            int[] factorList = ff.GetFactors2(number);

            for (int i = 0; i < factorList.Length; i++)
            {
                factors += factorList[i] + "  ";
            }

            Console.WriteLine($"\nThe factors of {number} are: ");
            Console.WriteLine("|-------------------------------------------|\n");
            Console.ForegroundColor = ConsoleColor.Magenta;
            Console.WriteLine(factors + "\n");
            Console.ResetColor();
            Console.WriteLine("|-------------------------------------------|\n");

            Console.WriteLine("Press any key to continue...\n");
            Console.ReadKey();
        }