Exemple #1
0
        public void RepositoryError_ThrowException()
        {
            _repository.Setup(x => x.GetTeamSeasonMatches(It.IsAny <short>(), It.IsAny <byte>(), It.IsAny <int>())).ThrowsAsync(new DataException());

            var service = new TeamsService(null, null, null, null, _repository.Object, null, _mapper);

            Assert.ThrowsAsync <DataException>(async() => await service.GetTeamSeasonMatchesAsync(TeamId, Year, Season));

            _repository.Verify(x => x.GetTeamSeasonMatches(It.IsAny <short>(), It.IsAny <byte>(), It.IsAny <int>()), Times.Once);
        }
Exemple #2
0
        public async Task Ok_Success()
        {
            _repository.Setup(x => x.GetTeamSeasonMatches(It.IsAny <short>(), It.IsAny <byte>(), It.IsAny <int>())).ReturnsAsync(MockedMatches().ToList());
            var service = new TeamsService(null, null, null, null, _repository.Object, null, _mapper);
            var result  = await service.GetTeamSeasonMatchesAsync(TeamId, Year, Season);

            Assert.NotNull(result);
            Assert.IsInstanceOf <IEnumerable <BusinessEntities.Match> >(result);

            _repository.Verify(x => x.GetTeamSeasonMatches(It.IsAny <short>(), It.IsAny <byte>(), It.IsAny <int>()), Times.Once);
        }