Пример #1
0
        public void TestDesafio6()
        {
            QuestionFactory <IQuestion> .Register(6, () => new SixthQuestion("SKY"));

            IQuestion question = QuestionFactory <IQuestion> .Create(6);

            var result = question.Execute();

            Assert.AreEqual(10, result.ListResultsInt[0], "Válido");
        }
Пример #2
0
        public void TestDesafio3()
        {
            QuestionFactory <IQuestion> .Register(3, () => new ThirdQuestion());

            IQuestion question = QuestionFactory <IQuestion> .Create(3);

            var result = question.Execute();

            Assert.AreEqual(10946, result.ListResultsInt[0], "Válido");
        }
Пример #3
0
        public void TestDesafio2()
        {
            QuestionFactory <IQuestion> .Register(2, () => new SecondQuestion(new int[] { 1, 2, 3, 4, 5 }));

            IQuestion question = QuestionFactory <IQuestion> .Create(2);

            var result = question.Execute();

            Assert.AreEqual(55, result.ListResultsInt[0], "Válido");
        }
Пример #4
0
        public void TestDesafio1()
        {
            QuestionFactory <IQuestion> .Register(1, () => new FirstQuestion("Renan", "Tavares"));

            IQuestion question = QuestionFactory <IQuestion> .Create(1);

            var result = question.Execute();
            var count  = result.ListOfResults.Count;

            Assert.AreEqual(100, count, "Válido");
        }
Пример #5
0
        private static bool Menu()
        {
            Console.Clear();
            Console.WriteLine("Qual desafio deseja acessar?:");
            Console.WriteLine("1) Desafio 1 - Exibir nome e sobrenome ao lado de multiplos");
            Console.WriteLine("2) Desafio 2 - Soma De Quadrados");
            Console.WriteLine("3) Desafio 3 - Sequencia Fibonnaci");
            Console.WriteLine("4) Desafio 4 - Árvore e nós");
            Console.WriteLine("5) Desafio 5 - Não implementado");
            Console.WriteLine("6) Desafio 6 - Números Triangulos");
            Console.WriteLine("0) Sair");
            Console.Write("\r\nSelecione uma opção: ");

            switch (Console.ReadLine())
            {
            case "1":
                QuestionFactory <IQuestion> .Register(1, () => new FirstQuestion("Renan", "Tavares"));

                ExecuteQuestion(1);
                return(true);

            case "2":
                QuestionFactory <IQuestion> .Register(2, () => new SecondQuestion(new int[] { 1, 2, 3, 4, 5 }));

                ExecuteQuestion(2);
                return(true);

            case "3":
                QuestionFactory <IQuestion> .Register(3, () => new ThirdQuestion());

                ExecuteQuestion(3);
                return(true);

            case "4":
                QuestionFactory <IQuestion> .Register(4, () => new FourthQuestion(TreeDomain.GenerateTree(), 9));

                ExecuteQuestion(4);
                return(true);

            case "5":
                Console.WriteLine("Não implementado");
                return(false);

            case "6":
                QuestionFactory <IQuestion> .Register(6, () => new SixthQuestion("SKY"));

                ExecuteQuestion(6);
                return(true);

            default:
                return(false);
            }
        }
Пример #6
0
        public void TestDesafio4()
        {
            QuestionFactory <IQuestion> .Register(4, () => new FourthQuestion(TreeDomain.GenerateTree(), 9));

            IQuestion question = QuestionFactory <IQuestion> .Create(4);

            var result = question.Execute();

            int[] actual = result.ListResultsInt.ToArray();
            Array.Reverse(actual);
            CollectionAssert.AreEqual(new int[] { 1, 4, 2, 12, 13, 9 }, actual);
        }
Пример #7
0
        public ActionResult Challenge()
        {
            ViewBag.Message = "Desafio 4.";
            QuestionFactory <IQuestion> .Register(4, () => new FourthQuestion(TreeDomain.GenerateTree(), 9));

            IQuestion question = QuestionFactory <IQuestion> .Create(4);

            var result = question.Execute();
            var model  = new DesafioModel();

            model.Resultado = result.ListResultsInt.ToArray();
            return(View(model));
        }