public BookCommandHandlerTests() { doctorRepository = new DoctorFakeRepository(); userRepository = new UserFakeRepository(); bookRepository = new BookFakeRepository(userRepository, doctorRepository); _handler = new BookCommandHandler(bookRepository, doctorRepository, userRepository); }
public BookMutation(BookCommandHandler commandHandler) { Field <BookType>( "createBook", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <BookInputType> > { Name = "book", Description = "book" } ), resolve: context => { //var human = context.GetArgument<Human>("human"); var book = context.GetArgument <Book>("book"); var command = new CreateBookCommand { AuthorId = book.AuthorId, CategoryId = book.CategoryId, CountryId = book.CountryId, LanguageId = book.LanguageId, PublisherId = book.PublisherId, Description = book.Description, Title = book.Title }; /*var command = new CreateBookCommand * { * AuthorId = context.GetArgument<int>("authorId"), * CategoryId = context.GetArgument<int>("categoryId"), * CountryId = context.GetArgument<int>("countryId"), * LanguageId = context.GetArgument<int>("languageId"), * PublisherId = context.GetArgument<int>("publisherId"), * Description = context.GetArgument<string>("description"), * Title = context.GetArgument<string>("title") * };*/ return(commandHandler.Handle(command)); }); }
public BookController(IUow uow, BookCommandHandler handler, IBookRepository repository) : base(uow) { _handler = handler; _repository = repository; }