public void ShouldMap() { var student = new StudentBuilder().WithFirstName("Hugo").WithLastSurname("Range").Build(); var gradeModel = new StudentToGradeModelMapper().Build(student); gradeModel.StudentFirstName.ShouldBe(student.FirstName); gradeModel.StudentLastName.ShouldBe(student.LastSurname); gradeModel.StudentUSI.ShouldBe(student.StudentUSI); }
public void ShouldNotMapStudentProgramStatusIfItDoesNotExist() { SetupWithDownloaderReturning(""); var student = new StudentBuilder().WithParent().Build(); student.StudentProgramStatus = null; var profileModel = new ProfileModel(); _mapper.Map(student, profileModel); profileModel.ProgramStatus.ShouldBe(null); }
public void ShouldMap() { var student = new StudentBuilder().Build(); var takeAttendanceModel = new TakeAttendanceModelBuilder().WithStudent(student).Build(); var section = new SectionBuilder().WithStudent(student).Build(); var mapper = new TakeAttendanceModelToStudentSectionAttendanceEventListMapper(); var studentSectionAttendanceEventList = mapper.Build(takeAttendanceModel, section).ToList(); studentSectionAttendanceEventList.First().StudentUSI.ShouldBe(student.StudentUSI); studentSectionAttendanceEventList.First().Student.ShouldBe(student); }
public void ShouldMapStudentToProfileModelWithDifferentParentAddress() { SetupWithDownloaderReturning(""); var parent = new ParentBuilder().WithAddress().WithPhoneNumber().Build(); var student = new StudentBuilder().WithParent(parent, false).Build(); var profileModel = new ProfileModel(); _mapper.Map(student, profileModel); NativeStudentPropertiesShouldBeMapped(student, profileModel); NativeParentPropertiesShouldBeMapped(parent, profileModel.EditProfileParentModel); ParentAddressShouldBeMapped(parent, profileModel); StudentParentAssociationShouldBeMapped(student, profileModel); }
public void ShouldMap() { var student = new StudentBuilder() .WithFirstName("Hugo") .WithLastSurname("Range") .WithStudentUsi(12345) .Build(); var parentCourseGrade = new ParentCourseGradeBuilder().WithStudent(student).Build(); var gradeModel = new ParentCourseGradeToGradeModelMapper().Build(parentCourseGrade); gradeModel.StudentFirstName.ShouldBe(student.FirstName); gradeModel.StudentLastName.ShouldBe(student.LastSurname); gradeModel.StudentUSI.ShouldBe(student.StudentUSI); gradeModel.Grade.ShouldBe(parentCourseGrade.GradeEarned); }
public void ShouldMapStudentToProfileModel() { SetupWithDownloaderReturning(""); var student = new StudentBuilder().WithParent().WithStudentProgramStatus().WithAttendanceFlags(1).Build(); var parent = student.StudentParentAssociations.First().Parent; var profileModel = new ProfileModel(); _mapper.Map(student, profileModel); NativeStudentPropertiesShouldBeMapped(student, profileModel); NativeParentPropertiesShouldBeMapped(parent, profileModel.EditProfileParentModel); AddressShouldBeMapped(student.StudentAddresses.First(), profileModel); StudentParentAssociationShouldBeMapped(student, profileModel); profileModel.ProgramStatus.ShouldNotBe(null); _studentAttendancePercentageMapperMock.Received().Map(Arg.Any<IList<StudentSectionAttendanceEvent>>(), Arg.Any<ProfileModel>()); profileModel.FlagCount.ShouldBe(student.AttendanceFlags.First().FlagCount); }
public void ShouldMap() { var student1 = new StudentBuilder().Build(); var student2 = new StudentBuilder().WithStudentUsi(1234).WithFirstName("Mike").Build(); var section = new SectionBuilder().WithStudent(student1).WithStudent(student2).Build(); var attendanceEvents = new List<StudentSectionAttendanceEvent> { new StudentSectionAttendanceEventBuilder() .WithAttendanceEventCategoryDescriptorId((int)AttendanceEventCategoryDescriptorEnum.InAttendance) .WithStudent(student1) .WithSection(section) .Build(), new StudentSectionAttendanceEventBuilder() .WithAttendanceEventCategoryDescriptorId((int)AttendanceEventCategoryDescriptorEnum.InAttendance) .WithStudent(student2) .WithSection(section) .Build() }; section.StudentSectionAttendanceEvents = attendanceEvents; var date = student1.StudentSectionAssociations.First().BeginDate.AddDays(1); var downloader = Substitute.For<IFileDownloader>(); var profilePhotoUrlFetcher = Substitute.For<ProfilePhotoUrlFetcher>(downloader); var takeAttendanceModel = new SectionToTakeAttendanceModelMapper(profilePhotoUrlFetcher).Build(section, date); takeAttendanceModel.SectionId.ShouldBe(section.SectionIdentity); takeAttendanceModel.Section.ShouldBe(section.UniqueSectionCode + " (" + section.LocalCourseCode + ", " + section.ClassPeriodName + ")"); takeAttendanceModel.SessionId.ShouldBe(section.Session.SessionIdentity); takeAttendanceModel.Session.ShouldBe(section.Session.SessionName); takeAttendanceModel.StudentRows.Count.ShouldBe(2); takeAttendanceModel.StudentRows[0].StudentUsi.ShouldBe(student1.StudentUSI); takeAttendanceModel.StudentRows[0].StudentName.ShouldBe(student1.FirstName + " " + student1.LastSurname); takeAttendanceModel.StudentRows[0].AttendanceType.ShouldBe(AttendanceEventCategoryDescriptorEnum.InAttendance); takeAttendanceModel.StudentRows[1].StudentUsi.ShouldBe(student2.StudentUSI); takeAttendanceModel.StudentRows[1].StudentName.ShouldBe(student2.FirstName + " " + student2.LastSurname); takeAttendanceModel.StudentRows[1].AttendanceType.ShouldBe(AttendanceEventCategoryDescriptorEnum.InAttendance); }
public void ShouldMap() { var studentBiographicalInfo = new StudentBiographicalInformationModelBuilder().Build(); var mapper = new EditStudentBiographicalInfoModelToStudentMapper(); var student = new StudentBuilder().Build(); mapper.Map(studentBiographicalInfo, student); student.BirthDate.ShouldBe(DateTime.Parse(studentBiographicalInfo.BirthDate)); student.SexTypeId.ShouldBe((int)studentBiographicalInfo.Sex); student.HispanicLatinoEthnicity.ShouldBe(studentBiographicalInfo.HispanicLatinoEthnicity); student.StudentRaces.First().RaceTypeId.ShouldBe((int)studentBiographicalInfo.Race); const int languageDescriptorId = (int)LanguageDescriptorEnum.Spanish; student.StudentLanguages.First().LanguageDescriptorId.ShouldBe(languageDescriptorId); student.StudentLanguages.First() .StudentLanguageUses.First() .LanguageUseTypeId.ShouldBe((int)LanguageUseTypeEnum.Homelanguage); student.StudentLanguages.First() .StudentLanguageUses.First() .LanguageDescriptorId.ShouldBe(languageDescriptorId); }
public void ShouldMapStudentToProfileModelWithMultipleParents() { SetupWithDownloaderReturning(""); var student = new StudentBuilder().WithParent().WithParent().Build(); var firstParent = student.StudentParentAssociations.First().Parent; var secondParent = student.StudentParentAssociations.ElementAt(1).Parent; var profileModel = new ProfileModel(); _mapper.Map(student, profileModel); NativeStudentPropertiesShouldBeMapped(student, profileModel); NativeParentPropertiesShouldBeMapped(firstParent, profileModel.EditProfileParentModel); NativeParentPropertiesShouldBeMapped(secondParent, profileModel.SecondEditProfileParentModel); StudentParentAssociationShouldBeMapped(student, profileModel); }
public void ShouldMapWithDefaultValueIfNoProfilePhotoExists() { SetupWithDownloaderReturning(""); var student = new StudentBuilder().WithParent().Build(); var profileModel = _mapper.Build(student); profileModel.ProfilePhotoUrl.ShouldBe("/Assets/Images/placeholder.png"); }
public void ShouldMapStudentToProfileModelWithoutAcademicDetails() { var student = new StudentBuilder().WithParent().Build(); SetupWithDownloaderReturning(null); var profileModel = _mapper.Build(student); NativeStudentPropertiesShouldBeMapped(student, profileModel); profileModel.AcademicDetail.ShouldBe(null); }
public void ShouldMapStudentToProfileModelWithAcademicDetails() { var student = new StudentBuilder().WithParent().WithStudentAcademicDetails().Build(); var fileName = student.StudentAcademicDetails.First().PerformanceHistoryFile; var filePath = "https://ngl.blob.core.windows.net/" + fileName; SetupWithDownloaderReturning(filePath); var profileModel = _mapper.Build(student); NativeStudentPropertiesShouldBeMapped(student, profileModel); var studentAcademicDetail = student.StudentAcademicDetails.First(); profileModel.AcademicDetail.SchoolYear.ShouldBe(studentAcademicDetail.SchoolYear); profileModel.AcademicDetail.ReadingScore.ShouldBe(studentAcademicDetail.ReadingScore); profileModel.AcademicDetail.WritingScore.ShouldBe(studentAcademicDetail.WritingScore); profileModel.AcademicDetail.MathScore.ShouldBe(studentAcademicDetail.MathScore); profileModel.AcademicDetail.PerformanceHistoryFileUrl.ShouldBe(filePath); profileModel.AcademicDetail.PerformanceHistory.ShouldBe(studentAcademicDetail.PerfomanceHistory); }
private void Setup() { var studentAssessmentToEnterResultsStudentModelMapper = Substitute.For<IMapper<StudentAssessment, EnterResultsStudentModel>>(); studentAssessmentToEnterResultsStudentModelMapper.Build(Arg.Any<StudentAssessment>()) .Returns(new EnterResultsStudentModel()); var downloader = Substitute.For<IFileDownloader>(); _profilePhotoUrlFetcher = Substitute.For<ProfilePhotoUrlFetcher>(downloader); _mapper = new AssessmentToEnterResultsModelMapper(studentAssessmentToEnterResultsStudentModelMapper, _profilePhotoUrlFetcher); _profilePhotoUrlFetcher.GetProfilePhotoThumbnailUrlOrDefault(Arg.Any<Int32>()).Returns("/Assets/Images/placeholder.png"); _entity = new AssessmentBuilder() .WithAssessmentLearningStandards() .WithAssessmentPerformanceLevels() .Build(); Web.Data.Entities.Student student1 = new StudentBuilder().Build(); Web.Data.Entities.Student student2 = new StudentBuilder().Build(); _section = new SectionBuilder().WithStudent(student1).WithStudent(student2).WithAssessment(_entity).Build(); _assessmentSection = _section.AssessmentSections.First(); }