private static void ReversePendingAuthorizationTransaction(ICRMCoreService cRMCoreAccountService) { cRMCoreAccountService.ReverseAuthorization(Arg.Is <ReverseAuthorizationRequest>(p => p.AuthorizedTransactionKey == 1)) .Returns(Task.Run(() => { })); cRMCoreAccountService.When( m => m.ReverseAuthorization(Arg.Is <ReverseAuthorizationRequest>(p => p.AuthorizedTransactionKey == 2))) .Do( x => { throw new GdErrorException( "Error while executing ReverseAuthorization AuthorizedTransactionKey == 2"); }); cRMCoreAccountService.When( m => m.ReverseAuthorization(Arg.Is <ReverseAuthorizationRequest>(p => p.AuthorizedTransactionKey == 3))) .Do( x => { throw new ArgumentException(); }); }