private void SendEmailTrigger(ICRMCoreService cRMCoreAccountService) { cRMCoreAccountService.SendEmail(Arg.Is <SendEmailRequest>(p => p.AccountIdentifier == "18204E5C-C243-4096-8BC2-3A62E49B687C")) .Returns(Task.Run(() => { })); cRMCoreAccountService.When( m => m.SendEmail(Arg.Is <SendEmailRequest>(p => p.AccountIdentifier == "18204E5C-C243-4096-8BC2-3A62E49B687D"))) .Do( x => { throw new GdErrorException( "Error while executing UpdAccountStatusReason"); }); cRMCoreAccountService.When( m => m.SendEmail(Arg.Is <SendEmailRequest>(p => p.AccountIdentifier == "18204E5C-C243-4096-8BC2-3A62E49B687E"))) .Do( x => { throw new ArgumentException(); }); }