예제 #1
0
        public void ShouldMapSessionWithNoSections()
        {
            var session = new SessionBuilder().Build();
            var model   = new SessionToSessionWithSectionsModelMapper().Build(session);

            model.Name.ShouldBe(session.SessionName);
            model.CourseRows.Count.ShouldBe(0);
        }
        public void ShouldMapSessionWithNoSections()
        {
            var session = new SessionBuilder().Build();
            var model = new SessionToSessionWithSectionsModelMapper().Build(session);

            model.Name.ShouldBe(session.SessionName);
            model.CourseRows.Count.ShouldBe(0);
        }
예제 #3
0
        public void ShouldGroupByCourse()
        {
            _mathCourseName    = "Math 101 - DI";
            _englishCourseName = "English 102 - CW";

            var session = new SessionBuilder()
                          .WithSections(new []
            {
                new SectionBuilder()
                .WithLocalCourseCode(_mathCourseName)
                .WithUniqueSectionCode("Math DI - 1")
                .WithClassPeriodName("Period 1")
                .WithClassroomIdentificationCode("Room 1").Build(),
                new SectionBuilder()
                .WithLocalCourseCode(_englishCourseName)
                .WithUniqueSectionCode("English CW")
                .WithClassPeriodName("Period 2")
                .WithClassroomIdentificationCode("Room 2").Build(),
                new SectionBuilder()
                .WithLocalCourseCode(_mathCourseName)
                .WithUniqueSectionCode("Math DI - 2")
                .WithClassPeriodName("Period 1")
                .WithClassroomIdentificationCode("Room 3").Build()
            }).Build();
            var model = new SessionToSessionWithSectionsModelMapper().Build(session);

            model.Id.ShouldBe(session.SessionIdentity);
            model.Name.ShouldBe(session.SessionName);
            model.CourseRows.Count.ShouldBe(2);

            var firstCourseRow = model.CourseRows[0];

            firstCourseRow.Name.ShouldBe(_mathCourseName);
            firstCourseRow.SectionRows.Count.ShouldBe(2);

            var firstSectionRow = firstCourseRow.SectionRows[0];

            firstSectionRow.UniqueSectionCode.ShouldBe("Math DI - 1");
            firstSectionRow.ClassPeriod.ShouldBe("Period 1");
            firstSectionRow.Location.ShouldBe("Room 1");

            var secondSectionRow = firstCourseRow.SectionRows[1];

            secondSectionRow.UniqueSectionCode.ShouldBe("Math DI - 2");
            secondSectionRow.ClassPeriod.ShouldBe("Period 1");
            secondSectionRow.Location.ShouldBe("Room 3");

            var secondCourseRow = model.CourseRows[1];

            secondCourseRow.Name.ShouldBe(_englishCourseName);
            secondCourseRow.SectionRows.Count.ShouldBe(1);
            var thirdSectionRow = secondCourseRow.SectionRows[0];

            thirdSectionRow.UniqueSectionCode.ShouldBe("English CW");
            thirdSectionRow.ClassPeriod.ShouldBe("Period 2");
            thirdSectionRow.Location.ShouldBe("Room 2");
        }
        public void ShouldMap()
        {
            var entity = new SessionBuilder().Build();
            var mapper = new SessionToSessionJsonModelMapper();

            var model = mapper.Build(entity);

            model.SessionId.ShouldBe(entity.SessionIdentity);
            model.SessionName.ShouldBe(entity.SessionName);
        }
예제 #5
0
        public void ShouldMapEntityToIndexModel()
        {
            var sessionEntity     = new SessionBuilder().Build();
            var sessionIndexModel = new SessionToIndexModelMapper().Build(sessionEntity);

            sessionIndexModel.Term.ShouldBe(((TermTypeEnum)sessionEntity.TermTypeId).Humanize());
            sessionIndexModel.SchoolYear.ShouldBe(((SchoolYearTypeEnum)sessionEntity.SchoolYear).Humanize());
            sessionIndexModel.BeginDate.ShouldBe(sessionEntity.BeginDate);
            sessionIndexModel.EndDate.ShouldBe(sessionEntity.EndDate);
            sessionIndexModel.TotalInstructionalDays.ShouldBe(sessionEntity.TotalInstructionalDays);
        }
        public void ShouldMapSessionToSessionListItemModel()
        {
            var session = new SessionBuilder().Build();
            _mapper = new SessionToSessionListItemModelMapper();
            var sessionListItemModel = _mapper.Build(session);

            sessionListItemModel.BeginDate.ShouldBe(session.BeginDate);
            sessionListItemModel.EndDate.ShouldBe(session.EndDate);
            sessionListItemModel.SessionId.ShouldBe(session.SessionIdentity);
            sessionListItemModel.SessionName.ShouldBe(session.SessionName);
        }
예제 #7
0
        public void ShouldMapEntityToIndexModel()
        {
            var sessionEntity = new SessionBuilder().Build();
            var sessionIndexModel = new SessionToIndexModelMapper().Build(sessionEntity);

            sessionIndexModel.Term.ShouldBe(((TermTypeEnum) sessionEntity.TermTypeId).Humanize());
            sessionIndexModel.SchoolYear.ShouldBe(((SchoolYearTypeEnum) sessionEntity.SchoolYear).Humanize());
            sessionIndexModel.BeginDate.ShouldBe(sessionEntity.BeginDate);
            sessionIndexModel.EndDate.ShouldBe(sessionEntity.EndDate);
            sessionIndexModel.TotalInstructionalDays.ShouldBe(sessionEntity.TotalInstructionalDays);
        }
예제 #8
0
        public void ShouldHaveErrorsIfSessionExists()
        {
            Setup();
            var sessionEntity = new SessionBuilder().Build();

            _genericRepository
                .Get(Arg.Any<SessionByTermTypeAndSchoolYearQuery>())
                .Returns(sessionEntity);

            _validator.ShouldHaveValidationErrorFor(s => s.Term, _sessionCreateModel);
            _validator.ShouldHaveValidationErrorFor(s => s.SchoolYear, _sessionCreateModel);
        }
예제 #9
0
        public void ShouldHaveErrorsIfSessionExists()
        {
            Setup();
            var sessionEntity = new SessionBuilder().Build();

            _genericRepository
            .Get(Arg.Any <SessionByTermTypeAndSchoolYearQuery>())
            .Returns(sessionEntity);

            _validator.ShouldHaveValidationErrorFor(s => s.Term, _sessionCreateModel);
            _validator.ShouldHaveValidationErrorFor(s => s.SchoolYear, _sessionCreateModel);
        }
        public void ShouldGroupByCourse()
        {
            _mathCourseName = "Math 101 - DI";
            _englishCourseName = "English 102 - CW";
            
            var session = new SessionBuilder()
                .WithSections(new []
                {
                    new SectionBuilder()
                        .WithLocalCourseCode(_mathCourseName)
                        .WithUniqueSectionCode("Math DI - 1")
                        .WithClassPeriodName("Period 1")
                        .WithClassroomIdentificationCode("Room 1").Build(),
                    new SectionBuilder()
                        .WithLocalCourseCode(_englishCourseName)
                        .WithUniqueSectionCode("English CW")
                        .WithClassPeriodName("Period 2")
                        .WithClassroomIdentificationCode("Room 2").Build(),
                    new SectionBuilder()
                        .WithLocalCourseCode(_mathCourseName)
                        .WithUniqueSectionCode("Math DI - 2")
                        .WithClassPeriodName("Period 1")
                        .WithClassroomIdentificationCode("Room 3").Build()
                }).Build();
            var model = new SessionToSessionWithSectionsModelMapper().Build(session);

            model.Id.ShouldBe(session.SessionIdentity);
            model.Name.ShouldBe(session.SessionName);
            model.CourseRows.Count.ShouldBe(2);

            var firstCourseRow = model.CourseRows[0];
            firstCourseRow.Name.ShouldBe(_mathCourseName);
            firstCourseRow.SectionRows.Count.ShouldBe(2);

            var firstSectionRow = firstCourseRow.SectionRows[0];
            firstSectionRow.UniqueSectionCode.ShouldBe("Math DI - 1");
            firstSectionRow.ClassPeriod.ShouldBe("Period 1");
            firstSectionRow.Location.ShouldBe("Room 1");

            var secondSectionRow = firstCourseRow.SectionRows[1];
            secondSectionRow.UniqueSectionCode.ShouldBe("Math DI - 2");
            secondSectionRow.ClassPeriod.ShouldBe("Period 1");
            secondSectionRow.Location.ShouldBe("Room 3");

            var secondCourseRow = model.CourseRows[1];
            secondCourseRow.Name.ShouldBe(_englishCourseName);
            secondCourseRow.SectionRows.Count.ShouldBe(1);
            var thirdSectionRow = secondCourseRow.SectionRows[0];
            thirdSectionRow.UniqueSectionCode.ShouldBe("English CW");
            thirdSectionRow.ClassPeriod.ShouldBe("Period 2");
            thirdSectionRow.Location.ShouldBe("Room 2");
        }
        public void ShouldMap()
        {
            var session = new SessionBuilder().Build();
            var parentCourse = new ParentCourseBuilder().Build();
            
            var findParentCourseModel = new SessionToFindParentCourseModelMapper().Build(session, t =>
            {
                t.ParentCourse = parentCourse.ParentCourseTitle;
                t.ParentCourseId = parentCourse.Id;
            });

            findParentCourseModel.ParentCourse.ShouldBe(parentCourse.ParentCourseTitle);
            findParentCourseModel.ParentCourseId.ShouldBe(parentCourse.Id);
            findParentCourseModel.Session.ShouldBe(session.SessionName);
            findParentCourseModel.SessionId.ShouldBe(session.SessionIdentity);
        }