Ejemplo n.º 1
0
        public void RepositoryError_ThrowException()
        {
            _repository.Setup(x => x.GetByKeyAsync(It.IsAny <short>(), It.IsAny <string>())).ThrowsAsync(new DataException());

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

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

            _repository.Verify(x => x.GetByKeyAsync(It.IsAny <short>(), It.IsAny <string>()), Times.Once);
        }
Ejemplo n.º 2
0
        public async Task Ok_Success()
        {
            _repository.Setup(x => x.GetByKeyAsync(It.IsAny <short>(), It.IsAny <string>())).ReturnsAsync(MockedStats());
            var service = new TeamsService(null, null, null, _repository.Object, null, null, _mapper);
            var result  = await service.GetTeamSeasonStatsAsync(TeamId, Year, Season);

            Assert.NotNull(result);
            Assert.IsInstanceOf <BusinessEntities.TeamSeasonStats>(result);

            _repository.Verify(x => x.GetByKeyAsync(It.IsAny <short>(), It.IsAny <string>()), Times.Once);
        }