public void AccountantTotalCostPerMonthTest_CheckCorrectOutput_ThreeInterventions() { Intervention intervention1 = new Intervention { District = "Urban Indonesia", State = State.Complete, DateToPerform = "12/04/2018", Cost = 12000 }; Intervention intervention2 = new Intervention { District = "Urban Indonesia", State = State.Complete, DateToPerform = "06/04/2018", Cost = 15000 }; Intervention intervention3 = new Intervention { District = "Sydney", DateToPerform = "03/03/2018", State = State.Complete, Cost = 16000 }; InterventionDummyData.Add(intervention1); InterventionDummyData.Add(intervention2); InterventionDummyData.Add(intervention3); AccountantReportMaker testReportMaker1 = new AccountantReportMaker(); DataTable testResult = testReportMaker1.GetTotalCostForEachMonth(InterventionDummyData); Assert.AreEqual("4", testResult.Rows[0][0]); Assert.AreEqual("2018", testResult.Rows[0][1]); Assert.AreEqual("27000", testResult.Rows[0][2]); Assert.AreEqual("3", testResult.Rows[1][0]); Assert.AreEqual("2018", testResult.Rows[1][1]); Assert.AreEqual("16000", testResult.Rows[1][2]); }
protected void GetTotalCostByMonth_Click(object sender, EventArgs e) { AccountantReportMaker accInstance = new AccountantReportMaker(); InterventionRepository accDataBank = new InterventionRepository(); List <Intervention> accData = accDataBank.GetListAcc(); DataTable reportTableData = accInstance.GetTotalCostForEachMonth(accData); for (int i = 0; i < reportTableData.Rows.Count; i++) { TableRow t1 = new TableRow(); TableCell c1 = new TableCell(); TableCell c2 = new TableCell(); TableCell c3 = new TableCell(); c1.Text = reportTableData.Rows[i][0].ToString(); c2.Text = reportTableData.Rows[i][1].ToString(); c3.Text = reportTableData.Rows[i][2].ToString(); t1.Cells.Add(c1); t1.Cells.Add(c2); t1.Cells.Add(c3); ReportOut.Rows.Add(t1); } }