public void LoadChapterWithTestsAsyncShouldLoadTheChapterItsExercisesAndItsTests() { //Arrange var existingPeriod = new Period(); var courseCode = Guid.NewGuid().ToString(); var existingChapter = new ChapterBuilder().WithId() .WithCourse(courseCode) .WithPeriod(existingPeriod).Build(); _periodRepositoryMock.Setup(repo => repo.GetCurrentPeriodAsync()).ReturnsAsync(existingPeriod); _chapterRepositoryMock.Setup(repo => repo.LoadWithExercisesAndTestsAsync(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>())) .ReturnsAsync(existingChapter); //Act var result = _service.LoadChapterWithTestsAsync(existingChapter.CourseId, existingChapter.Number).Result; //Assert _periodRepositoryMock.Verify(repo => repo.GetCurrentPeriodAsync(), Times.Once); _chapterRepositoryMock.Verify(); _chapterRepositoryMock.Verify(repo => repo.LoadWithExercisesAndTestsAsync(existingChapter.CourseId, existingChapter.Number, existingPeriod.Id), Times.Once); Assert.That(result, Is.EqualTo(existingChapter)); }