예제 #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
        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);
        }
예제 #6
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));
        }
예제 #7
0
        private static void ExecuteQuestion(int op)
        {
            IQuestion question = QuestionFactory <IQuestion> .Create(op);

            var result = question.Execute();

            if (result.ListOfResults != null)
            {
                foreach (var item in result.ListOfResults)
                {
                    Console.WriteLine(item);
                }
            }
            else
            {
                foreach (var item in result.ListResultsInt)
                {
                    Console.WriteLine(item);
                }
            }
            Console.ReadLine();
        }