public void The_Order_Should_Not_Be_Cancelled() { Test.Initialize(); int customerId = 1; int productId = 1; int orderId = 1; CustomerRemorsePolicy.Reset(); Test.Saga <CustomerRemorsePolicy>() .When(s => s.Handle(CreatePlaceOrder(customerId, productId, orderId))) .When(s => s.Timeout(CreateOrderTimeOut(orderId))) .ExpectNotPublish <OrderCancelled>(s => s.OrderId == orderId) .When(s => s.Handle(CreateCancelOrder(orderId))); }
public void A_Customer_Remorse_Timeout_Should_Be_Set() { Test.Initialize(); int customerId = 1; int productId = 1; int orderId = 1; CustomerRemorsePolicy.Reset(); Test.Saga <CustomerRemorsePolicy>() .ExpectTimeoutToBeSetIn <CustomerRemorsedTimedOut>((m, ts) => { return(ts == TimeSpan.FromSeconds(60) && m.OrderId == orderId); }) .When(s => s.Handle(CreatePlaceOrder(customerId, productId, orderId))); }
public void The_Order_Is_Accepted() { Test.Initialize(); int customerId = 1; int productId = 1; int orderId = 1; CustomerRemorsePolicy.Reset(); Test.Saga <CustomerRemorsePolicy>() .When(s => s.Handle(CreatePlaceOrder(customerId, productId, orderId))) .ExpectPublish <OrderAccepted>(s => s.CustomerId == customerId && s.ProductId == productId && s.OrderValue == productId * 1000 && s.OrderId == orderId) .When(s => s.Timeout(CreateOrderTimeOut(orderId))); }
public void The_Order_Should_Be_Preliminary_Accepted_And_Have_IncrementalIds() { Test.Initialize(); int customerId = 1; int productId = 1; CustomerRemorsePolicy.Reset(); int orderId = 1; Test.Saga <CustomerRemorsePolicy>() .ExpectPublish <OrderPreliminaryAccepted>( (e) => e.OrderId == 1 ) .When(s => s.Handle(CreatePlaceOrder(customerId, productId, orderId))) .ExpectPublish <OrderPreliminaryAccepted>( (e) => e.OrderId == 2 ) .When(s => s.Handle(CreatePlaceOrder(customerId, productId, orderId + 1))); }