public void GetNullableContentPath_should_parse_paths( string?givenVideoPath, string?expectedParsedPath ) { // When var actualParsedPath = ContentUrlHelper.GetNullableContentPath(config, givenVideoPath); // Then actualParsedPath.Should().Be(expectedParsedPath); }
public void GetContentPath_should_parse_relative_path() { // Given const string videoPath = "/testVideo.mp4"; // When var parsedPath = ContentUrlHelper.GetContentPath(config, videoPath); // Then parsedPath.Should().Be(BaseUrl + videoPath); }
public void GetContentPath_should_parse_protocol_relative_url() { // Given const string videoPath = "example.com/testVideo.mp4"; // When var parsedPath = ContentUrlHelper.GetContentPath(config, videoPath); // Then parsedPath.Should().Be($"https://{videoPath}"); }
public void GetContentPath_should_parse_absolute_url() { // Given const string videoPath = "https://example.com/testVideo.mp4"; // When var parsedPath = ContentUrlHelper.GetContentPath(config, videoPath); // Then parsedPath.Should().Be(videoPath); }
public TutorialVideoViewModel( IConfiguration config, TutorialVideo tutorialVideo, int customisationId, int sectionId, int tutorialId ) { CustomisationId = customisationId; SectionId = sectionId; TutorialId = tutorialId; TutorialName = tutorialVideo.TutorialName; SectionName = tutorialVideo.SectionName; CourseTitle = tutorialVideo.CourseTitle; VideoPath = ContentUrlHelper.GetContentPath(config, tutorialVideo.VideoPath); }
public void Tutorial_parses_supporting_materials_path(string?supportingMaterialPath) { // Given var expectedTutorialInformation = TutorialContentHelper.CreateDefaultTutorialInformation( supportingMaterialPath: supportingMaterialPath ); var expectedParsedPath = ContentUrlHelper.GetNullableContentPath(config, supportingMaterialPath); // When var tutorialViewModel = new TutorialViewModel( config, expectedTutorialInformation, CustomisationId, SectionId ); // Then tutorialViewModel.SupportingMaterialPath.Should().Be(expectedParsedPath); }
public TutorialViewModel( IConfiguration config, TutorialInformation tutorialInformation, int customisationId, int sectionId ) { TutorialName = tutorialInformation.Name; SectionName = tutorialInformation.SectionName; CourseTitle = tutorialInformation.CourseTitle; CourseDescription = tutorialInformation.CourseDescription; TutorialPath = tutorialInformation.TutorialPath; VideoPath = tutorialInformation.VideoPath; Status = tutorialInformation.Status; ShowLearnStatus = tutorialInformation.CourseSettings.ShowLearnStatus; SupportingMaterialsLabel = tutorialInformation.CourseSettings.SupportingInformation ?? "Download supporting materials"; CustomisationId = customisationId; SectionId = sectionId; TutorialId = tutorialInformation.Id; Objectives = ParseObjectives(tutorialInformation.Objectives); CanShowProgress = GetCanShowProgress( tutorialInformation.CourseSettings.ShowLearnStatus, tutorialInformation.CanShowDiagnosticStatus, tutorialInformation.AttemptCount ); TutorialRecommendation = GetTutorialRecommendation(tutorialInformation.CurrentScore, tutorialInformation.PossibleScore); ScoreSummary = GetScoreSummary(tutorialInformation.CurrentScore, tutorialInformation.PossibleScore); TimeSummary = new TutorialTimeSummaryViewModel( tutorialInformation.TimeSpent, tutorialInformation.AverageTutorialDuration, tutorialInformation.CourseSettings.ShowTime, tutorialInformation.CourseSettings.ShowLearnStatus ); SupportingMaterialPath = ContentUrlHelper.GetNullableContentPath(config, tutorialInformation.SupportingMaterialPath); NextLinkViewModel = new TutorialNextLinkViewModel( customisationId, sectionId, tutorialInformation.PostLearningAssessmentPath, tutorialInformation.NextTutorialId, tutorialInformation.NextSectionId ); OnlyItemInOnlySection = !tutorialInformation.OtherItemsInSectionExist && !tutorialInformation.OtherSectionsExist; OnlyItemInThisSection = !tutorialInformation.OtherItemsInSectionExist; ShowCompletionSummary = OnlyItemInOnlySection && tutorialInformation.IncludeCertification; CompletionSummaryCardViewModel = new CompletionSummaryCardViewModel( customisationId, tutorialInformation.Completed, tutorialInformation.MaxPostLearningAssessmentAttempts, tutorialInformation.IsAssessed, tutorialInformation.PostLearningAssessmentPassThreshold, tutorialInformation.DiagnosticAssessmentCompletionThreshold, tutorialInformation.TutorialsCompletionThreshold ); TutorialStartButtonAdditionalStyling = tutorialInformation.Status == "Complete" ? "nhsuk-button--secondary" : ""; TutorialStartButtonText = tutorialInformation.Status == "Complete" ? "Restart tutorial" : "Start tutorial"; ShowNextButton = tutorialInformation.Status == "Complete" && !OnlyItemInOnlySection; }