Exemplo n.º 1
0
        public void AddCustomPromptToCourse_adds_prompt_to_course_at_next_prompt_number()
        {
            // Given
            A.CallTo
            (
                () => courseAdminFieldsDataService.UpdateCustomPromptForCourse(100, A <int> ._, A <int> ._, null)
            ).DoesNothing();
            A.CallTo(() => courseAdminFieldsDataService.GetCourseAdminFields(100))
            .Returns(CustomPromptsTestHelper.GetDefaultCourseAdminFieldsResult());

            // When
            var result = courseAdminFieldsService.AddCustomPromptToCourse(100, 3, null);

            // Then
            A.CallTo
            (
                () => courseAdminFieldsDataService.UpdateCustomPromptForCourse(100, 3, 3, null)
            ).MustHaveHappened();
            result.Should().BeTrue();
        }
Exemplo n.º 2
0
        public void AddAdminField_save_redirects_to_index()
        {
            // Given
            var          model           = new AddAdminFieldViewModel(1, "Test");
            const string action          = "save";
            var          initialTempData = new AddAdminFieldData(model);

            controller.TempData.Set(initialTempData);

            A.CallTo(
                () => courseAdminFieldsService.AddCustomPromptToCourse(
                    100,
                    1,
                    "Test"
                    )
                ).Returns(true);

            // When
            var result = controller.AddAdminField(100, model, action);

            // Then
            result.Should().BeRedirectToActionResult().WithActionName("Index");
        }