Exemplo n.º 1
0
        public void GetConsolidationPathUrl_returns_expected()
        {
            // Given
            const string consolidationPath = "path";
            const string expected          = "https://www.dls.nhs.uk/tracking/dlconsolidation?client=path";

            // Then
            OldSystemEndpointHelper.GetConsolidationPathUrl(config, consolidationPath).Should().Be(expected);
        }
        public SectionContentViewModel(IConfiguration config, SectionContent sectionContent, int customisationId, int sectionId)
        {
            CourseTitle                = sectionContent.CourseTitle;
            CourseDescription          = sectionContent.CourseDescription;
            SectionName                = sectionContent.SectionName;
            PercentComplete            = FormatPercentComplete(sectionContent);
            ShowPercentComplete        = sectionContent.HasLearning && sectionContent.CourseSettings.ShowPercentage;
            CustomisationId            = customisationId;
            SectionId                  = sectionId;
            ShowPostLearning           = sectionContent.PostLearningAssessmentPath != null && sectionContent.IsAssessed;
            PostLearningStatus         = GetPostLearningStatus(sectionContent);
            PostLearningStatusStyling  = GetPostLearningStatusStyling(sectionContent);
            ShowDiagnostic             = sectionContent.DiagnosticAssessmentPath != null && sectionContent.DiagnosticStatus;
            DiagnosticCompletionStatus = GetDiagnosticCompletionStatus(sectionContent);
            ConsolidationExercisePath  = sectionContent.ConsolidationPath == null
                ? null
                : OldSystemEndpointHelper.GetConsolidationPathUrl(config, sectionContent.ConsolidationPath);
            ShowConsolidation          = ConsolidationExercisePath != null;
            ConsolidationExerciseLabel = sectionContent.CourseSettings.ConsolidationExercise ?? "Consolidation Exercise";

            Tutorials = sectionContent.Tutorials.Select(tutorial => new TutorialCardViewModel(
                                                            tutorial,
                                                            sectionContent.CourseSettings.ShowTime,
                                                            sectionContent.CourseSettings.ShowLearnStatus,
                                                            sectionId,
                                                            customisationId
                                                            ));

            DisplayDiagnosticSeparator   = ShowDiagnostic && (sectionContent.Tutorials.Any() || ShowPostLearning || ShowConsolidation);
            DisplayTutorialSeparator     = sectionContent.Tutorials.Any() && (ShowPostLearning || ShowConsolidation);
            DisplayPostLearningSeparator = ShowConsolidation && ShowPostLearning;
            NextSectionId                  = sectionContent.NextSectionId;
            ShowCompletionSummary          = sectionContent.IncludeCertification && !sectionContent.OtherSectionsExist;
            OtherSectionsExist             = sectionContent.OtherSectionsExist;
            CompletionSummaryCardViewModel = new CompletionSummaryCardViewModel(
                customisationId,
                sectionContent.Completed,
                sectionContent.MaxPostLearningAssessmentAttempts,
                sectionContent.IsAssessed,
                sectionContent.PostLearningAssessmentPassThreshold,
                sectionContent.DiagnosticAssessmentCompletionThreshold,
                sectionContent.TutorialsCompletionThreshold
                );
        }