public void TestIfRealDisbursmentCurveCorrectlyCalculate() { int forecastDays = 8; DateTime date = new DateTime(2006,1,1); List<KeyValuePair<DateTime, decimal>> list = new List<KeyValuePair<DateTime, decimal>> { new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 1), 100), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 2), 200), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 4), 400), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 6), 1233), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 9), 4876) }; mockContractManagement.SetReturnValue("CalculateCashToDisburseByDay",list); contractManagement = (LoanManager)mockContractManagement.MockInstance; this.graphServices = new GraphServices(contractManagement); double[] disbursmentState = new double[forecastDays]; disbursmentState = this.graphServices.CalculateRealDisbursmentCurve(date,forecastDays); Assert.AreEqual(100,disbursmentState[0]); Assert.AreEqual(300,disbursmentState[1]); Assert.AreEqual(300,disbursmentState[2]); Assert.AreEqual(700,disbursmentState[3]); Assert.AreEqual(700,disbursmentState[4]); Assert.AreEqual(1933,disbursmentState[5]); Assert.AreEqual(1933,disbursmentState[6]); Assert.AreEqual(1933,disbursmentState[7]); }
public void TestIfRealRepayCurveCorrectlyCalculate() { int forecastDays = 10; DateTime date = new DateTime(2006,1,1); List<KeyValuePair<DateTime, decimal>> cashToRepayByDay = new List<KeyValuePair<DateTime, decimal>> { new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 1), 100), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 2), 184), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 4), 3944), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 5), 5978), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 7), 6000), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 8), 6001), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 10), 6876) }; mockContractManagement.SetReturnValue("CalculateCashToRepayByDay",cashToRepayByDay); contractManagement = (LoanManager)mockContractManagement.MockInstance; this.graphServices = new GraphServices(contractManagement); double[] realPrevision = new double[forecastDays]; realPrevision = this.graphServices.CalculateRealRepayCurve(date,forecastDays); Assert.AreEqual(100,realPrevision[0]); Assert.AreEqual(284,realPrevision[1]); Assert.AreEqual(284,realPrevision[2]); Assert.AreEqual(4228,realPrevision[3]); Assert.AreEqual(10206,realPrevision[4]); Assert.AreEqual(10206,realPrevision[5]); Assert.AreEqual(16206,realPrevision[6]); Assert.AreEqual(22207,realPrevision[7]); Assert.AreEqual(22207,realPrevision[8]); Assert.AreEqual(29083,realPrevision[9]); }