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); }
public Book Post(InsertBookCommand command) { return(_handler.Insert(command)); }