public Slide Load(FileInfo file, Unit unit, int slideIndex, string courseId, CourseSettings settings) { var quiz = file.DeserializeXml <Quiz>(); quiz.Meta?.FixPaths(file); var scoringGroupsIds = settings.Scoring.Groups.Keys; if (!string.IsNullOrEmpty(quiz.ScoringGroup) && !scoringGroupsIds.Contains(quiz.ScoringGroup)) { throw new CourseLoadingException( $"Неизвестная группа оценки у теста {quiz.Title}: {quiz.ScoringGroup}\n" + "Возможные значения: " + string.Join(", ", scoringGroupsIds)); } if (string.IsNullOrEmpty(quiz.ScoringGroup)) { quiz.ScoringGroup = settings.Scoring.DefaultScoringGroupForQuiz; } BuildUp(quiz, unit, courseId, settings); quiz.InitQuestionIndices(); var slideInfo = new SlideInfo(unit, file, slideIndex); return(new QuizSlide(slideInfo, quiz)); }
public BuildUpContext(DirectoryInfo dir, CourseSettings courseSettings, Lesson lesson) { Dir = dir; CourseSettings = courseSettings; Lesson = lesson; Extractors = new List<RegionsExtractor>(); }
public Slide Load(FileInfo file, string unitName, int slideIndex, CourseSettings settings) { var sourceCode = file.ContentAsUtf8(); var prelude = GetPrelude(file.Directory); var fs = new FileSystem(file.Directory); return SlideParser.ParseCode(sourceCode, new SlideInfo(unitName, file, slideIndex), prelude, fs); }
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 BuildUpContext(IFileSystem fileSystem, CourseSettings courseSettings, Lesson lesson) { FileSystem = fileSystem; CourseSettings = courseSettings; Lesson = lesson; Extractors = new List <RegionsExtractor>(); }
public CourseController( IPermissionService permissionService, IAclService aclService, IWorkContext workContext, IStoreMappingService storeMappingService, ICustomerActivityService customerActivityService, IGenericAttributeService genericAttributeService, IWebHelper webHelper, IStoreContext storeContext, ILocalizationService localizationService, ICustomerActionEventService customerActionEventService, ICourseService courseService, ICourseLessonService courseLessonService, IDownloadService downloadService, IMediator mediator, CourseSettings courseSettings) { _permissionService = permissionService; _aclService = aclService; _workContext = workContext; _storeMappingService = storeMappingService; _customerActivityService = customerActivityService; _genericAttributeService = genericAttributeService; _webHelper = webHelper; _storeContext = storeContext; _localizationService = localizationService; _customerActionEventService = customerActionEventService; _courseService = courseService; _courseLessonService = courseLessonService; _downloadService = downloadService; _mediator = mediator; _courseSettings = courseSettings; }
public static void BuildUp(Quiz quiz, Unit unit, string courseId, CourseSettings settings) { var context = new BuildUpContext(unit, settings, null, courseId, quiz.Title); var blocks = quiz.Blocks.SelectMany(b => b.BuildUp(context, ImmutableHashSet <string> .Empty)); quiz.Blocks = blocks.ToArray(); }
public static void BuildUp(Quiz quiz, DirectoryInfo slideDir, CourseSettings settings) { var context = new BuildUpContext(slideDir, settings, null, quiz.Title); var blocks = quiz.Blocks.SelectMany(b => b.BuildUp(context, ImmutableHashSet <string> .Empty)); quiz.Blocks = blocks.ToArray(); }
public CourseController( IPermissionService permissionService, IAclService aclService, IWorkContext workContext, IGroupService groupService, ICustomerActivityService customerActivityService, IUserFieldService userFieldService, ITranslationService translationService, ICustomerActionEventService customerActionEventService, ICourseService courseService, ICourseLessonService courseLessonService, IDownloadService downloadService, IMediator mediator, CourseSettings courseSettings) { _permissionService = permissionService; _aclService = aclService; _workContext = workContext; _groupService = groupService; _customerActivityService = customerActivityService; _userFieldService = userFieldService; _translationService = translationService; _customerActionEventService = customerActionEventService; _courseService = courseService; _courseLessonService = courseLessonService; _downloadService = downloadService; _mediator = mediator; _courseSettings = courseSettings; }
public BuildUpContext(IFileSystem fileSystem, CourseSettings courseSettings, Lesson lesson) { FileSystem = fileSystem; CourseSettings = courseSettings; Lesson = lesson; Extractors = new List<RegionsExtractor>(); }
public void CourseSettings_should_have_default_ShowTime_when_wrong_type() { // When var courseSettings = new CourseSettings("{\"lm.st\":3}"); // Then courseSettings.ShowTime.Should().BeTrue(); }
public void CourseSettings_should_have_default_SupportingInformation_when_whitespace() { // When var courseSettings = new CourseSettings("{\"lm.si\":\" \"}"); // Then courseSettings.SupportingInformation.Should().BeNull(); }
public void CourseSettings_should_take_SupportingInformation_from_json() { // When var courseSettings = new CourseSettings("{\"lm.si\":\"Supporting information\"}"); // Then courseSettings.SupportingInformation.Should().Be("Supporting information"); }
public void CourseSettings_should_have_default_SupportingInformation_when_not_in_json() { // When var courseSettings = new CourseSettings(null); // Then courseSettings.SupportingInformation.Should().BeNull(); }
public void CourseSettings_should_have_default_ConsolidationExercise_when_whitespace() { // When var courseSettings = new CourseSettings("{\"lm.ce\":\" \"}"); // Then courseSettings.ConsolidationExercise.Should().BeNull(); }
public void CourseSettings_should_have_default_ConsolidationExercise_when_not_in_json() { // When var courseSettings = new CourseSettings(null); // Then courseSettings.ConsolidationExercise.Should().BeNull(); }
public void CourseSettings_should_take_ConsolidationExercise_from_json() { // When var courseSettings = new CourseSettings("{\"lm.ce\":\"Consolidation exercise\"}"); // Then courseSettings.ConsolidationExercise.Should().Be("Consolidation exercise"); }
public void CourseSettings_should_have_default_ShowPercentage_when_wrong_type() { // When var courseSettings = new CourseSettings("{\"lm.sp\":\"Line Manager\"}"); // Then courseSettings.ShowPercentage.Should().BeTrue(); }
public void CourseSettings_should_have_default_ShowPercentage_when_not_in_json() { // When var courseSettings = new CourseSettings(null); // Then courseSettings.ShowPercentage.Should().BeTrue(); }
public void CourseSettings_should_take_ShowLearnStatus_from_json() { // When var courseSettings = new CourseSettings("{\"lm.sl\":false}"); // Then courseSettings.ShowLearnStatus.Should().BeFalse(); }
public void CourseSettings_should_take_ShowPercentage_from_json() { // When var courseSettings = new CourseSettings("{\"lm.sp\":false}"); // Then courseSettings.ShowPercentage.Should().BeFalse(); }
public Slide Load(FileInfo file, string unitName, int slideIndex, CourseSettings settings) { var sourceCode = file.ContentAsUtf8(); var prelude = GetPrelude(file.Directory); var fs = new FileSystem(file.Directory); return(SlideParser.ParseCode(sourceCode, new SlideInfo(unitName, file, slideIndex), prelude, fs)); }
public BuildUpContext(DirectoryInfo dir, CourseSettings courseSettings, Lesson lesson, string slideTitle) { Dir = dir; CourseSettings = courseSettings; Lesson = lesson; SlideTitle = slideTitle; Extractors = new List <RegionsExtractor>(); }
public Slide Load(FileInfo file, string unitName, int slideIndex, CourseSettings settings) { var quiz = file.DeserializeXml<Quiz>(); BuildUp(quiz, file.Directory, settings); quiz.InitQuestionIndices(); var slideInfo = new SlideInfo(unitName, file, slideIndex); return new QuizSlide(slideInfo, quiz); }
public void OneTimeSetUp() { loader = new UnitLoader(new XmlSlideLoader()); courseSettings = new CourseSettings(CourseSettings.DefaultSettings); courseSettings.Scoring.Groups.Add("ScoringGroup1", new ScoringGroup { Id = "ScoringGroup1" }); }
public SlideLoadingContext(string courseId, Unit unit, CourseSettings courseSettings, DirectoryInfo courseDirectory, FileInfo slideFile) { CourseId = courseId; Unit = unit; UnitDirectory = unit.Directory; CourseDirectory = courseDirectory; CourseSettings = courseSettings; SlideFile = slideFile; }
public BuildUpContext(Unit unit, CourseSettings courseSettings, Lesson lesson, string courseId, string slideTitle) { Dir = unit.Directory; CourseSettings = courseSettings; Unit = unit; Lesson = lesson; CourseId = courseId; SlideTitle = slideTitle; Extractors = new List <RegionsExtractor>(); }
public SectionContent( string applicationName, string?applicationInfo, string customisationName, string sectionName, bool hasLearning, int diagAttempts, int diagLast, int diagAssessOutOf, string?diagAssessPath, string?plAssessPath, int attemptsPl, int plPasses, bool diagStatus, bool isAssessed, string?consolidationPath, string?courseSettings, bool includeCertification, DateTime?completed, int maxPostLearningAssessmentAttempts, int postLearningAssessmentPassThreshold, int diagnosticAssessmentCompletionThreshold, int tutorialsCompletionThreshold, bool otherSectionsExist, int?nextSectionId, string?password, bool passwordSubmitted ) { CourseTitle = $"{applicationName} - {customisationName}"; CourseDescription = applicationInfo; SectionName = sectionName; HasLearning = hasLearning; DiagnosticAttempts = diagAttempts; SectionScore = diagLast; MaxSectionScore = diagAssessOutOf; DiagnosticAssessmentPath = diagAssessPath; PostLearningAssessmentPath = plAssessPath; PostLearningAttempts = attemptsPl; PostLearningPassed = plPasses > 0; DiagnosticStatus = diagStatus; IsAssessed = isAssessed; ConsolidationPath = consolidationPath; CourseSettings = new CourseSettings(courseSettings); IncludeCertification = includeCertification; Completed = completed; MaxPostLearningAssessmentAttempts = maxPostLearningAssessmentAttempts; PostLearningAssessmentPassThreshold = postLearningAssessmentPassThreshold; DiagnosticAssessmentCompletionThreshold = diagnosticAssessmentCompletionThreshold; TutorialsCompletionThreshold = tutorialsCompletionThreshold; OtherSectionsExist = otherSectionsExist; NextSectionId = nextSectionId; Password = password; PasswordSubmitted = passwordSubmitted; }
public Slide Load(FileInfo file, string unitName, int slideIndex, CourseSettings settings) { var quiz = file.DeserializeXml<Quiz>(); int index = 1; foreach (var b in quiz.Blocks.OfType<AbstractQuestionBlock>()) { b.QuestionIndex = index++; } var slideInfo = new SlideInfo(unitName, file, slideIndex); return new QuizSlide(slideInfo, quiz); }
public Slide Load(FileInfo file, string unitName, int slideIndex, CourseSettings settings) { var lesson = file.DeserializeXml<Lesson>(); var dir = file.Directory; var context = new BuildUpContext(dir, settings, lesson); var blocks = lesson.Blocks.SelectMany(b => b.BuildUp(context, ImmutableHashSet<string>.Empty)).ToList(); var slideInfo = new SlideInfo(unitName, file, slideIndex); if (blocks.OfType<ExerciseBlock>().Any()) return new ExerciseSlide(blocks, slideInfo, lesson.Title, Guid.Parse(lesson.Id)); return new Slide(blocks, slideInfo, lesson.Title, Guid.Parse(lesson.Id)); }
public SlideLoadingContext(string courseId, Unit unit, CourseSettings courseSettings, FileInfo slideFile, int slideIndex) { CourseId = courseId; Unit = unit; UnitDirectory = unit.Directory; CourseSettings = courseSettings; SlideFile = slideFile; SlideIndex = slideIndex; }
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 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 SlideBuildingContext(string courseId, Unit unit, CourseSettings courseSettings, DirectoryInfo courseDirectory, Slide slide) { CourseId = courseId; Unit = unit; UnitDirectory = unit.Directory; CourseDirectory = courseDirectory; CourseSettings = courseSettings; Slide = slide; Extractors = new List <RegionsExtractor>(); }
public void OneTimeSetUp() { Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); loader = new XmlSlideLoader(); courseSettings = new CourseSettings(CourseSettings.DefaultSettings); courseSettings.Scoring.Groups.Add("ScoringGroup1", new ScoringGroup { Id = "ScoringGroup1" }); unit = new Unit(UnitSettings.CreateByTitle("Unit title", courseSettings), new DirectoryInfo(testDataDirectory)); }
public void OneTimeSetUp() { Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); videoAnnotationsClient = Mock.Of <IUlearnVideoAnnotationsClient>(); slideRenderer = new SlideRenderer(videoAnnotationsClient, null, null, null); loader = new XmlSlideLoader(); courseSettings = new CourseSettings(CourseSettings.DefaultSettings); courseSettings.Scoring.Groups.Add("ScoringGroup1", new ScoringGroup { Id = "ScoringGroup1" }); unit = new Unit(UnitSettings.CreateByTitle("Unit title", courseSettings), new DirectoryInfo(testDataDirectory)); }
public static void BuildUp(Quiz quiz, DirectoryInfo slideDir, CourseSettings settings) { var context = new BuildUpContext(slideDir, settings, null); var blocks = quiz.Blocks.SelectMany(b => b.BuildUp(context, ImmutableHashSet<string>.Empty)); quiz.Blocks = blocks.ToArray(); }