public void GetLearningLogDetails_returns_course_and_log_details_when_available() { // Given const int progressId = 1; var courseDetails = Builder <DelegateCourseInfo> .CreateNew().Build(); var learningLogEntries = Builder <LearningLogEntry> .CreateListOfSize(5).Build(); var expectedLearningLog = new LearningLog(courseDetails, learningLogEntries); A.CallTo(() => courseDataService.GetDelegateCourseInfoByProgressId(progressId)).Returns(courseDetails); A.CallTo(() => progressDataService.GetLearningLogEntries(progressId)).Returns(learningLogEntries); // When var result = courseService.GetLearningLogDetails(progressId); // Then using (new AssertionScope()) { result.Should().BeEquivalentTo(expectedLearningLog); A.CallTo(() => courseDataService.GetDelegateCourseInfoByProgressId(progressId)) .MustHaveHappenedOnceExactly(); A.CallTo( () => progressDataService.GetLearningLogEntries(progressId) ).MustHaveHappenedOnceExactly(); } }
public LearningLogViewModel( DelegateAccessRoute accessedVia, LearningLog learningLog, SearchSortFilterPaginationResult <LearningLogEntry> result ) : base(result, false) { AccessedVia = accessedVia; ProgressId = learningLog.DelegateCourseInfo.ProgressId; CustomisationId = learningLog.DelegateCourseInfo.CustomisationId; CourseName = learningLog.DelegateCourseInfo.CourseName; DelegateId = learningLog.DelegateCourseInfo.DelegateId; DelegateFirstName = learningLog.DelegateCourseInfo.DelegateFirstName; DelegateLastName = learningLog.DelegateCourseInfo.DelegateLastName; DelegateEmail = learningLog.DelegateCourseInfo.DelegateEmail; Entries = result.ItemsToDisplay.Select(entry => new LearningLogEntryViewModel(entry)); }