public void GetCourseAdminFieldsWithAnswersForCourse_Returns_Populated_List_of_CourseAdminFieldWithAnswer() { // Given const string answer1 = "ans1"; const string answer2 = "ans2"; var expected1 = PromptsTestHelper.GetDefaultCourseAdminFieldWithAnswer( 1, "System Access Granted", "Test", answer1 ); var expected2 = PromptsTestHelper.GetDefaultCourseAdminFieldWithAnswer( 2, "Priority Access", answer: answer2 ); var expected = new List <CourseAdminFieldWithAnswer> { expected1, expected2 }; A.CallTo(() => courseAdminFieldsDataService.GetCourseAdminFields(100)) .Returns(PromptsTestHelper.GetDefaultCourseAdminFieldsResult()); var delegateCourseInfo = new DelegateCourseInfo { Answer1 = answer1, Answer2 = answer2, CustomisationId = 100 }; // When var result = courseAdminFieldsService.GetCourseAdminFieldsWithAnswersForCourse(delegateCourseInfo); // Then result.Should().BeEquivalentTo(expected); }
public void GetDetailedCourseProgress_returns_progress_composed_from_data_if_progress_found() { // Given var testCourseProgress = new Progress { ProgressId = 1, CustomisationId = 4, CandidateId = 5, DiagnosticScore = 42, Completed = null, RemovedDate = null, }; var testSectionProgress = new List <DetailedSectionProgress> { new DetailedSectionProgress { SectionId = 2, SectionName = "Section2" }, new DetailedSectionProgress { SectionId = 3, SectionName = "Section3" }, }; var testTutorialProgress1 = new List <DetailedTutorialProgress> { new DetailedTutorialProgress { TutorialName = "Tut1", TutorialStatus = "Passed", AvgTime = 2, TimeTaken = 9, DiagnosticScore = 7, PossibleScore = 8, }, new DetailedTutorialProgress { TutorialName = "Tut2", TutorialStatus = "Not Passed", AvgTime = 3, TimeTaken = 8, DiagnosticScore = 5, PossibleScore = 5, }, }; var testTutorialProgress2 = new List <DetailedTutorialProgress> { new DetailedTutorialProgress { TutorialName = "Tut3", TutorialStatus = "Not Passed", AvgTime = 4, TimeTaken = 7, DiagnosticScore = 0, PossibleScore = 1, }, new DetailedTutorialProgress { TutorialName = "Tut4", TutorialStatus = "Passed", AvgTime = 5, TimeTaken = 6, DiagnosticScore = 0, PossibleScore = 5, }, }; var adminField = PromptsTestHelper.GetDefaultCourseAdminFieldWithAnswer( 2, "Priority Access", answer: "answer2" ); var testCourseAdminFields = new List <CourseAdminFieldWithAnswer> { adminField }; var testCourseInfo = new DelegateCourseInfo { DelegateLastName = "lastName", DelegateEmail = "email", DelegateId = 99, CandidateNumber = "five", LastUpdated = DateTime.UnixEpoch, Enrolled = DateTime.MinValue, Completed = DateTime.Today, CompleteBy = DateTime.Now, CustomisationId = 10, IsAssessed = true, CourseAdminFields = testCourseAdminFields }; A.CallTo(() => progressDataService.GetProgressByProgressId(1)).Returns(testCourseProgress); A.CallTo(() => progressDataService.GetSectionProgressDataForProgressEntry(1)).Returns(testSectionProgress); A.CallTo(() => progressDataService.GetTutorialProgressDataForSection(1, 2)).Returns(testTutorialProgress1); A.CallTo(() => progressDataService.GetTutorialProgressDataForSection(1, 3)).Returns(testTutorialProgress2); A.CallTo(() => courseDataService.GetDelegateCourseInfoByProgressId(1)).Returns(testCourseInfo); A.CallTo( () => courseAdminFieldsService.GetCourseAdminFieldsWithAnswersForCourse( testCourseInfo ) ).Returns(testCourseAdminFields); var testSectionProgressWithTutorials = new List <DetailedSectionProgress> { new DetailedSectionProgress { SectionId = 2, SectionName = "Section2", Tutorials = testTutorialProgress1 }, new DetailedSectionProgress { SectionId = 3, SectionName = "Section3", Tutorials = testTutorialProgress2 }, }; var expectedResult = new DetailedCourseProgress( testCourseProgress, testSectionProgressWithTutorials, testCourseInfo ); // When var result = progressService.GetDetailedCourseProgress(1); // Then result.Should().BeEquivalentTo(expectedResult); }