static void Main(string[] args) { new EventStoreConfiguration() .ConfigureTransport <EventStoreTransportConnectionString>() .ConfigureSubscriptions( InventoryItemStockHandler.Subscriptions().PublisherBySubscription.Keys.AsEnumerable(), RefundProductOrderHandler.Subscriptions().PublisherBySubscription.Keys.AsEnumerable()); var uri = new Uri("http://localhost:3785"); using (var host = new NancyHost( uri, new DefaultNancyBootstrapper(), new HostConfiguration { UrlReservations = new UrlReservations() { CreateAutomatically = true } })) { host.Start(); Console.WriteLine("Your application is running on " + uri); Console.WriteLine("Press any [Enter] to close the Api Host."); Console.ReadLine(); } }
public CannotRefundWhenCustomerIsFraud() { _notificationsByPublisher = RefundProductOrderHandler .Subscriptions() .PublisherBySubscription .Given ( new CustomerMarkedAsFraud { CustomerId = "customers/1" }, new ProductOnSale { ProductId = "skus/1", PolicyId = "policy/1", WhenSaleExpires = DateTimeOffset.Now.AddDays(10) }, new PolicyInPlace { PolicyId = "policy/1", RefundsAllowed = true, CoolingOffPeriodInDays = 10 }, new OrderPlaced { OrderId = "orders/1", ProductId = "skus/1", CustomerId = "customers/1", When = DateTimeOffset.Now.AddDays(-3) } ) .Notify(new Placed <RefundProductOrder> { Command = new RefundProductOrder { OrderId = "orders/1" }, When = DateTimeOffset.Now.AddDays(-1) }); }
public CannotRefundWhenCannotFindPolicy() { _notificationsByPublisher = RefundProductOrderHandler .Subscriptions() .PublisherBySubscription .Given ( new ProductOnSale { PolicyId = "policy/1", ProductId = "skus/1", WhenSaleExpires = DateTimeOffset.Now.AddDays(10) }, new OrderPlaced { OrderId = "orders/1", ProductId = "skus/1", CustomerId = "customers/1" } ) .Notify(new Placed <RefundProductOrder> { Command = new RefundProductOrder { OrderId = "orders/1" } }); }
public CannotRefundWhenCannotFindProductOnSale() { _notificationsByPublisher = RefundProductOrderHandler .Subscriptions() .PublisherBySubscription .Given ( new PolicyInPlace { PolicyId = "policy/1", RefundsAllowed = true, CoolingOffPeriodInDays = 10 }, new OrderPlaced { OrderId = "orders/1", ProductId = "skus/1", CustomerId = "customers/1" } ) .Notify(new Placed <RefundProductOrder> { Command = new RefundProductOrder { OrderId = "orders/1" } }); }