public async void All() { var mock = new ServiceMockFacade <IErrorLogRepository>(); var records = new List <ErrorLog>(); records.Add(new ErrorLog()); mock.RepositoryMock.Setup(x => x.All(It.IsAny <int>(), It.IsAny <int>())).Returns(Task.FromResult(records)); var service = new ErrorLogService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.ErrorLogModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLErrorLogMapperMock, mock.DALMapperMockFactory.DALErrorLogMapperMock); List <ApiErrorLogResponseModel> response = await service.All(); response.Should().HaveCount(1); mock.RepositoryMock.Verify(x => x.All(It.IsAny <int>(), It.IsAny <int>())); }