Beispiel #1
0
        public void Edit_WithParameters_Test()
        {
            // ARRANGE
            FieldOfStudyService    service    = new FieldOfStudyService(ctxDb);
            FieldOfStudyController controller = SetupFosController(service).Result;

            service.AddRichting("MBP", "model bachelor programmeren", "bachelor");
            var fosId = ctxDb.FieldOfStudy.Where(fos => fos.RichtingCode == "MBP").FirstOrDefault().Id;

            // ACT
            var res = controller.Edit(fosId, "MGP", "model graduaat programmeren", "graduaat");

            // ACCEPT
            Assert.IsTrue(res is ActionResult);
            var fos = ctxDb.FieldOfStudy.Find(fosId);

            Assert.AreEqual("MGP", fos.RichtingCode);
            Assert.AreEqual("model graduaat programmeren", fos.RichtingTitel);
            Assert.AreEqual("graduaat", fos.Type);
        }
Beispiel #2
0
        public void Edit_GetTheFieldOfStudy_Test()
        {
            // ARRANGE
            FieldOfStudyService    service    = new FieldOfStudyService(ctxDb);
            FieldOfStudyController controller = SetupFosController(service).Result;

            service.AddRichting("MBP", "model bachelor programmeren", "bachelor");
            var fosId = ctxDb.FieldOfStudy.Where(fos => fos.RichtingCode == "MBP").FirstOrDefault().Id;

            // ACT
            var res = controller.Edit(fosId);

            // ASSERT
            Assert.IsTrue(res is ActionResult);
            var vRes = (ViewResult)res;

            Assert.IsNotNull(vRes.Model);
            var model = (FieldOfStudy)vRes.Model;

            Assert.AreEqual("MBP", model.RichtingCode);
        }