public void GetDelegateAnswersForCourseAdminFields_returns_expected_results() { // Given const int customisationId = 319; const int centreId = 101; var expectedResult = new List <DelegateCourseAdminFieldAnswers> { new DelegateCourseAdminFieldAnswers { Answer1 = "s", Answer2 = "sss", Answer3 = "", }, new DelegateCourseAdminFieldAnswers { Answer1 = "uyuy", Answer2 = "hhjkh", Answer3 = "", } }; // When var result = courseAdminFieldsDataService.GetDelegateAnswersForCourseAdminFields(customisationId, centreId) .ToList(); // Then using (new AssertionScope()) { result.Should().HaveCount(2); result.Should().BeEquivalentTo(expectedResult); } }
public void GetCourseAdminFieldsWithAnswerCountsForCourse_returns_empty_list_with_no_admin_fields() { // Given const int customisationId = 1; const int centreId = 1; A.CallTo(() => courseAdminFieldsDataService.GetCourseAdminFields(customisationId)) .Returns(new CourseAdminFieldsResult()); // When var result = courseAdminFieldsService.GetCourseAdminFieldsWithAnswerCountsForCourse(customisationId, centreId); // Then using (new AssertionScope()) { result.Should().BeEmpty(); A.CallTo( () => courseAdminFieldsDataService.GetDelegateAnswersForCourseAdminFields(customisationId, centreId) ).MustNotHaveHappened(); } }
public IEnumerable <CourseAdminFieldWithResponseCounts> GetCourseAdminFieldsWithAnswerCountsForCourse( int customisationId, int centreId ) { var result = courseAdminFieldsDataService.GetCourseAdminFields(customisationId); var adminFields = GetBaseCourseAdminFieldWithResponseCountsModelsFromResult(result); if (!adminFields.Any()) { return(adminFields); } var allAnswers = courseAdminFieldsDataService .GetDelegateAnswersForCourseAdminFields(customisationId, centreId) .ToList(); foreach (var adminField in adminFields) { adminField.ResponseCounts = GetResponseCountsForPrompt(adminField, allAnswers); } return(adminFields); }