Esempio n. 1
0
        public void Insert()
        {
            var repositoryMock = new Mock <IBookRepository>();

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

            var handler = new BookHandler(repositoryMock.Object);

            var idAuthor = Guid.NewGuid();
            var book     = handler.Insert(new InsertBookCommand()
            {
                Title    = "Title",
                Synopsis = "Synopsis",
                AuthorId = idAuthor
            });

            book.Title.ShouldBe("Title");
            book.Synopsis.ShouldBe("Synopsis");
            book.AuthorId.ShouldBe(idAuthor);
        }
Esempio n. 2
0
 public Book Post(InsertBookCommand command)
 {
     return(_handler.Insert(command));
 }