public void AccountantGetTotalCostPerDistrictTest_CheckTotal_OnSuccessChangeRefValue() { Decimal districtsTotal = 0; Intervention intervention1 = new Intervention { District = "Urban Indonesia", State = State.Complete, Cost = 12000 }; Intervention intervention2 = new Intervention { District = "Urban Papua New Guinea", State = State.Complete, Cost = 15000 }; Intervention intervention3 = new Intervention { District = "Sydney", State = State.Complete, Cost = 16000 }; clientInterventionDummyData.Add(intervention1); clientInterventionDummyData.Add(intervention2); clientInterventionDummyData.Add(intervention3); AccountantReportMaker testReportMaker1 = new AccountantReportMaker(); testReportMaker1.GetTotalCostForDistricts(clientInterventionDummyData, ref districtsTotal); Assert.AreEqual(43000, districtsTotal); }
public void AccountantGetTotalCostPerDistrictTest_WithThreeDistrict_OnSuccesReturnDistrictNCost() { Decimal dummy = 0; Intervention intervention1 = new Intervention { District = "Urban Indonesia", State = State.Complete, Cost = 12000 }; Intervention intervention2 = new Intervention { District = "Urban Indonesia", State = State.Complete, Cost = 15000 }; Intervention intervention3 = new Intervention { District = "Urban Indonesia", State = State.Complete, Cost = 16000 }; clientInterventionDummyData.Add(intervention1); clientInterventionDummyData.Add(intervention2); clientInterventionDummyData.Add(intervention3); AccountantReportMaker testReportMaker1 = new AccountantReportMaker(); DataTable testValues = testReportMaker1.GetTotalCostForDistricts(clientInterventionDummyData, ref dummy); Assert.AreEqual("Urban Indonesia", testValues.Rows[0][0]); Assert.AreEqual("43000", testValues.Rows[0][1]); }
protected void GetReport_Click(object sender, EventArgs e) { Decimal totalCost = 0; AccountantReportMaker accInstance = new AccountantReportMaker(); InterventionRepository accDataBank = new InterventionRepository(); List <Intervention> accData = accDataBank.GetListAcc(); DataTable reportTableData = accInstance.GetTotalCostForDistricts(accData, ref totalCost); for (int i = 0; i < reportTableData.Rows.Count; i++) { TableRow t1 = new TableRow(); TableCell c1 = new TableCell(); TableCell c2 = new TableCell(); c1.Text = reportTableData.Rows[i][0].ToString(); c2.Text = reportTableData.Rows[i][1].ToString(); t1.Cells.Add(c1); t1.Cells.Add(c2); ReportOut.Rows.Add(t1); } TotalCostOut.Text = "Total Cost:" + (totalCost.ToString()); }
public void AccountantGetTotalCostPerDistrictTest_CheckNotCompletedExcluded_OnSuccesReturnDistrictNCost() { Decimal dummy = 0; Intervention intervention1 = new Intervention { District = "Urban Indonesia", State = State.Complete, Cost = 12000 }; Intervention intervention2 = new Intervention { District = "Urban Papua New Guinea", State = State.Approved, Cost = 15000 }; Intervention intervention3 = new Intervention { District = "Sydney", State = State.Complete, Cost = 16000 }; clientInterventionDummyData.Add(intervention1); clientInterventionDummyData.Add(intervention2); clientInterventionDummyData.Add(intervention3); AccountantReportMaker testReportMaker1 = new AccountantReportMaker(); DataTable testValues = testReportMaker1.GetTotalCostForDistricts(clientInterventionDummyData, ref dummy); Assert.AreEqual("Urban Indonesia", testValues.Rows[0][0]);; Assert.AreEqual("Sydney", testValues.Rows[1][0]); Assert.AreEqual(2, testValues.Rows.Count); }
public void AccountantGetTotalCostPerDistrictTest_WithThreeDistrictSixEntriees_OnSuccesReturnDistrictNCost() { Decimal dummy = 0; Intervention intervention1 = new Intervention { District = "Urban Indonesia", State = State.Complete, Cost = 12000 }; Intervention intervention2 = new Intervention { District = "Urban Papua New Guinea", State = State.Complete, Cost = 15000 }; Intervention intervention3 = new Intervention { District = "Urban Indonesia", State = State.Complete, Cost = 16000 }; Intervention intervention4 = new Intervention { District = "Sydney", State = State.Complete, Cost = 12000 }; Intervention intervention5 = new Intervention { District = "Urban Papua New Guinea", State = State.Complete, Cost = 13050 }; Intervention intervention6 = new Intervention { District = "Urban Indonesia", State = State.Complete, Cost = 2000 }; clientInterventionDummyData.Add(intervention1); clientInterventionDummyData.Add(intervention2); clientInterventionDummyData.Add(intervention3); clientInterventionDummyData.Add(intervention4); clientInterventionDummyData.Add(intervention5); clientInterventionDummyData.Add(intervention6); AccountantReportMaker testReportMaker1 = new AccountantReportMaker(); DataTable testValues = testReportMaker1.GetTotalCostForDistricts(clientInterventionDummyData, ref dummy); Assert.AreEqual("Urban Indonesia", testValues.Rows[0][0]); Assert.AreEqual("30000", testValues.Rows[0][1]); Assert.AreEqual("Urban Papua New Guinea", testValues.Rows[1][0]); Assert.AreEqual("28050", testValues.Rows[1][1]); Assert.AreEqual("Sydney", testValues.Rows[2][0]); Assert.AreEqual("12000", testValues.Rows[2][1]); }