public override TaskResult Handle(SendEmailTask cmd) { var timeout = _randomizer.GetRandomTimeout(); Thread.Sleep(timeout); if (_randomizer.IsRandomError()) { throw new Exception($"ERROR sending email to {cmd.To}"); } return(new TaskResult { Log = $"Sent email '{cmd.Subject}' to {cmd.To}", }); }
public override TaskResult Handle(GenerateReportTask cmd) { var timeout = _randomizer.GetRandomTimeout(); Thread.Sleep(timeout); if (_randomizer.IsRandomError()) { throw new Exception($"ERROR generating report for {cmd.User}"); } return(new TaskResult { Log = $"Generated report '{cmd.Title}' for {cmd.User}", }); }