Пример #1
0
        public void GetNonArchivedCoursesAvailableToCentreByCategory_returns_expected_values()
        {
            // Given
            const int centreId   = 101;
            int?      categoryId = null;

            // When
            var result = courseDataService.GetNonArchivedCoursesAvailableToCentreByCategory(centreId, categoryId)
                         .ToList();

            // Then
            var expectedFirstCourse = new CourseAssessmentDetails
            {
                CustomisationId   = 100,
                CentreId          = 101,
                ApplicationId     = 1,
                ApplicationName   = "Entry Level - Win XP, Office 2003/07 OLD",
                CustomisationName = "Standard",
                Active            = false,
                CategoryName      = "Undefined",
                CourseTopic       = "Undefined",
                HasDiagnostic     = false,
                HasLearning       = true,
                IsAssessed        = false,
            };

            result.Should().HaveCount(256);
            result.First().Should().BeEquivalentTo(expectedFirstCourse);
        }
Пример #2
0
 public SearchableCourseViewModel(CourseAssessmentDetails details, int groupId)
 {
     GroupId         = groupId;
     CustomisationId = details.CustomisationId;
     CourseName      = details.CourseName;
     Category        = details.CategoryName;
     Topic           = details.CourseTopic;
     Tags            = FilterableTagHelper.GetCurrentTagsForCourse(details);
 }
Пример #3
0
 public static IEnumerable <SearchableTagViewModel> GetCurrentTagsForCourse(CourseAssessmentDetails details)
 {
     return(new List <SearchableTagViewModel>
     {
         details.IsAssessed
             ? new SearchableTagViewModel(AddCourseToGroupAssessedFilterOptions.IsAssessed)
             : new SearchableTagViewModel(AddCourseToGroupAssessedFilterOptions.IsNotAssessed),
         details.HasLearning
             ? new SearchableTagViewModel(AddCourseToGroupLearningFilterOptions.HasLearning)
             : new SearchableTagViewModel(AddCourseToGroupLearningFilterOptions.NoLearning, true),
         details.IsAssessed
             ? new SearchableTagViewModel(AddCourseToGroupDiagnosticFilterOptions.HasDiagnostic)
             : new SearchableTagViewModel(AddCourseToGroupDiagnosticFilterOptions.NoDiagnostic, true),
     });
 }
Пример #4
0
        public void GetCoursesAvailableToCentreByCategory_returns_active_and_inactive_all_centre_courses()
        {
            // Given
            const int centreId   = 101;
            const int categoryId = 1;

            var expectedActiveCourse = new CourseAssessmentDetails
            {
                CustomisationId   = 17468,
                CentreId          = 549,
                ApplicationId     = 206,
                ApplicationName   = "An Introduction to Cognition",
                CustomisationName = "eLearning",
                Active            = true,
                CategoryName      = "Undefined",
                CourseTopic       = "Undefined",
                HasDiagnostic     = false,
                HasLearning       = true,
                IsAssessed        = false,
            };
            var expectedInactiveCourse = new CourseAssessmentDetails
            {
                CustomisationId   = 14738,
                CentreId          = 549,
                ApplicationId     = 76,
                ApplicationName   = "Mobile Directory",
                CustomisationName = "eLearning",
                Active            = false,
                CategoryName      = "Undefined",
                CourseTopic       = "Undefined",
                HasDiagnostic     = false,
                HasLearning       = true,
                IsAssessed        = false,
            };

            // When
            var result = courseDataService.GetCoursesAvailableToCentreByCategory(centreId, categoryId).ToList();

            // Then
            result.Should().ContainEquivalentOf(expectedActiveCourse);
            result.Should().ContainEquivalentOf(expectedInactiveCourse);
        }