Пример #1
0
        public void TestStep1()
        {
            _interface.ClearResults();
            int[] options        = new int[] { 1, 9, 3, 4, 5, 6, 2, 9 };
            var   divisorChecker = new DivisorChecker(options, _interface);
            var   expectedResult = new List <string>()
            {
                "1 div 1",
                "9 div 1",
                "9 div 9",
                "9 div 3",
                "9 div 9",
                "3 div 1",
                "3 div 3",
                "4 div 1",
                "4 div 4",
                "4 div 2",
                "5 div 1",
                "5 div 5",
                "6 div 1",
                "6 div 3",
                "6 div 6",
                "6 div 2",
                "2 div 1",
                "2 div 2",
                "9 div 1",
                "9 div 9",
                "9 div 3",
                "9 div 9"
            };

            divisorChecker.FindAllDivisors(true);
            CollectionAssert.AreEqual(expectedResult, _interface.GetResults());
        }
Пример #2
0
        /// <summary>
        /// Test a basic routine
        /// </summary>
        public void Test()
        {
            var testArrayString = Console.ReadLine();
            var testArray       = testArrayString.Split(',');
            var numbers         = testArray.Select(x => Convert.ToInt32(x.Trim())).ToArray();
            var divisorChecker  = new DivisorChecker(numbers, this);

            divisorChecker.FindAllDivisors(false);
        }