Пример #1
0
        public void Test_MoneyHelper_4()
        {
            // need to be able to use DI to work with this object

            DMPFeeService service = new DMPFeeService();

            DMPFeeRequestViewModel req = new DMPFeeRequestViewModel()
            {
                CustomerFirstname = "Cam",
                CustomerSurname   = "Braidwood",
                CustomerDebtManagementCompanyId = DebtServiceProviderEnumerator.MoneyHelper.ToString(),
                Income           = 1000,
                Expenses         = 800,
                Debt1Desctiption = "loan",
                Debt1Value       = 1000,
                Debt2Desctiption = "loan 2",
                Debt2Value       = 1000
            };

            DMPFeeResultModel result = service.Calculate(req);

            Assert.AreEqual(result.OK, true);
            Assert.AreEqual(result.DMPResponse.Fee, 20);
            Assert.AreEqual(result.DMPResponse.DebtRepaymentList.Count, 2);
            Assert.AreEqual(result.DMPResponse.DebtRepaymentList[0].DebtMonthlyRepayment, 90m);
            Assert.AreEqual(result.DMPResponse.DebtRepaymentList[1].DebtMonthlyRepayment, 90m);
        }
        public void Test_DebtDestructor_5()
        {
            DMPFeeService service = new DMPFeeService();
            //IDMPFeeService service = ObjectFactory.GetInstance<IDMPFeeService>();

            //HomeController c = new HomeController(service);

            DMPFeeRequestViewModel req = new DMPFeeRequestViewModel()
            {
                CustomerFirstname = "Cam",
                CustomerSurname   = "Braidwood",
                CustomerDebtManagementCompanyId = DebtServiceProviderEnumerator.DebtDestructor.ToString(),
                Income           = 1000,
                Expenses         = 810,
                Debt1Desctiption = "loan",
                Debt1Value       = 1000,
                Debt2Desctiption = "loan 2",
                Debt2Value       = 1000
            };

            DMPFeeResultModel result = service.Calculate(req);

            Assert.AreEqual(result.OK, true);
            Assert.AreEqual(result.DMPResponse.Fee, 30);
            Assert.AreEqual(result.DMPResponse.DebtRepaymentList.Count, 2);
            Assert.AreEqual(result.DMPResponse.DebtRepaymentList[0].DebtMonthlyRepayment, 80);
            Assert.AreEqual(result.DMPResponse.DebtRepaymentList[1].DebtMonthlyRepayment, 80);
        }
Пример #3
0
        public ActionResult Index(DMPFeeRequestViewModel data)
        {
            DMPFeeResultModel result = this.DMPFeeService.Calculate(data);

            if (result.OK)
            {
                return(View("Summary", result.DMPResponse));
            }
            else
            {
                base.ProcessModelStateErrors(ModelState, result.ErrorDetailList);

                return(View(data));
            }
        }
Пример #4
0
        public DMPFeeResultModel Calculate(DMPFeeRequestViewModel req)
        {
            DMPFeeResultModel result = new DMPFeeResultModel();

            DMPFeeResponseViewModel feeResponse = null;

            DebtServiceProviderEnumerator debtProvider = (DebtServiceProviderEnumerator)Enum.Parse(typeof(DebtServiceProviderEnumerator), req.CustomerDebtManagementCompanyId);

            switch (debtProvider)
            {
            case DebtServiceProviderEnumerator.McDermottGodfrey:

                feeResponse = new McDermottGodfreyDMPServiceProvider(req).Calculate();

                break;

            case DebtServiceProviderEnumerator.DebtDestructor:

                feeResponse = new DebtDestructorDMPServiceProvider(req).Calculate();

                break;

            case DebtServiceProviderEnumerator.MoneyHelper:

                feeResponse = new MoneyHelperDMPServiceProvider(req).Calculate();

                break;

            default:
                break;
            }

            if (feeResponse.IsNotNull())
            {
                feeResponse.Request = req;        // original request

                result.DMPResponse = feeResponse; // provider response

                result.OK = true;
            }

            return(result);
        }
        public void Test_McDermottGodfrey_2()
        {
            // need to be able to use DI to work with this object

            DMPFeeService service = new DMPFeeService();

            DMPFeeRequestViewModel req = new DMPFeeRequestViewModel()
            {
                CustomerFirstname = "Cam",
                CustomerSurname   = "Braidwood",
                CustomerDebtManagementCompanyId = DebtServiceProviderEnumerator.McDermottGodfrey.ToString(),
                Income           = 1000,
                Expenses         = 1300,
                Debt1Desctiption = "loan",
                Debt1Value       = 5000
            };

            DMPFeeResultModel result = service.Calculate(req);

            Assert.AreEqual(result.OK, true);
            Assert.AreEqual(result.DMPResponse.Fee, 0);
        }