Ejemplo n.º 1
0
        private void CloseAccount(ICRMCoreService cRMCoreAccountService)
        {
            cRMCoreAccountService
            .CloseAccount(Arg.Is <CareGateway.External.Model.Request.CloseAccountRequest>
                              (p => p.AccountIdentifier == "18204E5C-C243-4096-8BC2-3A62E49B687C"))
            .Returns(new CareGateway.External.Model.Response.CloseAccountResponse()
            {
                ResponseHeader = new ResponseHeader()
                {
                    StatusCode = HttpStatusCode.OK.ToString()
                },
                Account = new Account()
                {
                    AccountId  = new Guid("18204E5C-C243-4096-8BC2-3A62E49B687C"),
                    AccountKey = 1000011,
                    AccountStatusReasonKeys = new int[] { 1, 2 },

                    Balance = new Balance()
                    {
                        Actual    = 100001,
                        Available = 1000001,
                    },
                    Bin        = "Bin1",
                    CreateDate = "2017/01/01",

                    Cure         = "Cure1",
                    CurrencyCode = "CurrencyCode1",
                    DBStage      = Stage.Identified,
                    EventCounter = 10001,
                    Identifier   = "Identifier1",
                    Pod          = "Pod1",
                    ReasonCodes  = new String[] { "01", "001" },
                    Stage        = Stage.Identified,
                    State        = State.Closed,
                    Status       = new AccountStatus()
                    {
                        Kyc  = Status.Pending,
                        Ofac = Status.Success
                    }
                }
            });
            cRMCoreAccountService
            .CloseAccount(Arg.Is <CareGateway.External.Model.Request.CloseAccountRequest>
                              (p => p.AccountIdentifier == "28204E5C-C243-4096-8BC2-3A62E49B687C"))
            .Returns(new CareGateway.External.Model.Response.CloseAccountResponse()
            {
                ResponseHeader = new ResponseHeader()
                {
                    StatusCode = HttpStatusCode.OK.ToString()
                },
                Account = null
            });

            cRMCoreAccountService.When(
                m => m.CloseAccount(Arg.Is <CareGateway.External.Model.Request.CloseAccountRequest>
                                        (p => p.AccountIdentifier == "18204E5C-C243-4096-8BC2-3A62E49B687D")))
            .Do(
                x =>
            {
                throw new Exception();
            });

            cRMCoreAccountService.When(
                m => m.CloseAccount(Arg.Is <CareGateway.External.Model.Request.CloseAccountRequest>
                                        (p => p.AccountIdentifier == "18204E5C-C243-4096-8BC2-3A62E49B687E")))
            .Do(
                x =>
            {
                throw new GdErrorException(
                    "Error while executing CloseAccount");
            });

            cRMCoreAccountService
            .CloseAccount(Arg.Is <CareGateway.External.Model.Request.CloseAccountRequest>
                              (p => p.AccountIdentifier == "18204E5C-C243-4096-8BC2-3A62E49B687F"))
            .Returns((CareGateway.External.Model.Response.CloseAccountResponse)null);
        }