public void SelectContinentGeeftLandenMetKlimatogrammenDoorAanViewModel()
        {
            Jaar               jaar           = new Jaar();
            List <Continent>   continenten    = new List <Continent>();
            List <Land>        landen         = new List <Land>();
            List <Klimatogram> klimatogrammen = new List <Klimatogram>();
            Continent          continent      = new Continent {
                Naam = "Europa", ContinentId = 1
            };
            Klimatogram klimatogram = new Klimatogram("k", "w", 1.0, 2.0, 1950, 2000);

            klimatogrammen.Add(klimatogram);
            Land land = new Land {
                Naam = "België", Klimatogrammen = klimatogrammen
            };

            landen.Add(land);
            continent.Landen = landen;
            continenten.Add(continent);
            jaar.Continenten = continenten;
            PartialViewResult    result        = (PartialViewResult)controller.SelectContinent(jaar, 1);
            KlimatogramViewModel klimatogramVM = (KlimatogramViewModel)result.Model;

            Assert.AreEqual(land.Naam, klimatogramVM.Landen.ElementAt(0).Text);
            Assert.AreEqual("_LandenDropDown", result.ViewName);
        }
        public void SelectKlimatogramGeeftKlimatogramDoorAanViewModel()
        {
            PartialViewResult    result        = controller.SelectKlimatogram(dummyContext.klimatogramID) as PartialViewResult;
            KlimatogramViewModel klimatogramVM = result.Model as KlimatogramViewModel;

            Assert.AreEqual(dummyContext.klimatogramID, klimatogramVM.Klimatogram.KlimatogramId);
            Assert.AreEqual("_Klimatogram", result.ViewName);
        }
        public ActionResult SelectKlimatogram(int selectedKlimatogramId)
        {
            var klimatogramViewModels = new KlimatogramViewModel
            {
                Klimatogram = _klimatogramRepository.Get(selectedKlimatogramId)
            };

            return(PartialView("_Klimatogram", klimatogramViewModels));
        }
        public void SelectLandGeeftKlimatogrammenDoorAanViewModel()
        {
            PartialViewResult    result        = controller.SelectLand(dummyContext.landID) as PartialViewResult;
            KlimatogramViewModel klimatogramVM = result.Model as KlimatogramViewModel;

            Assert.AreEqual(dummyContext.Klimatogrammen.ElementAt(0).Naam, klimatogramVM.Klimatogrammen.ElementAt(0).Text);
            Assert.AreEqual(dummyContext.Klimatogrammen.ElementAt(1).Naam, klimatogramVM.Klimatogrammen.ElementAt(1).Text);
            Assert.AreEqual("_KlimatogrammenDropDown", result.ViewName);
        }
        public ActionResult SelectLand(int selectedLandId)
        {
            var klimatogramViewModels = new KlimatogramViewModel
            {
                Klimatogrammen =
                    new SelectList(_landRepository.Get(selectedLandId).Klimatogrammen.OrderBy(x => x.Naam),
                                   "KlimatogramId", "Naam")
            };

            return(PartialView("_KlimatogrammenDropDown", klimatogramViewModels));
        }
        public ActionResult SelectContinent(Jaar jaar, int selectedContinentId)
        {
            var klimatogramViewModels = new KlimatogramViewModel
            {
                Landen =
                    new SelectList(
                        jaar.Continenten.First(i => i.ContinentId == selectedContinentId)
                        .Landen.Where(e => e.Klimatogrammen.Count > 0)
                        .OrderBy(x => x.Naam), "LandId", "Naam")
            };

            return(PartialView("_LandenDropDown", klimatogramViewModels));
        }
예제 #7
0
        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);
        }