Ejemplo n.º 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());
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public static IEnumerable<string> FizBuzList()
 {
     DivisorChecker divChecker = new DivisorChecker();
     divChecker.RangeFrom = 1;
     divChecker.RangeTo = 100;
     divChecker.AddDivisor(3, "Fiz");
     divChecker.AddDivisor(5, "Buz");
     return divChecker.DivisorsList();
 }
Ejemplo n.º 4
0
 public void SetupFixBuzProtoForTest()
 {
     divChecker = new DivisorChecker();
     divChecker.RangeFrom = 0;
     divChecker.RangeTo = 16;
     divChecker.AddDivisor(3, tick);
     divChecker.AddDivisor(5, tack);
     divChecker.AddDivisor(7, toe);
 }
Ejemplo n.º 5
0
 public void TestNullInterface()
 {
     _interface.ClearResults();
     int[] options        = new int[] { 1, 2, 3 };
     var   divisorChecker = new DivisorChecker(options, null);
 }
Ejemplo n.º 6
0
 public void TestNullArray()
 {
     _interface.ClearResults();
     int[] options        = null;
     var   divisorChecker = new DivisorChecker(options, _interface);
 }