public async Task HandleScheduledCommandException(CustomerAccount aggregate, CommandFailed <RequestUserName> command)
 {
     if (command.Exception is ConcurrencyException)
     {
         command.Retry(TimeSpan.Zero);
     }
 }
        public void When_a_retry_is_pending_then_WillBeRetried_returns_true()
        {
            var failed = new CommandFailed(new ScheduledCommand<NonEventSourcedCommandTarget>(new TestCommand(), Any.Guid()));

            failed.Retry();

            failed.WillBeRetried
                  .Should()
                  .BeTrue();
        }
        public void When_a_retry_is_pending_then_WillBeRetried_returns_true()
        {
            var failed = new CommandFailed(new ScheduledCommand <NonEventSourcedCommandTarget>(new TestCommand(), Any.Guid()));

            failed.Retry();

            failed.WillBeRetried
            .Should()
            .BeTrue();
        }
 public async Task HandleScheduledCommandException(Order order, CommandFailed <ChargeCreditCard> command)
 {
     if (command.NumberOfPreviousAttempts < 3)
     {
         command.Retry(after: command.Command.ChargeRetryPeriod);
     }
     else
     {
         order.RecordEvent(new Cancelled
         {
             Reason = "Final credit card charge attempt failed."
         });
     }
 }