public void Then_the_claim_is_rejected_when_no_verification_is_received_within_the_timeout() { var timer = Stopwatch.StartNew(); var controller = new ClaimRequestTestCoordinator(LocalBus, 1000); using (LocalBus.SubscribeInstance(controller).Disposable()) { RemoteBus.ShouldHaveSubscriptionFor <ClaimRequestCreatedPendingVerificationEvent>(); bool complete = controller.CreateClaimRequest(1200, "ClaimType", DateTime.Today.AddDays(-10), "provider", "reason"); Assert.IsTrue(complete, "There should be a timeout scheduled for this claim request."); timer.Stop(); Debug.WriteLine(string.Format("Time to handle message: {0}ms", timer.ElapsedMilliseconds)); complete = controller.Timeout(); Assert.IsTrue(complete, "The claim request timed out but the claim was not rejected."); } }
public void Then_a_new_timeout_is_scheduled_and_cancelled_when_the_claim_is_verified() { var timer = Stopwatch.StartNew(); var controller = new ClaimRequestTestCoordinator(LocalBus, 4000); using (LocalBus.SubscribeInstance(controller).Disposable()) { RemoteBus.ShouldHaveSubscriptionFor <ClaimRequestCreatedPendingVerificationEvent>(); RemoteBus.ShouldHaveSubscriptionFor <CardUseVerifiedEvent>(); bool complete = controller.CreateClaimRequest(1200, "ClaimType", DateTime.Today.AddDays(-10), "provider", "reason"); Assert.IsTrue(complete, "No timeout scheduled message was received for this claim request."); timer.Stop(); Debug.WriteLine(string.Format("Time to handle message: {0}ms", timer.ElapsedMilliseconds)); complete = controller.VerifyCardUse(); Assert.IsTrue(complete, "The timeout should have been cancelled and the saga should be complete."); } }