public ShipmentServiceProviderStateMiddleware( Func <IDictionary <string, object>, Task> next, ShipmentRequestValidatorStub shipmentRequestValidator, ShipmentDispatcher shipmentDispatcher ) { this.next = next; this.shipmentRequestValidator = shipmentRequestValidator; this.shipmentDispatcher = shipmentDispatcher; providerStates = new Dictionary <string, Action> { { "valid shipment data", () => { return; } // TODO: This method does nothing, change it to the correct one }, { "invalid shipment data", () => { return; } // TODO: This method does nothing, change it to the correct one }, { "there is a shipment number 'XX-636446338738089968' not delivered", () => { return; } // TODO: This method does nothing, change it to the correct one } }; }
public void Configuration(IAppBuilder app) { // Create stubs var shipmentRequestValidator = new ShipmentRequestValidatorStub(); var shipmentDispatcher = new ShipmentDispatcher(); // init IoC IUnityContainer container = new UnityContainer(); container.RegisterInstance <IShipmentRequestValidator>(shipmentRequestValidator); container.RegisterInstance <IShipmentDispatcher>(shipmentDispatcher); // init owin middleware - pact's state providers var args = new Object[] { shipmentRequestValidator, shipmentDispatcher }; app.Use <ShipmentServiceProviderStateMiddleware>(args); // owin middleware - this is standard service setup (real provider) var shipmentOwinStartup = new Shipment.Startup(); shipmentOwinStartup.Configuration(app, container); }