Example #1
0
        public void UpdateCourseDetails_correctly_updates_course_details()
        {
            using var transaction = new TransactionScope();
            try
            {
                // Given
                const int    customisationId         = 1;
                const string customisationName       = "Name";
                const string password                = "******";
                const string notificationEmails      = "*****@*****.**";
                const bool   isAssessed              = true;
                const int    tutCompletionThreshold  = 0;
                const int    diagCompletionThreshold = 0;
                const int    centreId                = 2;
                int?         categoryId              = null;

                // When
                courseDataService.UpdateCourseDetails(
                    customisationId,
                    customisationName,
                    password,
                    notificationEmails,
                    isAssessed,
                    tutCompletionThreshold,
                    diagCompletionThreshold
                    );

                var courseDetails = courseDataService.GetCourseDetailsFilteredByCategory(
                    customisationId,
                    centreId,
                    categoryId
                    );

                // Then
                using (new AssertionScope())
                {
                    courseDetails !.CustomisationName.Should().Be(customisationName);
                    courseDetails.Password.Should().Be(password);
                    courseDetails.NotificationEmails.Should().Be(notificationEmails);
                    courseDetails.IsAssessed.Should().Be(isAssessed);
                    courseDetails.TutCompletionThreshold.Should().Be(tutCompletionThreshold);
                    courseDetails.DiagCompletionThreshold.Should().Be(diagCompletionThreshold);
                }
            }
            finally
            {
                transaction.Dispose();
            }
        }
Example #2
0
 public void TrimCustomisationNameOrConvertToEmptyStringIfNull()
 {
     CustomisationName = string.IsNullOrWhiteSpace(CustomisationName) ? string.Empty : CustomisationName.Trim();
 }