public void should_create_and_save_order_aggregate() { var customerId = Guid.NewGuid(); var senderId = Guid.NewGuid(); var agg = new OrderAggregate(); var repository = new Mock <IRepository>(); var eventsDispatcher = new Mock <IEventDispatcher>(); repository.Setup(r => r.Get <OrderAggregate>(It.IsAny <Guid>())).Returns(agg); var sut = new OrderApplicationService(repository.Object, eventsDispatcher.Object); sut.When(new CreateOrder { CustomerId = customerId, SenderId = senderId }); repository.Verify(x => x.Save(It.IsAny <OrderAggregate>()), Times.Once); }
public void Run(UpdateOrderCommand command) { _service.When(command); }
public Guid When([FromBody] CreateOrder cmd) { var orderId = appService.When(cmd); return(orderId); }