Beispiel #1
0
        public void DelegateCourseInfoViewModel_sets_date_strings_correctly()
        {
            // Given
            var enrolledDate   = new DateTime(2021, 05, 1);
            var updatedDate    = new DateTime(2021, 05, 2);
            var completeByDate = new DateTime(2021, 05, 3);
            var completedDate  = new DateTime(2021, 05, 4);
            var evaluatedDate  = new DateTime(2021, 05, 5);
            var info           = new DelegateCourseInfo
            {
                Enrolled    = enrolledDate,
                LastUpdated = updatedDate,
                CompleteBy  = completeByDate,
                Completed   = completedDate,
                Evaluated   = evaluatedDate
            };
            var details = new DelegateCourseDetails(info, customPromptsWithAnswers, attemptStats);

            // When
            var model = new DelegateCourseInfoViewModel(details);

            // Then
            model.Enrolled.Should().Be("01/05/2021");
            model.LastUpdated.Should().Be("02/05/2021");
            model.CompleteBy.Should().Be("03/05/2021");
            model.Completed.Should().Be("04/05/2021");
            model.Evaluated.Should().Be("05/05/2021");
        }
        public void DelegateCourseInfoViewModel_sets_date_strings_correctly()
        {
            // Given
            var enrolledDate   = new DateTime(2021, 05, 1, 12, 12, 12);
            var updatedDate    = new DateTime(2021, 05, 2, 13, 13, 13);
            var completeByDate = new DateTime(2021, 05, 3, 14, 14, 14);
            var completedDate  = new DateTime(2021, 05, 4, 15, 15, 15);
            var evaluatedDate  = new DateTime(2021, 05, 5, 16, 16, 16);
            var info           = new DelegateCourseInfo
            {
                Enrolled    = enrolledDate,
                LastUpdated = updatedDate,
                CompleteBy  = completeByDate,
                Completed   = completedDate,
                Evaluated   = evaluatedDate,
            };

            // When
            var model = new DelegateCourseInfoViewModel(
                info,
                DelegateAccessRoute.CourseDelegates,
                new ReturnPageQuery(1, null)
                );

            // Then
            using (new AssertionScope())
            {
                model.Enrolled.Should().Be("01/05/2021 12:12");
                model.LastAccessed.Should().Be("02/05/2021 13:13");
                model.CompleteBy.Should().Be("03/05/2021 14:14");
                model.Completed.Should().Be("04/05/2021 15:15");
                model.Evaluated.Should().Be("05/05/2021 16:16");
            }
        }
Beispiel #3
0
        public void DelegateCourseInfoViewModel_without_customisation_name_sets_course_name_correctly()
        {
            // Given
            var info = new DelegateCourseInfo
            {
                ApplicationName = "my application", CustomisationName = ""
            };
            var details = new DelegateCourseDetails(info, customPromptsWithAnswers, attemptStats);

            // When
            var model = new DelegateCourseInfoViewModel(details);

            // Then
            model.CourseName.Should().Be("my application");
        }
Beispiel #4
0
        public void DelegateCourseInfoViewModel_without_supervisor_surname_sets_supervisor_correctly()
        {
            // Given
            var info = new DelegateCourseInfo
            {
                SupervisorSurname = null
            };
            var details = new DelegateCourseDetails(info, customPromptsWithAnswers, attemptStats);

            // When
            var model = new DelegateCourseInfoViewModel(details);

            // Then
            model.Supervisor.Should().BeNull();
        }
Beispiel #5
0
        public void DelegateCourseInfoViewModel_with_supervisor_forename_sets_supervisor_correctly()
        {
            // Given
            var info = new DelegateCourseInfo
            {
                SupervisorForename = "firstname",
                SupervisorSurname  = "surname"
            };
            var details = new DelegateCourseDetails(info, customPromptsWithAnswers, attemptStats);

            // When
            var model = new DelegateCourseInfoViewModel(details);

            // Then
            model.Supervisor.Should().Be("firstname surname");
        }
Beispiel #6
0
        public void DelegateCourseInfoViewModel_sets_enrollment_method_correctly(
            int enrollmentMethodId,
            string enrollmentMethod
            )
        {
            // Given
            var info = new DelegateCourseInfo {
                EnrolmentMethodId = enrollmentMethodId
            };
            var details = new DelegateCourseDetails(info, customPromptsWithAnswers, attemptStats);

            // When
            var model = new DelegateCourseInfoViewModel(details);

            // Then
            model.EnrolmentMethod.Should().Be(enrollmentMethod);
        }
        public void DelegateCourseInfoViewModel_without_customisation_name_sets_course_name_correctly()
        {
            // Given
            var info = new DelegateCourseInfo
            {
                ApplicationName = "my application", CustomisationName = "",
            };

            // When
            var model = new DelegateCourseInfoViewModel(
                info,
                DelegateAccessRoute.CourseDelegates,
                ReturnPageQueryHelper.GetDefaultReturnPageQuery()
                );

            // Then
            model.CourseName.Should().Be("my application");
        }
        public void DelegateCourseInfoViewModel_without_supervisor_surname_sets_supervisor_correctly()
        {
            // Given
            var info = new DelegateCourseInfo
            {
                SupervisorAdminId = null,
                SupervisorSurname = null,
            };

            // When
            var model = new DelegateCourseInfoViewModel(
                info,
                DelegateAccessRoute.CourseDelegates,
                ReturnPageQueryHelper.GetDefaultReturnPageQuery()
                );

            // Then
            model.Supervisor.Should().Be("None");
        }
Beispiel #9
0
        public void DelegateCourseInfoViewModel_sets_pass_rate_correctly(
            int totalAttempts,
            int attemptsPassed,
            string?passRate
            )
        {
            // Given
            var details = new DelegateCourseDetails(
                new DelegateCourseInfo(),
                customPromptsWithAnswers,
                new AttemptStats(totalAttempts, attemptsPassed)
                );

            // When
            var model = new DelegateCourseInfoViewModel(details);

            // Then
            model.PassRateDisplayString.Should().Be(passRate);
        }
        public void DelegateCourseInfoViewModel_with_supervisor_forename_sets_supervisor_correctly()
        {
            // Given
            var info = new DelegateCourseInfo
            {
                SupervisorForename    = "firstname",
                SupervisorSurname     = "surname",
                SupervisorAdminActive = true,
            };

            // When
            var model = new DelegateCourseInfoViewModel(
                info,
                DelegateAccessRoute.CourseDelegates,
                ReturnPageQueryHelper.GetDefaultReturnPageQuery()
                );

            // Then
            model.Supervisor.Should().Be("firstname surname");
        }
        public void DelegateCourseInfoViewModel_sets_enrollment_method_correctly(
            int enrollmentMethodId,
            string enrollmentMethod
            )
        {
            // Given
            var info = new DelegateCourseInfo
            {
                EnrolmentMethodId     = enrollmentMethodId, EnrolledByForename = "Test", EnrolledBySurname = "Admin",
                EnrolledByAdminActive = true,
            };

            // When
            var model = new DelegateCourseInfoViewModel(
                info,
                DelegateAccessRoute.CourseDelegates,
                ReturnPageQueryHelper.GetDefaultReturnPageQuery()
                );

            // Then
            model.EnrolmentMethod.Should().Be(enrollmentMethod);
        }