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]); }
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 AccountantGetAverageCostHoursPerEngineerTest_TestWithOneEngineerTwoEntries_OnSuccessReturnCorrectNameAndCost() { Intervention intervention2 = new Intervention { ProposedBy = Gary, InterventionId = 3432423, Client = new Client(), InterventionType = new InterventionType(), State = State.Complete, ApprovedBy = new Manager(), Note = "wjdwdiwjadijwaid", Life = 50, MostRecentVisitDate = "12/8/2016", Cost = 7000, LabourHours = 10, DateToPerform = "7/6/2017" }; AccountantReportMaker testReportMaker1 = new AccountantReportMaker(); DataTable testValues = testReportMaker1.GetAverageCostNHoursPerEngineer(interventionsDummyData); Assert.AreEqual("Gary Smith", testValues.Rows[0][0]); Assert.AreEqual("4000", testValues.Rows[0][1]); Assert.AreEqual("8", testValues.Rows[0][2]); }
public void AccountantGetTotalCostPerEngineerTest_TwoInterventions_OnSuccess_ReturnCorrectNameAndCost() { Intervention intervention2 = new Intervention { ProposedBy = Gary, InterventionId = 3432423, Client = new Client(), InterventionType = new InterventionType(), State = State.Complete, ApprovedBy = new Manager(), Note = "wjdwdiwjadijwaid", Life = 50, MostRecentVisitDate = "12/8/2016", Cost = 7000, LabourHours = 10, DateToPerform = "7/6/2017" }; interventionsDummyData.Add(intervention2); AccountantReportMaker testReportMaker1 = new AccountantReportMaker(); DataTable testValues = testReportMaker1.GetTotalCostPerEngineer(interventionsDummyData); string testresult2 = (string)testValues.Rows[0][0]; Assert.AreEqual("Gary Smith", testresult2); Assert.AreEqual("11000", testValues.Rows[0][1]); }
public void AccountantGetTotalCostPerEngineerTest_OneIntervention_OnSucsess_ReturnCorrectNameAndCost() { AccountantReportMaker testReportMaker1 = new AccountantReportMaker(); DataTable testValues = testReportMaker1.GetTotalCostPerEngineer(interventionsDummyData); Assert.AreEqual("Gary Smith", testValues.Rows[0][0]); Assert.AreEqual("4000", testValues.Rows[0][1]); Assert.AreEqual("8", testValues.Rows[0][2]); }
public void AccountantGetTotalCostPerEngineerTest_EnsureOnlyCompletedReturned_OnSuccessReturnCorrectNameAndCost() { Intervention intervention2 = new Intervention { ProposedBy = new SiteEngineer { Name = "Anthony Mctinosh" }, InterventionId = 232367323, Client = new Client(), InterventionType = new InterventionType(), State = State.Approved, ApprovedBy = new Manager(), Note = "wjdwdiwjadijwaid", Life = 50, MostRecentVisitDate = "12/3/2016", Cost = 7000, LabourHours = 10, DateToPerform = "5/2/2017" }; Intervention intervention3 = new Intervention { ProposedBy = new SiteEngineer { Name = "Tam George" }, InterventionId = 3432311, Client = new Client(), InterventionType = new InterventionType(), State = State.Complete, ApprovedBy = new Manager(), Note = "wjdwdiwjadijwaid", Life = 50, MostRecentVisitDate = "12/2/2016", Cost = 14000, LabourHours = 10, DateToPerform = "2/3/2018" }; interventionsDummyData.Add(intervention2); interventionsDummyData.Add(intervention3); AccountantReportMaker testReportMaker1 = new AccountantReportMaker(); DataTable testValues = testReportMaker1.GetTotalCostPerEngineer(interventionsDummyData); Assert.AreNotEqual("Anthony Mctinosh", testValues.Rows[0][0]); Assert.AreNotEqual("7000", testValues.Rows[0][1]); Assert.AreNotEqual("10", testValues.Rows[0][2]); Assert.AreEqual("Gary Smith", testValues.Rows[0][0]); Assert.AreEqual("4000", testValues.Rows[0][1]); Assert.AreEqual("8", testValues.Rows[0][2]); Assert.AreEqual("Tam George", testValues.Rows[1][0]); Assert.AreEqual("14000", testValues.Rows[1][1]); Assert.AreEqual("10", testValues.Rows[1][2]); }
public void AccountantGetAverageCostHoursPerEngineerTest_TestWithThreeEngineer_OnSuccessReturnCorrectNameAndCost() { Intervention intervention2 = new Intervention { ProposedBy = new SiteEngineer { Name = "Tam George" }, InterventionId = 3432423, Client = new Client(), InterventionType = new InterventionType(), State = State.Complete, ApprovedBy = new Manager(), Note = "wjdwdiwjadijwaid", Life = 50, MostRecentVisitDate = "12/8/2016", Cost = 7000, LabourHours = 10, DateToPerform = "7/6/2017" }; Intervention intervention3 = new Intervention { ProposedBy = new SiteEngineer { Name = "Anthony Mctinosh" }, InterventionId = 3672423, Client = new Client(), InterventionType = new InterventionType(), State = State.Complete, ApprovedBy = new Manager(), Note = "wjdwdiwjadijwaid", Life = 50, MostRecentVisitDate = "12/8/2016", Cost = 10000, LabourHours = 18, DateToPerform = "7/6/2019" }; interventionsDummyData.Add(intervention2); interventionsDummyData.Add(intervention3); AccountantReportMaker testReportMaker1 = new AccountantReportMaker(); DataTable testValues = testReportMaker1.GetAverageCostNHoursPerEngineer(interventionsDummyData); Assert.AreEqual("Anthony Mctinosh", testValues.Rows[0][0]); Assert.AreEqual("10000", testValues.Rows[0][1]); Assert.AreEqual("18", testValues.Rows[0][2]); Assert.AreEqual("Gary Smith", testValues.Rows[1][0]); Assert.AreEqual("4000", testValues.Rows[1][1]); Assert.AreEqual("8", testValues.Rows[1][2]); Assert.AreEqual("Tam George", testValues.Rows[2][0]); Assert.AreEqual("7000", testValues.Rows[2][1]); Assert.AreEqual("10", testValues.Rows[2][2]); }
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); } }
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]); }
public void AccountantGetTotalCostPerEngineerTest_SixInterventions_OnSuccess_ReturnCorrectNameAndCost() { Intervention intervention2 = new Intervention { ProposedBy = Gary, InterventionId = 3432423, Client = new Client(), InterventionType = new InterventionType(), State = State.Complete, ApprovedBy = new Manager(), Note = "wjdwdiwjadijwaid", Life = 50, MostRecentVisitDate = "12/8/2016", Cost = 7000, LabourHours = 10, DateToPerform = "7/6/2017" }; Intervention intervention3 = new Intervention { ProposedBy = new SiteEngineer { Name = "Anthony Man" }, InterventionId = 232367323, Client = new Client(), InterventionType = new InterventionType(), State = State.Complete, ApprovedBy = new Manager(), Note = "wjdwdiwjadijwaid", Life = 50, MostRecentVisitDate = "12/3/2016", Cost = 7000, LabourHours = 10, DateToPerform = "5/2/2017" }; Intervention intervention4 = new Intervention { ProposedBy = new SiteEngineer { Name = "Tam George" }, InterventionId = 3432311, Client = new Client(), InterventionType = new InterventionType(), State = State.Complete, ApprovedBy = new Manager(), Note = "wjdwdiwjadijwaid", Life = 50, MostRecentVisitDate = "12/2/2016", Cost = 14000, LabourHours = 10, DateToPerform = "2/3/2018" }; Intervention intervention5 = new Intervention { ProposedBy = new SiteEngineer { Name = "Mcgoo Man" }, InterventionId = 3123811, Client = new Client(), InterventionType = new InterventionType(), State = State.Complete, ApprovedBy = new Manager(), Note = "wjdwdiwjadijwaid", Life = 50, MostRecentVisitDate = "10/2/2016", Cost = 500, LabourHours = 2, DateToPerform = "2/6/2019" }; Intervention intervention6 = new Intervention { ProposedBy = new SiteEngineer { Name = "Tam George" }, InterventionId = 3467811, Client = new Client(), InterventionType = new InterventionType(), State = State.Complete, ApprovedBy = new Manager(), Note = "wjdwdiwjadijwaid", Life = 50, MostRecentVisitDate = "11/2/2016", Cost = 30000, LabourHours = 20, DateToPerform = "2/6/2018" }; interventionsDummyData.Add(intervention2); interventionsDummyData.Add(intervention3); interventionsDummyData.Add(intervention4); interventionsDummyData.Add(intervention5); interventionsDummyData.Add(intervention6); AccountantReportMaker testReportMaker1 = new AccountantReportMaker(); DataTable testValues = testReportMaker1.GetTotalCostPerEngineer(interventionsDummyData); Assert.AreEqual("Anthony Man", testValues.Rows[0][0]); Assert.AreEqual("7000", testValues.Rows[0][1]); Assert.AreEqual("10", testValues.Rows[0][2]); Assert.AreEqual("Gary Smith", testValues.Rows[1][0]); Assert.AreEqual("11000", testValues.Rows[1][1]); Assert.AreEqual("18", testValues.Rows[1][2]); Assert.AreEqual("Mcgoo Man", testValues.Rows[2][0]); Assert.AreEqual("500", testValues.Rows[2][1]); Assert.AreEqual("2", testValues.Rows[2][2]); Assert.AreEqual("Tam George", testValues.Rows[3][0]); Assert.AreEqual("44000", testValues.Rows[3][1]); Assert.AreEqual("30", testValues.Rows[3][2]); }