Ejemplo n.º 1
0
        public async void Delete()
        {
            var mock  = new ServiceMockFacade <IVotesRepository>();
            var model = new ApiVotesRequestModel();

            mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <int>())).Returns(Task.CompletedTask);
            var service = new VotesService(mock.LoggerMock.Object,
                                           mock.RepositoryMock.Object,
                                           mock.ModelValidatorMockFactory.VotesModelValidatorMock.Object,
                                           mock.BOLMapperMockFactory.BOLVotesMapperMock,
                                           mock.DALMapperMockFactory.DALVotesMapperMock);

            ActionResponse response = await service.Delete(default(int));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <int>()));
            mock.ModelValidatorMockFactory.VotesModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <int>()));
        }