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

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

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

            _repository.Verify(x => x.GetMatchesAsync(It.IsAny <short>(), It.IsAny <byte>(), It.IsAny <byte>()), Times.Once);
        }
Exemplo n.º 2
0
        public async Task Ok_Success()
        {
            _repository.Setup(x => x.GetMatchesAsync(It.IsAny <short>(), It.IsAny <byte>(), It.IsAny <byte>())).ReturnsAsync(MockedMatches().ToList());
            var service = new MatchesService(_repository.Object, null, _mapper);
            var result  = await service.GetSeasonRoundMatchesAsync(Year, Season, Round);

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

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