Exemple #1
0
        public async Task Ok_Success()
        {
            _repository.Setup(x => x.GetYearTeamsAsync(It.IsAny <short>())).ReturnsAsync(MockedTeams().ToList());

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

            _repository.Verify(x => x.BatchDeleteAsync(It.IsAny <IEnumerable <TeamProfile> >()), Times.Once);
            _repository.Verify(x => x.GetYearTeamsAsync(It.IsAny <short>()), Times.Once);
        }
Exemple #2
0
        public void GetTeamsError_ThrowException()
        {
            _repository.Setup(x => x.GetYearTeamsAsync(It.IsAny <short>())).ThrowsAsync(new DataException());

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

            Assert.ThrowsAsync <DataException>(async() => await service.DeleteAllTeamsFromSeasonAsync(Year));

            _repository.Verify(x => x.BatchDeleteAsync(It.IsAny <IEnumerable <TeamProfile> >()), Times.Never);
            _repository.Verify(x => x.GetYearTeamsAsync(It.IsAny <short>()), Times.Once);
        }