Beispiel #1
0
        public void Get_tutorial_information_should_parse_course_settings()
        {
            using (new TransactionScope())
            {
                // Given
                const int    candidateId        = 1;
                const int    customisationId    = 1379;
                const int    sectionId          = 74;
                const int    tutorialId         = 50;
                const string courseSettingsText =
                    "{\"lm.sp\":false,\"lm.st\":false,\"lm.sl\":false,\"df.sd\":false,"
                    + "\"df.sm\":false,\"df.ss\":false,\"lm:ce\":\"consolidation/exercise\","
                    + "\"lm:si\":\"supporting/information\"}";
                var expectedCourseSettings = new CourseSettings(courseSettingsText);

                courseContentTestHelper.AddCourseSettings(customisationId, courseSettingsText);

                // When
                var tutorial = tutorialContentDataService.GetTutorialInformation(candidateId, customisationId, sectionId, tutorialId);

                // Then
                tutorial.Should().NotBeNull();
                tutorial !.CourseSettings.Should().BeEquivalentTo(expectedCourseSettings);
            }
        }
Beispiel #2
0
        public void CourseSettings_should_have_default_settings_when_json_is_malformed()
        {
            // Given
            var defaultSettings = new CourseSettings(null);

            // When
            var courseSettings = new CourseSettings("{\"lm.su\":\"Line Manager");

            // Then
            courseSettings.Should().BeEquivalentTo(defaultSettings);
        }
Beispiel #3
0
        public void CourseSettings_should_have_default_settings_when_json_is_empty_list()
        {
            // Given
            var defaultSettings = new CourseSettings(null);

            // When
            var courseSettings = new CourseSettings("[]");

            // Then
            courseSettings.Should().BeEquivalentTo(defaultSettings);
        }
Beispiel #4
0
        public void Get_course_content_should_have_default_course_settings_when_json_is_null()
        {
            // Given
            const int candidateId     = 254480;
            const int customisationId = 24224;

            var defaultSettings = new CourseSettings(null);

            // When
            var result = courseContentService.GetCourseContent(candidateId, customisationId);

            // Then
            result.Should().NotBeNull();
            result !.CourseSettings.Should().BeEquivalentTo(defaultSettings);
        }
Beispiel #5
0
        public void Get_tutorial_information_should_have_default_course_settings_when_json_is_null()
        {
            // Given
            const int candidateId     = 1;
            const int customisationId = 1379;
            const int sectionId       = 74;
            const int tutorialId      = 50;
            var       defaultSettings = new CourseSettings(null);

            // When
            var tutorial = tutorialContentDataService.GetTutorialInformation(candidateId, customisationId, sectionId, tutorialId);

            // Then
            tutorial.Should().NotBeNull();
            tutorial !.CourseSettings.Should().BeEquivalentTo(defaultSettings);
        }
Beispiel #6
0
        public void Get_course_content_should_parse_course_settings()
        {
            using (new TransactionScope())
            {
                // Given
                const int    candidateId        = 254480;
                const int    customisationId    = 24224;
                const string courseSettingsText =
                    "{\"lm.sp\":false,\"lm.st\":false,\"lm.sl\":false,\"df.sd\":false,\"df.sm\":false,\"df.ss\":false}";
                var expectedCourseSettings = new CourseSettings(courseSettingsText);

                courseContentTestHelper.AddCourseSettings(customisationId, courseSettingsText);

                // When
                var result = courseContentService.GetCourseContent(candidateId, customisationId);

                // Then
                result.Should().NotBeNull();
                result !.CourseSettings.Should().BeEquivalentTo(expectedCourseSettings);
            }
        }