public ActionResult StapTerug(Leerling leerling) { if ((!leerling.IsActief) || (leerling.DeterminatieTabel == null)) return RedirectToAction("Index", "Home"); if (leerling.GekozenLocatie == null) return RedirectToAction("Index", "Klimatogram"); if (!leerling.DeterminatieTabel.IsBegin()) leerling.DeterminatieTabel.StapTerug(); return Json(new DeterminatieTreeViewModel(leerling.DeterminatieTabel), JsonRequestBehavior.AllowGet); }
public ActionResult StapVerder(Leerling leerling, bool antwoord) { if ((!leerling.IsActief) || (leerling.DeterminatieTabel == null)) return RedirectToAction("Index", "Home"); if (leerling.GekozenLocatie == null) return RedirectToAction("Index", "Klimatogram"); if (!leerling.DeterminatieTabel.IsCompleet()) leerling.DeterminatieTabel.StapVerder(antwoord); return Json(new DeterminatieTreeViewModel(leerling.DeterminatieTabel), JsonRequestBehavior.AllowGet); }
public ActionResult GetKenmerk(Leerling leerling) { if ((!leerling.IsActief) || (leerling.DeterminatieTabel == null)) return RedirectToAction("Index", "Home"); if (leerling.GekozenLocatie == null) return RedirectToAction("Index", "Klimatogram"); return Json(new KenmerkViewModel( leerling.DeterminatieTabel.DetermineerKenmerk(leerling.GekozenLocatie.Klimatogram)), JsonRequestBehavior.AllowGet); }
//Index pagina waar beslist wordt wat er moet gebeuren //Hier is er geen view van deze fungeert enkel en alleen //als director die zegt waar naar toe. public ActionResult Index(Leerling leerling) { if (!leerling.IsActief) return RedirectToAction("Index", "Home"); if (leerling.Graad == Graad.graad1 || leerling.Graad == Graad.graad2) return RedirectToAction("KlimatogramSelecteren"); else return RedirectToAction("StopApplicatie", "Home"); }
public ActionResult StopApplicatie(Leerling leerling) { if (leerling == null) leerling = new Leerling(); leerling.IsActief = false; leerling.DeterminatieTabel = null; leerling.GekozenLocatie = null; return RedirectToAction("Index", "Home"); }
public ActionResult Index(Leerling leerling) { if ((!leerling.IsActief) || (leerling.DeterminatieTabel == null)) return RedirectToAction("Index", "Home"); if (leerling.GekozenLocatie == null) return RedirectToAction("Index", "Klimatogram"); ViewBag.Graad = leerling.Graad.ToString(); ViewBag.Jaar = leerling.Jaar.ToString(); return View(); }
public ActionResult KlimatogramSelecteren(Leerling leerling) { if (!leerling.IsActief) return RedirectToAction("Index", "Home"); if (leerling.Graad == Graad.graad3) return RedirectToAction("StopApplicatie", "Home"); ViewBag.Graad = leerling.Graad.ToString(); ViewBag.Jaar = leerling.Jaar.ToString(); return View(); }
public void TestGetKlimatogramMetLeerlingIsActiefGekozenLocatieIsNull() { Leerling l = new Leerling(); l.IsActief = true; var result = controller.GetKlimatogram(l) as RedirectToRouteResult; Assert.IsNull(l.GekozenLocatie); Assert.AreEqual("Index", result.RouteValues["Action"]); }
public void TestGetContinentenMetLeerlingNietActief() { Leerling l = new Leerling(); l.IsActief = false; var result = controller.GetContinenten(l) as RedirectToRouteResult; Assert.IsFalse(l.IsActief); Assert.AreEqual("Index", result.RouteValues["Action"]); Assert.AreEqual("Home", result.RouteValues["Controller"]); }
public void StartApplicatieZetLeerlingGraadEnJaarCorrect() { //Arrange Leerling leerling = new Leerling(); //Act var result = controller.StartApplicatie(leerling, Graad.graad2, Jaar.jaar1) as RedirectToRouteResult; //Assert Assert.AreEqual(Graad.graad2, leerling.Graad); Assert.AreEqual(Jaar.jaar1, leerling.Jaar); }
public void StartApplicatieRedirectNaarIndexVanKlimatogramController() { //Arrange Leerling leerling = new Leerling(); //Act var result = controller.StartApplicatie(leerling, Graad.graad2, Jaar.jaar1) as RedirectToRouteResult; //Assert Assert.IsNotNull(result, "Result is null"); Assert.AreEqual("Index", result.RouteValues["Action"]); Assert.AreEqual("Klimatogram", result.RouteValues["Controller"]); }
public ActionResult SelecteerLocatie(Leerling leerling, string continentNaam, string landNaam, string locatieNaam) { if (!leerling.IsActief) return RedirectToAction("Index", "Home"); leerling.GekozenLocatie = continentRepository.GeefLocatie(continentNaam, landNaam, locatieNaam); //if (leerling.GekozenLocatie != null) return RedirectToAction("ToonKlimatogram"); if (leerling.GekozenLocatie != null) { if (leerling.Graad == Graad.graad1) return RedirectToAction("ToonVragenEersteGraad"); else return RedirectToAction("Index", "Determinatie"); } return RedirectToAction("Index"); }
public void TestGetContinentenMetLeerlingIsActiefGraad2() { Leerling l = new Leerling(); l.Graad = Graad.graad2; l.IsActief = true; var result = controller.GetContinenten(l) as JsonResult; IEnumerable<ContinentViewModel> continenten = (IEnumerable<ContinentViewModel>) result.Data; Assert.AreEqual("Afrika", continenten.ElementAt(0).Naam); Assert.AreEqual("Europa", continenten.ElementAt(1).Naam); }
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { Leerling leerling = controllerContext.HttpContext.Session[LeerlingSessionKey] as Leerling; if (leerling == null) { leerling = new Leerling(); leerling.IsActief = false; leerling.DeterminatieTabel = null; leerling.GekozenLocatie = null; leerling.AantalPogingenVragen = null; controllerContext.HttpContext.Session[LeerlingSessionKey] = leerling; } return leerling; }
public void StartApplicatieZetLeerlingDeterminatieTreeOpDeCorrecteTree() { //Arrange Leerling leerling = new Leerling(); //Act leerling.DeterminatieTabel = null; var result = controller.StartApplicatie(leerling, Graad.graad2, Jaar.jaar1) as RedirectToRouteResult; DeterminatieTree created = ((DeterminatieTreeRepositoryDummy) determinatieTreeRepository).GetCurrent(); //Assert Assert.AreEqual(created, leerling.DeterminatieTabel); }
public void TestGetKlimatogramMetLeerlingActiefGekozenLocatieIsNotNull() { Leerling l = new Leerling(); l.IsActief = true; l.GekozenLocatie = continentRepository.GeefLocatie("Europa", "België", "Gent-Melle");//eventueel new object van locatie var result = controller.GetKlimatogram(l) as JsonResult; KlimatogramViewModel klimatogram = (KlimatogramViewModel) result.Data; Assert.AreEqual("Europa", klimatogram.ContinentNaam); Assert.AreEqual("België", klimatogram.LandNaam); Assert.AreEqual("Gent-Melle", klimatogram.LocatieNaam); }
public ActionResult IsDeterminatieCorrect(Leerling leerling, string klimaat) { if ((!leerling.IsActief) || (leerling.DeterminatieTabel == null)) return RedirectToAction("Index", "Home"); if (leerling.GekozenLocatie == null) return RedirectToAction("Index", "Klimatogram"); if (leerling.DeterminatieTabel.IsCompleet()) { leerling.DeterminatieTabel.GaNaarLaatsteCorrecteStap(leerling.GekozenLocatie.Klimatogram); return Json( (klimaat.Equals( leerling.DeterminatieTabel.DetermineerKenmerk(leerling.GekozenLocatie.Klimatogram) .KlimaatKenmerk)), JsonRequestBehavior.AllowGet); } return Json(false, JsonRequestBehavior.AllowGet); }
public ActionResult StartApplicatie(Leerling leerling, Graad graad, Jaar jaar) { try { if (leerling == null) leerling = new Leerling(); leerling.Graad = graad; leerling.Jaar = jaar; leerling.IsActief = true; leerling.GekozenLocatie = null; leerling.DeterminatieTabel = determinatieTreeRepository.FindByGraad(graad).FirstOrDefault(); return RedirectToAction("Index", "Klimatogram"); } catch (Exception ex) { ModelState.AddModelError("StartApplicatie", ex.Message); return View("Index"); } }
public void StartApplicatieZetLeerlingLocatieOpNull() { //Arrange Leerling leerling = new Leerling(); //Act leerling.GekozenLocatie = new Locatie("Test"); var result = controller.StartApplicatie(leerling, Graad.graad2, Jaar.jaar1) as RedirectToRouteResult; //Assert Assert.IsNull(leerling.GekozenLocatie); }
public void TestKlimatogramSelecterenMetLeerlingGraad2Jaar2() { Leerling l = new Leerling(); l.Graad = Graad.graad2; l.Jaar = Jaar.jaar2; l.IsActief = true; var result = controller.KlimatogramSelecteren(l) as ViewResult; Assert.IsNotNull(result); Assert.AreEqual(Graad.graad2.ToString(), result.ViewBag.Graad); Assert.AreEqual(Jaar.jaar2.ToString(), result.ViewBag.Jaar); }
public void StopApplicatieZetLeerlingOpNietActiefMetLeerlingMetIsActiefTrue() { //Arrange Leerling leerling = new Leerling(); leerling.IsActief = true; //Act var result = controller.StopApplicatie(leerling) as RedirectToRouteResult; //Assert Assert.IsFalse(leerling.IsActief); }
public void StopApplicatieRedirectNaarIndexVanHomeControllerMetLeerlingMetIsActiefTrue() { //Arrange Leerling leerling = new Leerling(); leerling.IsActief = true; //Act var result = controller.StopApplicatie(leerling) as RedirectToRouteResult; //Assert Assert.IsNotNull(result, "Result is null"); Assert.AreEqual("Index", result.RouteValues["Action"]); Assert.AreEqual("Home", result.RouteValues["Controller"]); }
public void StartApplicatieZetLeerlingOpActief() { //Arrange Leerling leerling = new Leerling(); leerling.IsActief = false; //Act var result = controller.StartApplicatie(leerling, Graad.graad2, Jaar.jaar1) as RedirectToRouteResult; //Assert Assert.IsTrue(leerling.IsActief); }
public void TestKlimatogramSelecterenMetLeerlingGraad3() { Leerling l = new Leerling(); l.Graad = Graad.graad3; l.IsActief = true; var result = controller.KlimatogramSelecteren(l) as RedirectToRouteResult; Assert.IsTrue(l.IsActief); Assert.AreEqual("StopApplicatie", result.RouteValues["Action"]); Assert.AreEqual("Home", result.RouteValues["Controller"]); }
public void NaConstructieIsIsActiefFalse() { Leerling leerling = new Leerling(); Assert.IsFalse(leerling.IsActief); }
public void NaConstructieIsHetJaar1() { Leerling leerling = new Leerling(); Assert.AreEqual(Jaar.jaar1, leerling.Jaar); }
public void NaConstructieIsDeGraad1() { Leerling leerling = new Leerling(); Assert.AreEqual(Graad.graad1, leerling.Graad); }
public void TestSelecteerLocatieMetLeerlingIsActiefGekozenLocatieIsNotNull() { Leerling l = new Leerling(); l.IsActief = true; var result = controller.SelecteerLocatie(l, "Europa", "België", "Ukkel") as RedirectToRouteResult; Assert.IsNotNull(l.GekozenLocatie); Assert.AreEqual("ToonKlimatogram", result.RouteValues["Action"]); }
public void TestSelecteerLocatieMetLeerlingNietActief() { Leerling l = new Leerling(); l.IsActief = false; var result = controller.SelecteerLocatie(l, "Europa", "België", "Ukkel") as RedirectToRouteResult; Assert.IsFalse(l.IsActief); Assert.AreEqual("Index", result.RouteValues["Action"]); Assert.AreEqual("Home", result.RouteValues["Controller"]); }
public void TestToonKlimatogramMetLeerlingGraad3() { Leerling l = new Leerling(); l.Graad = Graad.graad3; l.IsActief = true; var result = controller.ToonKlimatogram(l) as RedirectToRouteResult; Assert.IsTrue(l.IsActief); Assert.AreEqual("Index", result.RouteValues["Action"]); }