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 ShouldMapSectionToIndexModel()
 {
     var entity = new SectionBuilder().Build();
     var model = new SectionToIndexModelMapper().Build(entity);
     
     model.SectionIdentity.ShouldBe(entity.SectionIdentity);
     model.SchoolYear.ShouldBe(((SchoolYearTypeEnum)entity.SchoolYear).Humanize());
     model.Term.ShouldBe(((TermTypeEnum)entity.TermTypeId).Humanize());
     model.ClassPeriod.ShouldBe(entity.ClassPeriodName);
     model.Classroom.ShouldBe(entity.ClassroomIdentificationCode);
     model.LocalCourseCode.ShouldBe(entity.LocalCourseCode);
     model.UniqueSectionCode.ShouldBe(entity.UniqueSectionCode);
 }
Example #3
0
        public void ShouldHaveErrorsIfSectionExists()
        {
            Setup();

            var sectionEntity = new SectionBuilder().Build();

            _genericRepository
                .Get(Arg.Any<SectionByPrimaryKeysQuery>())
                .Returns(sectionEntity);

            _validator.ShouldHaveValidationErrorFor(s => s.Session, _sectionCreateModel);
            _validator.ShouldHaveValidationErrorFor(s => s.Period, _sectionCreateModel);
            _validator.ShouldHaveValidationErrorFor(s => s.Classroom, _sectionCreateModel);
            _validator.ShouldHaveValidationErrorFor(s => s.Course, _sectionCreateModel);
        }
        public void ShouldMapAssessmentToIndexModelMapper()
        {
            var mapper = new AssessmentToAssessmentIndexModelMapper();
            Web.Data.Entities.Assessment assessment = new AssessmentBuilder()
                .WithAssessmentLearningStandards()
                .WithAssessmentPerformanceLevels()
                .Build();
            var section = new SectionBuilder().WithAssessment(assessment).Build();
            
            var indexModel = mapper.Build(assessment);

            indexModel.AssessmentTitle.ShouldBe(assessment.AssessmentTitle);
            indexModel.SessionName.ShouldBe(section.Session.SessionName);
            indexModel.SectionName.ShouldBe(section.UniqueSectionCode);
            indexModel.CCSS.ShouldBe(assessment.AssessmentLearningStandards.First().LearningStandard.Description);
            indexModel.Date.ShouldBe(assessment.AdministeredDate.ToShortDateString());
            indexModel.id.ShouldBe(1);
        }
        public void ShouldMap()
        {
            var section = new SectionBuilder().Build();
            var parentCourseId = new Guid();
            var parentCourseGrade = new SectionToParentCourseGradeMapper().Build(section, m =>
            {
                m.StudentUSI = 1;
                m.ParentCourseId = parentCourseId;
                m.GradeEarned = "FAIL";
            });

            parentCourseGrade.TermTypeId.ShouldBe(section.TermTypeId);
            parentCourseGrade.SchoolYear.ShouldBe(section.SchoolYear);
            parentCourseGrade.SchoolId.ShouldBe(section.SchoolId);
            parentCourseGrade.StudentUSI.ShouldBe(1);
            parentCourseGrade.ParentCourseId.ShouldBe(parentCourseId);
            parentCourseGrade.GradeEarned.ShouldBe("FAIL");
        }
        private StudentAssessment BuildFirstStudentAssessment()
        {
            var assessment = new AssessmentBuilder()
                .WithAssessmentLearningStandards()
                .WithAssessmentPerformanceLevels()
                .Build();

            _genericRepository.Get(Arg.Any<Expression<Func<AssessmentCategoryType, bool>>>())
                .Returns(new AssessmentCategoryType { ShortDescription = assessment.AssessmentCategoryType.ShortDescription });


            var section = new SectionBuilder().WithAssessment(assessment).Build(); //To add section to assessment

            assessment.AssessmentSections = new AssessmentBuilder().WithSection(section).Build().AssessmentSections;
            var studentAssessmentScoreResult = new StudentAssessmentScoreResultBuilder().WithResult("95.7").Build();
            var studentAssessment = new StudentAssessmentBuilder().WithAssessment(assessment)
                            .WithStudentAssessmentScoreResult(studentAssessmentScoreResult).Build();
            return studentAssessment;
        }
        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);
        }