Exemplo n.º 1
0
        public void find_the_sum_of_even_fibonacci_numbers_less_than_four_million()
        {
            var instance = new Problem002();

            var sum = instance.GetSumOfEvenFibonacciNumbers(4000000);

            Assert.AreEqual(4613732, sum);
        }
Exemplo n.º 2
0
        public void find_the_sum_of_even_fibonacci_numbers_less_than_ten()
        {
            var instance = new Problem002();

            var sum = instance.GetSumOfEvenFibonacciNumbers(10);

            Assert.AreEqual(10, sum);
        }
Exemplo n.º 3
0
        public void Problem002()
        {
            var problem = new Problem002()
            {
                ConsoleOutput = false, DetailedOutput = false
            };

            Assert.AreEqual(4613732, problem.Answer());
        }
Exemplo n.º 4
0
        public void determine_if_number_is_even()
        {
            var instance = new Problem002();
            var number   = Any.NumberDivisibleByTwo();

            var isNumberEven = instance.IsEven(number);

            Assert.IsTrue(isNumberEven);
        }
        public void SampleTest2()
        {
            int[] array            = { 3, 2, 1 };
            int[] expectedNewArray = { 2, 3, 6 };

            int[] actualArray = Problem002.SolveProblem(array);

            Assert.That.ArraysAreEqual(expectedNewArray, actualArray);
        }
        public void SampleTest1()
        {
            int[] array            = { 1, 2, 3, 4, 5 };
            int[] expectedNewArray = { 120, 60, 40, 30, 24 };

            int[] actualArray = Problem002.SolveProblem(array);

            Assert.That.ArraysAreEqual(expectedNewArray, actualArray);
        }
Exemplo n.º 7
0
        public void return_sum_of_even_numbers()
        {
            var instance = new Problem002();
            var number   = Any.NumberDivisibleByTwo();

            instance.AddToSumIfDivisibleByTwo(number);

            Assert.AreEqual(number, instance.RunningTotal);
        }
Exemplo n.º 8
0
 public void SetUp()
 {
     _target = new Problem002();
 }
Exemplo n.º 9
0
 static void Main(string[] args)
 {
     //Check if the user entered the question number as required
     if (args.Length == 0)
     {
         Console.Out.Write("You must enter in the question number you want solved!");
     }
     else
     {
         //Make sure the question number they entered is in the correct format
         try
         {
             int num = Int32.Parse(args[0]);
         }
         catch (Exception ex)
         {
             Console.Out.Write(ex.ToString());
             Environment.Exit(0);
         }
         //Execute the code for the desired question by accessing the class containing the desired algorithm.
         int questionNum = Int32.Parse(args[0]);
         switch(questionNum)
         {
             case 1:
                 Problem001 problem001 = new Problem001();
                 problem001.run();
                 break;
             case 2:
                 Problem002 problem002 = new Problem002();
                 problem002.run();
                 break;
             case 3:
                 Problem003 problem003 = new Problem003();
                 problem003.run();
                 break;
             case 4:
                 Problem004 problem004 = new Problem004();
                 problem004.run();
                 break;
             case 5:
                 Problem005 problem005 = new Problem005();
                 problem005.run();
                 break;
             case 6:
                 Problem006 problem006 = new Problem006();
                 problem006.run();
                 break;
             case 7:
                 Problem007 problem007 = new Problem007();
                 problem007.run();
                 break;
             case 8:
                 Problem008 problem008 = new Problem008();
                 problem008.run();
                 break;
             case 9:
                 Problem009 problem009 = new Problem009();
                 problem009.run();
                 break;
             case 10:
                 Problem010 problem010 = new Problem010();
                 problem010.run();
                 break;
             case 11:
                 Problem011 problem011 = new Problem011();
                 problem011.run();
                 break;
             case 12:
                 Problem012 problem012 = new Problem012();
                 problem012.run();
                 break;
             default:
                 Console.Out.WriteLine("The question number you entered does not exist!");
                 break;
         }
     }
 }
Exemplo n.º 10
0
        public void Problem002_Finding_Nemo_Test_3()
        {
            string act = Problem002.FindingNemo("I Nemo am");

            Assert.True(act.Equals("I found Nemo at 2!"));
        }
Exemplo n.º 11
0
        public void Problem002_Finding_Nemo_Test_1()
        {
            string act = Problem002.FindingNemo("I am finding Nemo !");

            Assert.True(act.Equals("I found Nemo at 4!"));
        }
Exemplo n.º 12
0
        public void Problem002_Finding_Nemo_Test_8()
        {
            string act = Problem002.FindingNemo("Dory , Nemo , Nemo , Marlin , Nemo");

            Assert.True(act.Equals("I found Nemo at 2!"));
        }
Exemplo n.º 13
0
        public void Problem002_Finding_Nemo_Test_7()
        {
            string act = Problem002.FindingNemo("House of Nemo's");

            Assert.True(act.Equals("I can't find Nemo :("));
        }
Exemplo n.º 14
0
        public void Problem002_Finding_Nemo_Test_6()
        {
            string act = Problem002.FindingNemo("I NeMo am");

            Assert.True(act.Equals("I can't find Nemo :("));
        }
Exemplo n.º 15
0
        public void Problem002_Finding_Nemo_Test_4()
        {
            string act = Problem002.FindingNemo("Hello Dory");

            Assert.True(act.Equals("I can't find Nemo :("));
        }
Exemplo n.º 16
0
        public void IsCorrectProblem002()
        {
            var problem = new Problem002();

            Assert.Equal(Answers["2"], problem.Solve());
        }
Exemplo n.º 17
0
 public Problem002Test()
 {
     problem002 = new Problem002();
 }
Exemplo n.º 18
0
        public void Problem002_Finding_Nemo_Test_2()
        {
            string act = Problem002.FindingNemo("Nemo is me");

            Assert.True(act.Equals("I found Nemo at 1!"));
        }