Example #1
0
        public void CreateAsync_CallsRepository_WhenValidDto()
        {
            var dto = CreateTestModifyPublisherDto();

            _publisherService.CreateAsync(dto);

            A.CallTo(() => _publisherDecorator.AddAsync(A <Publisher> ._)).MustHaveHappenedOnceExactly();
        }
Example #2
0
        public async Task CreateAsync(ModifyPublisherDto publisherDto)
        {
            if (publisherDto == null)
            {
                throw new InvalidServiceOperationException("Is null publisher dto");
            }

            var publisher = _mapper.Map <Publisher>(publisherDto);
            await _publisherDecorator.AddAsync(publisher);

            await _unitOfWork.CommitAsync();
        }