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); } }
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); }
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); }
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); }
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); }
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); } }