public void RemoveAdminFieldFromCourse_calls_data_service_with_correct_values()
        {
            // Given
            A.CallTo(() => courseAdminFieldsDataService.UpdateAdminFieldForCourse(1, 1, 0, null))
            .DoesNothing();
            A.CallTo(() => courseAdminFieldsDataService.DeleteAllAnswersForCourseAdminField(1, 1)).DoesNothing();

            // When
            courseAdminFieldsService.RemoveAdminFieldFromCourse(1, 1);

            // Then
            A.CallTo(
                () => courseAdminFieldsDataService.UpdateAdminFieldForCourse(1, 1, 0, null)
                ).MustHaveHappened();
            A.CallTo(() => courseAdminFieldsDataService.DeleteAllAnswersForCourseAdminField(1, 1))
            .MustHaveHappened();
        }
Ejemplo n.º 2
0
        public void DeleteAllAnswersForCourseAdminField_deletes_all_answers()
        {
            using var transaction = new TransactionScope();
            try
            {
                // When
                courseAdminFieldsDataService.DeleteAllAnswersForCourseAdminField(100, 1);
                var updatedCount = courseAdminFieldsDataService.GetAnswerCountForCourseAdminField(100, 1);

                // Then
                updatedCount.Should().Be(0);
            }
            finally
            {
                transaction.Dispose();
            }
        }
Ejemplo n.º 3
0
 public void RemoveCustomPromptFromCourse(int customisationId, int promptNumber)
 {
     using var transaction = new TransactionScope();
     try
     {
         courseAdminFieldsDataService.DeleteAllAnswersForCourseAdminField(customisationId, promptNumber);
         courseAdminFieldsDataService.UpdateCustomPromptForCourse(
             customisationId,
             promptNumber,
             0,
             null
             );
         transaction.Complete();
     }
     finally
     {
         transaction.Dispose();
     }
 }