public void ShouldHaveErrorsIfModelNotValidWithNulls()
        {
            var academicDetailModel = new AcademicDetailModel();

            _validator.ShouldHaveValidationErrorFor(adm => adm.AnticipatedGrade, academicDetailModel);
            _validator.ShouldHaveValidationErrorFor(adm => adm.EntryDate, academicDetailModel);
        }
Пример #2
0
        public virtual ActionResult EnterAcademicDetails(int id)
        {
            var model = new AcademicDetailModel{StudentUsi = id};
            
            if (StudentDoesNotExist(id))
                return RedirectToAction(MVC.Error.General());

            return View(model);
        }
 public void ShouldHaveErrorsIfModelNotValidWithGradesOutOfRange()
 {
     var academicDetailModel = new AcademicDetailModel
     {
         Reading = TooLongNumber,
         Math = TooManyDecimals,
         Writing = NegativeNumber
     };
     _validator.ShouldHaveValidationErrorFor(adm => adm.Reading, academicDetailModel);
     _validator.ShouldHaveValidationErrorFor(adm => adm.Writing, academicDetailModel);
     _validator.ShouldHaveValidationErrorFor(adm => adm.Math, academicDetailModel);
 }
        public void ShouldHaveErrorsWhenCreatingDuplicateAcademicDetailEntities()
        {
            var academicDetailModel = new AcademicDetailModel
            {
                StudentUsi = 1,
                SchoolYear = SchoolYearTypeEnum.Year1990
            };

            _repository
                .Get(Arg.Any<Web.Data.Queries.StudentAcademicDetailsByStudentUsiAndSchoolYearQuery>())
                .Returns(new StudentAcademicDetail());

            _validator.ShouldHaveValidationErrorFor(adm => adm.SchoolYear, academicDetailModel);
        }
Пример #5
0
        public virtual ActionResult EnterAcademicDetails(AcademicDetailModel academicDetailModel, int id)
        {
            if (!ModelState.IsValid)
                return View(academicDetailModel);

            var fileCategory = ((int)academicDetailModel.SchoolYear).ToString(CultureInfo.InvariantCulture);
            var performanceHistoryFileName = _fileUploader.Upload(academicDetailModel.PerformanceHistoryFile, id, fileCategory, "performanceHistory");
                    
            var studentAcademicDetail = _academicDetailMapper.Build(academicDetailModel,
                adm =>
                {
                    adm.StudentUSI = id;
                    adm.PerformanceHistoryFile = performanceHistoryFileName;
                });

            var studentSchoolAssociation = _schoolAssociationMapper.Build(academicDetailModel);

            _repository.Add(studentAcademicDetail);
            _repository.Add(studentSchoolAssociation);
            _repository.Save();
            return RedirectToAction(MVC.Enrollment.EnterProgramStatus(id));
        }
        public void ShouldHaveErrorsForDuplicateStudentSchoolAssociation()
        {
            var academicDetailModel = new AcademicDetailModel
            {
                EntryDate = new DateTime(2014, 07, 07)
            };
            
            _repository
                .Get(Arg.Any<Expression<Func<StudentSchoolAssociation, bool>>>())
                .Returns(new StudentSchoolAssociation());

            _validator.ShouldHaveValidationErrorFor(adm => adm.EntryDate, academicDetailModel);
        }