public async void RemoveAllExpiredElectionUnitTest() { // Arrange var mockRepo = GetElectionRepositoryMock(); var service = new ElectionService(mockRepo.Object); // Act await service.RemoveAllExpiredElectionsAsync(); // Assert mockRepo.Verify(repo => repo.RemoveAsync(It.IsAny <Election>()), Times.AtMostOnce); }