Exemple #1
0
        private static int FindSum()
        {
            Console.Write("Type number: ");

            string input = Console.ReadLine();

            if (input != null && input.All(char.IsNumber) == false)
            {
                clearConsole(1);
                return(FindSum());
            }

            int limit = int.Parse(input);

            return(SumOfMultiples.Until(limit));
        }
Exemple #2
0
 public void TestBottomLimit()
 {
     Assert.AreEqual(15, SumOfMultiples.Until(16));
     Assert.AreEqual(45, SumOfMultiples.Until(31));
     Assert.AreEqual(90, SumOfMultiples.Until(46));
 }
Exemple #3
0
 public void TestTopLimit()
 {
     Assert.AreEqual(15, SumOfMultiples.Until(30));
     Assert.AreEqual(45, SumOfMultiples.Until(45));
 }
Exemple #4
0
 public void TestZero()
 {
     Assert.AreEqual(0, SumOfMultiples.Until(0));
 }