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);
        }
예제 #3
0
        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()));
        }
예제 #4
0
 public void HaveEnteredValidInputForAllFields()
 {
     _createStudentModel = CreateStudentModelFactory.CreateStudent();
     _academicDetailPage = _enrollmentPage.Enroll(_createStudentModel);
 }