Esempio n. 1
0
        public void Step1()
        {
            ExerciseClass exerciseClass = new ExerciseClass();
            String        input1        = String.Empty;
            String        input2        = "1";
            String        input3        = "1,2";

            try
            {
                Assert.AreEqual(exerciseClass.Add(input1), 0);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }

            try
            {
                Assert.AreEqual(exerciseClass.Add(input2), 1);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }

            try
            {
                Assert.AreEqual(exerciseClass.Add(input3), 3);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Esempio n. 2
0
        public void Step3()
        {
            ExerciseClass exerciseClass = new ExerciseClass();
            String        input1        = "1,2,5,11,45,96,83,115,-300";

            try
            {
                Assert.AreEqual(exerciseClass.Add(input1), 658);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(exerciseClass.Add(input1), -300);
            }
        }
Esempio n. 3
0
        public void Step5()
        {
            ExerciseClass exerciseClass = new ExerciseClass();
            String        input1        = "//[***]//1***2***3";

            try
            {
                Assert.AreEqual(exerciseClass.Add(input1), 6);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Esempio n. 4
0
        public void Step4()
        {
            ExerciseClass exerciseClass = new ExerciseClass();
            String        input1        = "1000,2";

            try
            {
                Assert.AreEqual(exerciseClass.Add(input1), 2);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Esempio n. 5
0
        public void Step7()
        {
            ExerciseClass exerciseClass = new ExerciseClass();
            String        input1        = "//[AAA][BBB]//1AAA2BBB3";

            try
            {
                Assert.AreEqual(exerciseClass.Add(input1), 6);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            ExerciseClass exerciseClass = new ExerciseClass();

            Console.WriteLine("STEP 1");
            try
            {
                Console.WriteLine("INPUT: {0} OUTPUT: {1}", "EMPTY", exerciseClass.Add(String.Empty));
                Console.WriteLine("INPUT: {0} OUTPUT: {1}", "1", exerciseClass.Add("1"));
                Console.WriteLine("INPUT: {0} OUTPUT: {1}", "1,2", exerciseClass.Add("1,2"));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine("STEP 2");
            try
            {
                Console.WriteLine("INPUT: {0} OUTPUT: {1}", "1,2,5,11,45,96,83,115,300", exerciseClass.Add("1,2,5,11,45,96,83,115,300"));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine("STEP 3");
            try
            {
                Console.WriteLine("INPUT: {0} OUTPUT: {1}", "1,2,5,11,45,96,83,115,-300", exerciseClass.Add("1,2,5,11,45,96,83,115,-300"));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine("STEP 4");
            try
            {
                Console.WriteLine("INPUT: {0} OUTPUT: {1}", "1000,2", exerciseClass.Add("1000,2"));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine("STEP 5");
            try
            {
                Console.WriteLine("INPUT: {0} OUTPUT: {1}", "//[***]//1***2***3", exerciseClass.Add("//[***]//1***2***3"));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine("STEP 6");
            try
            {
                Console.WriteLine("INPUT: {0} OUTPUT: {1}", "//[*][%]//1*2%3", exerciseClass.Add("//[*][%]//1*2%3"));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine("STEP 7");
            try
            {
                Console.WriteLine("INPUT: {0} OUTPUT: {1}", "//[AAA][BBB]//1AAA2BBB3", exerciseClass.Add("//[AAA][BBB]//1AAA2BBB3"));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.ReadLine();
        }