public async Task Ok_Success() { var service = new MatchesService(_repository.Object, null, _mapper); await service.BulkAddMatches(MockedMatches().ToList()); _repository.Verify(x => x.BatchUpsertAsync(It.IsAny <IEnumerable <DataRepository.DataEntities.Match> >()), Times.Once); }
public void RepositoryError_ThrowException() { _repository.Setup(x => x.BatchUpsertAsync(It.IsAny <IEnumerable <DataRepository.DataEntities.Match> >())).ThrowsAsync(new DataException()); var service = new MatchesService(_repository.Object, null, _mapper); Assert.ThrowsAsync <DataException>(async() => await service.BulkAddMatches(MockedMatches().ToList())); _repository.Verify(x => x.BatchUpsertAsync(It.IsAny <IEnumerable <DataRepository.DataEntities.Match> >()), Times.Once); }