public async void All() { var mock = new ServiceMockFacade <IEmailRepository>(); var records = new List <Email>(); records.Add(new Email()); mock.RepositoryMock.Setup(x => x.All(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>())).Returns(Task.FromResult(records)); var service = new EmailService(mock.LoggerMock.Object, mock.MediatorMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.EmailModelValidatorMock.Object, mock.DALMapperMockFactory.DALEmailMapperMock); List <ApiEmailServerResponseModel> response = await service.All(); response.Should().HaveCount(1); mock.RepositoryMock.Verify(x => x.All(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>())); }