예제 #1
0
        public async Task Ok_Success()
        {
            var service = new TeamsService(null, null, _repository.Object, null, null, null, _mapper);
            await service.AddTeamAsync(MockedTeam());

            _repository.Verify(x => x.AddAsync(It.IsAny <TeamProfile>()), Times.Once);
        }
예제 #2
0
        public void RepositoryError_ThrowException()
        {
            _repository.Setup(x => x.AddAsync(It.IsAny <TeamProfile>())).ThrowsAsync(new DataException());

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

            Assert.ThrowsAsync <DataException>(async() => await service.AddTeamAsync(MockedTeam()));

            _repository.Verify(x => x.AddAsync(It.IsAny <TeamProfile>()), Times.Once);
        }