Пример #1
0
        public void GetChaptersOfCourseAsyncShouldReturnEmptyListWhenNotCurrentPeriodIsFound()
        {
            //Arrange
            var courseId = _random.NextPositive();

            _periodRepositoryMock.Setup(repo => repo.GetCurrentPeriodAsync()).Throws <DataNotFoundException>();

            //Act
            var result = _service.GetChaptersOfCourseAsync(courseId).Result;

            //Assert
            _periodRepositoryMock.Verify(repo => repo.GetCurrentPeriodAsync(), Times.Once);
            _chapterRepositoryMock.Verify(repo => repo.GetByCourseIdAsync(It.IsAny <int>(), It.IsAny <int>()), Times.Never);

            Assert.That(result, Is.Empty);
        }