Beispiel #1
0
        public void ShouldMapCreateModelToEntity()
        {
            var schoolRepository = Substitute.For<ISchoolRepository>();
            schoolRepository.GetSchool().Returns(new School { SchoolId = Constants.SchoolId });

            var model = new CreateSessionModelBuilder().Build();
            var entity = new CreateModelToSessionMapper(schoolRepository).Build(model);

            entity.SchoolId.ShouldBe(Constants.SchoolId);
            entity.TermTypeId.ShouldBe((int) model.Term.GetValueOrDefault());
            entity.SchoolYear.ShouldBe((short) model.SchoolYear);
            entity.BeginDate.ShouldBe(model.BeginDate.GetValueOrDefault());
            entity.EndDate.ShouldBe(model.EndDate.GetValueOrDefault());
            entity.TotalInstructionalDays.ShouldBe(model.TotalInstructionalDays.GetValueOrDefault());
            entity.SessionName.ShouldBe("Fall Semester 2013-2014");
        }
Beispiel #2
0
        public void ShouldMapCreateModelToEntity()
        {
            var schoolRepository = Substitute.For <ISchoolRepository>();

            schoolRepository.GetSchool().Returns(new School {
                SchoolId = Constants.SchoolId
            });

            var model  = new CreateSessionModelBuilder().Build();
            var entity = new CreateModelToSessionMapper(schoolRepository).Build(model);

            entity.SchoolId.ShouldBe(Constants.SchoolId);
            entity.TermTypeId.ShouldBe((int)model.Term.GetValueOrDefault());
            entity.SchoolYear.ShouldBe((short)model.SchoolYear);
            entity.BeginDate.ShouldBe(model.BeginDate.GetValueOrDefault());
            entity.EndDate.ShouldBe(model.EndDate.GetValueOrDefault());
            entity.TotalInstructionalDays.ShouldBe(model.TotalInstructionalDays.GetValueOrDefault());
            entity.SessionName.ShouldBe("Fall Semester 2013-2014");
        }