public OrderController(IUow uow, OrderCommandHandler orderCommandHandler, IOrderAdoRepository orderAdoRepository) : base(uow) { _orderCommandHandler = orderCommandHandler; _orderAdoRepository = orderAdoRepository; }
public OrderCommandHandlerTests() { _mocker = new AutoMocker(); _orderCommandHandler = _mocker.CreateInstance <OrderCommandHandler>(); _clientId = Guid.NewGuid(); _itemId = Guid.NewGuid(); _order = Order.OrderFactory.NewDraftOrder(_clientId); }
public CreateNewOrderCommandTestes(PizzaFixture pizzaFixture) { this.pizzaFixture = pizzaFixture; orderRepository = new Mock <IOrderRepository>(); var uOw = new Mock <IUnitOfWork>(); orderCommandHandler = new OrderCommandHandler(orderRepository.Object, uOw.Object); orderQueryHandler = new OrderQueryHandler(orderRepository.Object); }
private static void GenerateOrder( ICustomerRepository customerRepository, IProductRepository productRepository, IOrderRepository orderRepository, RegisterOrderCommand command) { var handler = new OrderCommandHandler(customerRepository, productRepository, orderRepository); handler.Handle(command); }
public static void GenerateOrder(ICustomerRepository customerRepository, IProductRepository productRepository, IOrderRepository orderRepository, RegisterOrderCommand command) { var handler = new OrderCommandHandler(customerRepository, productRepository, orderRepository); handler.Handle(command); if (handler.IsValid()) { Console.WriteLine("Your order has been submitted"); } }
public ActionResult Order(OrderCommand order, [FromServices] OrderCommandHandler handler) { var result = handler.Handle(order); if (result.PaymentOk) { ViewData["Message"] = "Thank you. Your order has been placed."; return(View(result)); } else { return(RedirectToAction("PaymentFailed")); } }
public static void GenerateOrder( ICustomerRepository customerRepository, IProductRepository productRepository, IOrderRepository orderRepository, RegisterOrderCommand command) { var handler = new OrderCommandHandler(customerRepository, productRepository, orderRepository); handler.Handle(command); if (handler.IsValid()) { System.Console.WriteLine("Customer registrado com sucesso!"); } }
public static void GenerateOrder(ICustomerRepository customerRepository, IProductRepository productRepository, IOrderRepository orderRepository, RegisterOrderCommand command) { var handler = new OrderCommandHandler(customerRepository, productRepository, orderRepository); handler.Handle(command); //Console.WriteLine($"Anterior {mouse.QuantityOnHand} mouse"); //Console.WriteLine($"Anterior {mousePad.QuantityOnHand} mousePad"); //Console.WriteLine($"Anterior {teclado.QuantityOnHand} teclado"); //order.AddItem(new OrderItem(mouse, 2)); //order.AddItem(new OrderItem(mousePad, 2)); //order.AddItem(new OrderItem(teclado, 2)); //Console.WriteLine($"Depois {mouse.QuantityOnHand} mouse"); //Console.WriteLine($"Depois {mousePad.QuantityOnHand} mousePad"); //Console.WriteLine($"Depois {teclado.QuantityOnHand} teclado"); }
public static void Configura(Funq.Container container) { var context = new SampleContext(); var orderService = new OrderService { EventBus = new EventBus(), OrderRepository = new Repository<Order, SampleContext>(context), EventStoreRepository = new Repository<EventStore, SampleContext>(context), PayOrderRepository = new Repository<PayOrder, SampleContext>(context) }; var orderCommandHandler = new OrderCommandHandler { OrderService = orderService }; var orderEventHandler = new OrderEventHandler { OrderService = orderService }; container.Register<IOrderService>(c => orderService); container.Register<ICommandHandler<BuildOrder>>(c => orderCommandHandler); container.Register<IEventHandler<BuildOrderReady>>(c => orderEventHandler); container.Register<IEventHandler<PaySuccessReady>>(c => orderEventHandler); }
public CommandsTest() { // repositories var productRepository = new ProductFakeRepository(); var customerRepository = new CustomerFakeRepository(); var cuponDisountRepository = new DiscountCuponFakeReaderRepository(); _products = productRepository.Take(10); _customer = customerRepository.GetByDocument(new Document("94763001086")); _creditCardCommand = new CreditCardCommand() { Cvv = 503, Number = "5361004355915434", PrintName = "Nicolas S. dos Santos", Validate = "16/06/2020", }; var orderRepository = new OrderFakeRepository(customerRepository.GetAll(), _products); // mock order _order = orderRepository.GetFirst(); // dependencies var notifications = new DomainNotificationHandler(); var uow = new UnitOfWorkFake(); var bus = new MediatorHandlerFake(notifications); // tests global dependencies _customerRepository = customerRepository; _productRepository = productRepository; _orderRepository = orderRepository; _cuponDisountRepository = cuponDisountRepository; // domain services var discountCuponDomainService = new DiscountCuponDomainService(bus, _cuponDisountRepository); _commandHanddler = new OrderCommandHandler( discountCuponDomainService, _orderRepository, _productRepository, _customerRepository, uow, bus, notifications); }
private CommandDispatcher CreateCommandDispatcher(IDomainRepository domainRepository, IEnumerable <Action <ICommand> > preExecutionPipe, IEnumerable <Action <object> > postExecutionPipe) { var commandDispatcher = new CommandDispatcher(domainRepository, preExecutionPipe, postExecutionPipe); var customerCommandHandler = new CustomerCommandHandler(domainRepository); commandDispatcher.RegisterHandler(customerCommandHandler); var productCommandHandler = new ProductCommandHandler(domainRepository); commandDispatcher.RegisterHandler(productCommandHandler); var orderCommandHandler = new OrderCommandHandler(domainRepository); commandDispatcher.RegisterHandler(orderCommandHandler); return(commandDispatcher); }
public OrderAppService(OrderCommandHandler orderCommandHandler) { _orderCommandHandler = orderCommandHandler; }
public OrderController(IOrderRepository orderRepository, OrderCommandHandler handler) { _handler = handler; _orderRepository = orderRepository; }
public OrderController(IUow uow, OrderCommandHandler handler) : base(uow) { _handler = handler; }
public StroopwafelController(QuotesQueryHandler quotesQueryHandler, OrderCommandHandler orderCommandHandler) { _quotesQueryHandler = quotesQueryHandler; _orderCommandHandler = orderCommandHandler; }
public CheckoutService( OrderCommandHandler orderCommandHandler) { _orderCommandHandler = orderCommandHandler; }
public OrderController(IUow uow, OrderCommandHandler commandHandler) : base(uow) { _uow = uow; _commandHandler = commandHandler; }
public OrderController(OrderCommandHandler orderCommandHandler, OrderQueryHandler orderQueryHandler) { this.orderQueryHandler = orderQueryHandler; this.orderCommandHandler = orderCommandHandler; }
public OrderController(IUow uow, OrderCommandHandler handler) : base(uow) //send my uow to BaseController { _uow = uow; _handler = handler; }