Ejemplo n.º 1
0
        public void Completed_courses_should_correctly_return_the_second_page_of_courses()
        {
            var courses = new[]
            {
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "a course 1"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "b course 2"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "c course 3"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "d course 4"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "e course 5"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "f course 6"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "g course 7"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "h course 8"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "i course 9"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "j course 10"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "k course 11"),
            };

            model = new CompletedPageViewModel(
                courses,
                completedResources,
                config,
                null,
                "Name",
                "Ascending",
                null,
                2
                );

            model.CompletedActivities.Count().Should().Be(3);
            model.CompletedActivities.First().Name.Should().Be("k course 11");
        }
 public void SetUp()
 {
     currentCourses = new[]
     {
         CurrentCourseHelper.CreateDefaultCurrentCourse(71, "b: course"),
         CurrentCourseHelper.CreateDefaultCurrentCourse(72, "C: Course"),
         CurrentCourseHelper.CreateDefaultCurrentCourse(73, "A: Course"),
     };
     currentCoursesWithSelfAssessment = new CurrentLearningItem[]
     {
         CurrentCourseHelper.CreateDefaultCurrentCourse(71, "d: course"),
         CurrentCourseHelper.CreateDefaultCurrentCourse(72, "C: Course"),
         SelfAssessmentHelper.CreateDefaultSelfAssessment(74, "a: self assessment"),
         CurrentCourseHelper.CreateDefaultCurrentCourse(73, "A: Course"),
     };
     completedCourses = new[]
     {
         CompletedCourseHelper.CreateDefaultCompletedCourse(71, "First course"),
         CompletedCourseHelper.CreateDefaultCompletedCourse(72, "Course 20: the best course"),
         CompletedCourseHelper.CreateDefaultCompletedCourse(73, "Last course 30105 and a lot of other text"),
     };
     availableCourses = new[]
     {
         AvailableCourseHelper.CreateDefaultAvailableCourse(71, "One great course"),
         AvailableCourseHelper.CreateDefaultAvailableCourse(72, "The course v1"),
         AvailableCourseHelper.CreateDefaultAvailableCourse(73, "Course 1: some more title text"),
     };
 }
Ejemplo n.º 3
0
        public void Completed_courses_should_default_to_returning_the_first_ten_courses()
        {
            var courses = new[]
            {
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "a course 1"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "b course 2"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "c course 3"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "d course 4"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "e course 5"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "f course 6"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "g course 7"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "h course 8"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "i course 9"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "j course 10"),
                CompletedCourseHelper.CreateDefaultCompletedCourse(courseName: "k course 11"),
            };

            model = new CompletedPageViewModel(
                courses,
                completedResources,
                config,
                null,
                "Name",
                "Ascending",
                null,
                1
                );

            model.CompletedActivities.Count().Should().Be(10);
            model.CompletedActivities.FirstOrDefault(course => course.Name == "k course 11").Should().BeNull();
        }
        public void Completed_course_should_not_have_passed_sections_without_learning_assessment()
        {
            // Given
            var completedCourse = CompletedCourseHelper.CreateDefaultCompletedCourse(isAssessed: false);

            // When
            var completedCourseViewModel = new CompletedCourseViewModel(completedCourse, config);

            // Then
            completedCourseViewModel.HasPassedSections().Should().BeFalse();
        }
        public void Completed_course_should_have_diagnostic_score_with_diagnostic_score_value_and_diagnostic_assessment()
        {
            // Given
            var completedCourse = CompletedCourseHelper.CreateDefaultCompletedCourse();

            // When
            var completedCourseViewModel = new CompletedCourseViewModel(completedCourse, config);

            // Then
            completedCourseViewModel.HasDiagnosticScore().Should().BeTrue();
        }
        public void Completed_course_should_not_have_diagnostic_score_without_diagnostic_score_value()
        {
            // Given
            var completedCourse = CompletedCourseHelper.CreateDefaultCompletedCourse(diagnosticScore: null);

            // When
            var completedCourseViewModel = new CompletedCourseViewModel(completedCourse, config);

            // Then
            completedCourseViewModel.HasDiagnosticScore().Should().BeFalse();
        }
Ejemplo n.º 7
0
        public async Task Completed_action_should_have_banner_text()
        {
            // Given
            A.CallTo(() => config[ConfigHelper.UseSignposting]).Returns("true");
            const string bannerText = "Banner text";

            A.CallTo(() => centresDataService.GetBannerText(CentreId)).Returns(bannerText);

            // When
            var completedViewModel = await CompletedCourseHelper.CompletedViewModelFromController(controller);

            // Then
            completedViewModel.BannerText.Should().Be(bannerText);
        }
        public void Completed_course_should_have_correct_finalise_button(
            bool hasLearning,
            DateTime?evaluated,
            bool isAssessed,
            string expectedButtonText,
            bool hasButton
            )
        {
            // Given
            var completedCourse = CompletedCourseHelper.CreateDefaultCompletedCourse(hasLearning: hasLearning, evaluated: evaluated, isAssessed: isAssessed);

            // When
            var completedCourseViewModel = new CompletedCourseViewModel(completedCourse, config);

            // Then
            completedCourseViewModel.FinaliseButtonText().Should().Be(expectedButtonText);
            completedCourseViewModel.HasFinaliseButton().Should().Be(hasButton);
        }
Ejemplo n.º 9
0
        public async Task Completed_action_should_return_view_result()
        {
            // Given
            A.CallTo(() => config[ConfigHelper.UseSignposting]).Returns("true");
            var completedCourses = new[]
            {
                CompletedCourseHelper.CreateDefaultCompletedCourse(),
                CompletedCourseHelper.CreateDefaultCompletedCourse(),
            };
            var completedActionPlanResources = Builder <ActionPlanResource> .CreateListOfSize(2).Build().ToList();

            var mappedActionPlanResources =
                completedActionPlanResources.Select(r => new CompletedActionPlanResource(r));
            var bannerText = "bannerText";

            A.CallTo(() => courseDataService.GetCompletedCourses(CandidateId)).Returns(completedCourses);
            A.CallTo(() => actionPlanService.GetCompletedActionPlanResources(CandidateId))
            .Returns(completedActionPlanResources);
            A.CallTo(() => centresDataService.GetBannerText(CentreId)).Returns(bannerText);

            // When
            var result = await controller.Completed();

            // Then
            var expectedModel = new CompletedPageViewModel(
                completedCourses,
                mappedActionPlanResources,
                config,
                null,
                "Completed",
                "Descending",
                bannerText,
                1
                );

            result.Should().BeViewResult()
            .Model.Should().BeEquivalentTo(expectedModel);
        }
Ejemplo n.º 10
0
        public void SetUp()
        {
            var config = A.Fake <IConfiguration>();

            A.CallTo(() => config["CurrentSystemBaseUrl"]).Returns("http://www.dls.nhs.uk");

            currentCourses = new[]
            {
                CurrentCourseHelper.CreateDefaultCurrentCourse(
                    71,
                    "B: Course",
                    true,
                    isAssessed: true,
                    startedDate: new DateTime(2010, 1, 31),
                    lastAccessed: new DateTime(2010, 2, 22),
                    completeByDate: new DateTime(2010, 3, 22),
                    passes: 4,
                    diagnosticScore: 123
                    ),
                CurrentCourseHelper.CreateDefaultCurrentCourse(
                    72,
                    "C: Course",
                    true,
                    isAssessed: false,
                    startedDate: new DateTime(2010, 2, 1),
                    lastAccessed: new DateTime(2011, 2, 22),
                    completeByDate: new DateTime(2011, 3, 22),
                    passes: 14,
                    diagnosticScore: 0
                    ),
                CurrentCourseHelper.CreateDefaultCurrentCourse(
                    73,
                    "A: Course",
                    false,
                    isAssessed: true,
                    startedDate: new DateTime(2001, 1, 22),
                    lastAccessed: new DateTime(2011, 2, 23),
                    completeByDate: null,
                    passes: 0,
                    diagnosticScore: 0
                    ),
            }.AsQueryable();

            completedCourses = new[]
            {
                CompletedCourseHelper.CreateDefaultCompletedCourse(
                    71,
                    "B: Course",
                    true,
                    isAssessed: true,
                    startedDate: new DateTime(2010, 1, 31),
                    lastAccessed: new DateTime(2010, 2, 22),
                    completed: new DateTime(2010, 3, 22),
                    evaluated: new DateTime(2010, 5, 5),
                    diagnosticScore: 123,
                    passes: 4
                    ),
                CompletedCourseHelper.CreateDefaultCompletedCourse(
                    72,
                    "C: Course",
                    true,
                    isAssessed: false,
                    startedDate: new DateTime(2010, 2, 1),
                    lastAccessed: new DateTime(2011, 2, 22),
                    completed: new DateTime(2011, 3, 22),
                    evaluated: new DateTime(2008, 5, 5),
                    diagnosticScore: 0,
                    passes: 14
                    ),
                CompletedCourseHelper.CreateDefaultCompletedCourse(
                    73,
                    "A: Course",
                    false,
                    isAssessed: true,
                    startedDate: new DateTime(2001, 1, 22),
                    lastAccessed: new DateTime(2011, 2, 23),
                    completed: new DateTime(2011, 2, 23),
                    evaluated: new DateTime(2009, 5, 5),
                    diagnosticScore: 0,
                    passes: 0
                    ),
            }.AsQueryable();

            availableCourses = new[]
            {
                AvailableCourseHelper.CreateDefaultAvailableCourse(
                    71,
                    "A: Course",
                    brand: "B: Brand",
                    category: "C: Category",
                    topic: "B: Topic"
                    ),
                AvailableCourseHelper.CreateDefaultAvailableCourse(
                    72,
                    "B: Course",
                    brand: "A: Brand",
                    category: null,
                    topic: "A: Topic"
                    ),
                AvailableCourseHelper.CreateDefaultAvailableCourse(
                    73,
                    "C: Course",
                    brand: "C: Brand",
                    category: "A: Category",
                    topic: null
                    ),
            }.AsQueryable();
        }