Пример #1
0
        public void Update()
        {
            var repositoryMock = new Mock <IBookRepository>();

            repositoryMock.Setup(x => x.Update(It.IsAny <Book>())).Returns((Book x) => x);

            var handler = new BookHandler(repositoryMock.Object);

            var idBook   = Guid.NewGuid();
            var idAuthor = Guid.NewGuid();
            var book     = handler.Update(new UpdateBookCommand()
            {
                Id       = idBook,
                Title    = "Title",
                Synopsis = "Synopsis",
                AuthorId = idAuthor
            });

            book.Id.ShouldBe(idBook);
            book.Title.ShouldBe("Title");
            book.Synopsis.ShouldBe("Synopsis");
            book.AuthorId.ShouldBe(idAuthor);
        }
Пример #2
0
 public Book Put(UpdateBookCommand command)
 {
     return(_handler.Update(command));
 }