Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }