Example #1
0
        private void GetCloseAccountOptions(ICRMCoreService cRMCoreAccountService)
        {
            cRMCoreAccountService
            .GetCloseAccountOptions(Arg.Is <GetClsAccountOptsRequest>
                                        (p => p.AccountIdentifier == "18204E5C-C243-4096-8BC2-3A62E49B687C"))
            .Returns(new GetClsAccountOptsResponse
            {
                CloseAccountOptions = new List <string> {
                    "Spend Down", "Refund"
                }
            });

            cRMCoreAccountService.When(m => m.GetCloseAccountOptions(Arg.Is <GetClsAccountOptsRequest>
                                                                         (p => p.AccountIdentifier == "18204E5C-C243-4096-8BC2-3A62E49B687D")))
            .Do(
                x =>
            {
                throw new ArgumentException();
            });

            cRMCoreAccountService.When(m => m.GetCloseAccountOptions(Arg.Is <GetClsAccountOptsRequest>
                                                                         (p => p.AccountIdentifier == "18204E5C-C243-4096-8BC2-3A62E49B687E")))
            .Do(
                x =>
            {
                throw new GdErrorException(
                    "Error while executing GetAccountStatusReason");
            });

            cRMCoreAccountService
            .GetCloseAccountOptions(Arg.Is <GetClsAccountOptsRequest>
                                        (p => p.AccountIdentifier == "18204E5C-C243-4096-8BC2-3A62E49B687F"))
            .Returns((GetClsAccountOptsResponse)null);
        }