Пример #1
0
        public void CreateNewCentreCourse_correctly_adds_new_course()
        {
            using var transaction = new TransactionScope();
            try
            {
                // Given
                const int    centreId                = 2;
                const int    applicationId           = 1;
                const string customisationName       = "Name";
                const string password                = "******";
                const bool   selfRegister            = false;
                const int    tutCompletionThreshold  = 0;
                const bool   isAssessed              = true;
                const int    diagCompletionThreshold = 0;
                const bool   diagObjSelect           = false;
                const bool   hideInLearnerPortal     = false;
                const string notificationEmails      = "*****@*****.**";
                int?         categoryId              = null;

                var customisation = new Customisation(
                    centreId,
                    applicationId,
                    customisationName,
                    password,
                    selfRegister,
                    tutCompletionThreshold,
                    isAssessed,
                    diagCompletionThreshold,
                    diagObjSelect,
                    hideInLearnerPortal,
                    notificationEmails
                    );

                // When
                var customisationId = courseDataService.CreateNewCentreCourse(customisation);

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

                // Then
                using (new AssertionScope())
                {
                    courseDetails !.CurrentVersion.Should().Be(1);
                    courseDetails.CentreId.Should().Be(centreId);
                    courseDetails.ApplicationId.Should().Be(applicationId);
                    courseDetails.Active.Should().BeTrue();
                    courseDetails.CustomisationName.Should().Be(customisationName);
                    courseDetails.Password.Should().Be(password);
                    courseDetails.SelfRegister.Should().Be(selfRegister);
                    courseDetails.TutCompletionThreshold.Should().Be(tutCompletionThreshold);
                    courseDetails.IsAssessed.Should().Be(isAssessed);
                    courseDetails.DiagCompletionThreshold.Should().Be(diagCompletionThreshold);
                    courseDetails.DiagObjSelect.Should().Be(diagObjSelect);
                    courseDetails.HideInLearnerPortal.Should().Be(hideInLearnerPortal);
                    courseDetails.NotificationEmails.Should().Be(notificationEmails);
                }
            }
            finally
            {
                transaction.Dispose();
            }
        }