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"); }
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"); }
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"); }
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"); }
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); }
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)); }
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(); }