public void GetCustomFieldViewModelsForCentre_returns_populated_list() { // Given var customPrompt1 = CustomPromptsTestHelper.GetDefaultCustomPrompt(1, options: "Clinical\r\nNon-Clinical"); var customPrompt2 = CustomPromptsTestHelper.GetDefaultCustomPrompt(2); var centreCustomPrompts = CustomPromptsTestHelper.GetDefaultCentreCustomPrompts( new List <CustomPrompt> { customPrompt1, customPrompt2 }, 1 ); A.CallTo(() => centreCustomPromptsService.GetCustomPromptsForCentreByCentreId(1)) .Returns(centreCustomPrompts); // When var result = centreCustomPromptHelper.GetCustomFieldViewModelsForCentre(1, Answer1, Answer2, null, null, null, null); // Then using (new AssertionScope()) { result.Count.Should().Be(2); result[0].CustomFieldId.Should().Be(1); result[1].CustomFieldId.Should().Be(2); } }
public IActionResult Index(int delegateId) { var centreId = User.GetCentreId(); var delegateUser = userDataService.GetDelegateUserCardById(delegateId) !; var categoryIdFilter = User.GetAdminCourseCategoryFilter(); var customFields = centreCustomPromptHelper.GetCustomFieldViewModelsForCentre(centreId, delegateUser); var delegateCourses = courseService.GetAllCoursesInCategoryForDelegate(delegateId, centreId, categoryIdFilter); var model = new ViewDelegateViewModel(delegateUser, customFields, delegateCourses); return(View(model)); }