public async void SearchElectionUnitTest() { // Arrange var mockRepo = GetElectionRepositoryMock(); var service = new ElectionService(mockRepo.Object); // Act await service.SearchAsync(new ElectionSearchRequest()); // Assert mockRepo.Verify(repo => repo.SearchAsync(It.IsAny <Expression <Func <Election, bool> > >()), Times.AtMostOnce); }