示例#1
0
        public void UpdateCustomPromptForCourse_correctly_adds_custom_prompt()
        {
            using var transaction = new TransactionScope();
            try
            {
                // Given
                const string?options = "options";

                // When
                courseAdminFieldsDataService.UpdateCustomPromptForCourse(100, 3, 1, options);
                var courseCustomPrompts = courseAdminFieldsDataService.GetCourseAdminFields(100);
                var customPrompt        = courseAdminFieldsDataService.GetCoursePromptsAlphabetical()
                                          .Single(c => c.id == 1)
                                          .name;

                // Then
                using (new AssertionScope())
                {
                    courseCustomPrompts !.CustomField3Prompt.Should().BeEquivalentTo(customPrompt);
                    courseCustomPrompts.CustomField3Options.Should().BeEquivalentTo(options);
                }
            }
            finally
            {
                transaction.Dispose();
            }
        }
        public void GetCourseAdminFieldsAlphabeticalList_calls_data_service()
        {
            // Given
            const string promptName    = "Access Permissions";
            var          coursePrompts = new List <(int, string)> {
                (1, promptName)
            };

            A.CallTo(() => courseAdminFieldsDataService.GetCoursePromptsAlphabetical()).Returns
                (coursePrompts);

            // When
            var result = courseAdminFieldsService.GetCourseAdminFieldsAlphabeticalList();

            // Then
            A.CallTo(() => courseAdminFieldsDataService.GetCoursePromptsAlphabetical()).MustHaveHappened();
            result.Should().BeEquivalentTo(coursePrompts);
        }
示例#3
0
 public IEnumerable <(int id, string value)> GetCoursePromptsAlphabeticalList()
 {
     return(courseAdminFieldsDataService.GetCoursePromptsAlphabetical().ToList());
 }