Пример #1
0
        public async void ByUserId_Not_Exists()
        {
            var mock = new ServiceMockFacade <ICommentService, ICommentRepository>();

            mock.RepositoryMock.Setup(x => x.ByUserId(It.IsAny <int?>(), It.IsAny <int>(), It.IsAny <int>())).Returns(Task.FromResult <List <Comment> >(new List <Comment>()));
            var service = new CommentService(mock.LoggerMock.Object,
                                             mock.MediatorMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.CommentModelValidatorMock.Object,
                                             mock.DALMapperMockFactory.DALCommentMapperMock);

            List <ApiCommentServerResponseModel> response = await service.ByUserId(default(int));

            response.Should().BeEmpty();
            mock.RepositoryMock.Verify(x => x.ByUserId(It.IsAny <int?>(), It.IsAny <int>(), It.IsAny <int>()));
        }