Exemplo n.º 1
0
 public List <CourseTypeModelDto> GetAllCourseTypes()
 {
     try
     {
         return(CourseTypeModelDto.Map(new Repository <CourseTypeModel>().GetAll().ToList()));
     }
     catch (Exception ex)
     {
         Logger.Error("Error : CourseService.GetAllCourseTypes - {0}", ex.Message);
         return(new List <CourseTypeModelDto>());
     }
 }
Exemplo n.º 2
0
        public void Can_filter_courses_by_course_type()
        {
            #region Arrange
            #endregion

            #region Act

            List <CourseDto> filteredCourses = new CourseService().GetByCourseType(CourseTypeModelDto.Map(TestCourseType));


            #endregion

            #region Assert
            Assert.That(filteredCourses.Count, Is.EqualTo(1));
            #endregion
        }
Exemplo n.º 3
0
        public void Can_update_course_reference()
        {
            #region Arrange
            var course = new CourseService().GetById(1);
            course.CourseType = CourseTypeModelDto.Map(TestCourseType1);
            #endregion

            #region Act
            var updateOk = new CourseService().Update(course, false);
            course = new CourseService().GetById(1);
            #endregion

            #region Assert
            Assert.That(updateOk, Is.True);
            Assert.That(course.CourseType.TypeName, Is.EqualTo("Matematyka"));
            #endregion
        }
Exemplo n.º 4
0
        public void Can_add_new_course()
        {
            new CourseService();
            #region Arrange
            var newCourse = new CourseDto
            {
                CreationDate = DateTime.Now,
                CourseType   = CourseTypeModelDto.Map(TestCourseType),
                Group        = new GroupModelDto
                {
                    GroupName = "added test",
                    GroupType = GroupTypeModelDto.Map(TestGroupType)
                },
                Logo     = "test/jpg",
                Name     = "test add",
                ShoutBox = new ShoutboxModelDto()
            };
            #endregion

            #region Act

            int?      id = new CourseService().AddCourse(newCourse);
            CourseDto testingAddedCourse = null;
            if (id.HasValue)
            {
                testingAddedCourse = new CourseService().GetById(id.Value);
            }

            #endregion

            #region Assert
            Assert.That(testingAddedCourse, Is.Not.Null);
            if (testingAddedCourse != null)
            {
                Assert.That(testingAddedCourse.Name, Is.EqualTo("test add"));
                Assert.That(testingAddedCourse.Group.GroupName, Is.EqualTo("added test"));
            }

            #endregion
        }