Example #1
0
        public async void ByOwnerUserId_Not_Exists()
        {
            var mock = new ServiceMockFacade <IPostRepository>();

            mock.RepositoryMock.Setup(x => x.ByOwnerUserId(It.IsAny <int?>(), It.IsAny <int>(), It.IsAny <int>())).Returns(Task.FromResult <List <Post> >(new List <Post>()));
            var service = new PostService(mock.LoggerMock.Object,
                                          mock.RepositoryMock.Object,
                                          mock.ModelValidatorMockFactory.PostModelValidatorMock.Object,
                                          mock.BOLMapperMockFactory.BOLPostMapperMock,
                                          mock.DALMapperMockFactory.DALPostMapperMock);

            List <ApiPostResponseModel> response = await service.ByOwnerUserId(default(int?));

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