コード例 #1
0
        public void AddNewPublisher_PublisherWithUniqueName_CreateCalled()
        {
            var fakePublisherDTO = new ExtendPublisherDTO()
            {
                Id = Guid.NewGuid(), Name = "publisherUniqueName"
            };
            var fakePublisher = _mapper.Map <Publisher>(fakePublisherDTO);

            _uow.Setup(uow => uow.Publishers.Get(It.IsAny <Func <Publisher, bool> >())).Returns(new List <Publisher>());
            _uow.Setup(uow => uow.Publishers.Create(fakePublisher));

            _sut.AddNew(fakePublisherDTO);

            _uow.Verify(uow => uow.Publishers.Create(It.IsAny <Publisher>()), Times.Once);
        }