public void ShouldHaveErrorIfStudentAlreadyExists() { var createStudentModel = new CreateStudentModel { StudentUsi = 234 }; _validator.ShouldHaveValidationErrorFor(csm => csm.StudentUsi, createStudentModel); }
public void ShouldHaveErrorsIfModelNotValid() { var createStudentModel = new CreateStudentModel { FirstName = null, }; _validator.ShouldHaveValidationErrorFor(csm => csm.FirstName, createStudentModel); }
public virtual ActionResult CreateStudent(CreateStudentModel createStudentModel) { if (!ModelState.IsValid) return View(createStudentModel); var student = new Student(); _enrollmentMapper.Map(createStudentModel, student); _repository.Add(student); _repository.Save(); return RedirectToAction(MVC.Enrollment.EnterAcademicDetails(createStudentModel.StudentUsi.GetValueOrDefault())); }
public void HaveEnteredValidInputForAllFields() { _createStudentModel = CreateStudentModelFactory.CreateStudent(); _academicDetailPage = _enrollmentPage.Enroll(_createStudentModel); }