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 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]);
        }
        protected void GetAverageCostNHours_Click(object sender, EventArgs e)
        {
            AccountantReportMaker  accInstance = new AccountantReportMaker();
            InterventionRepository accDataBank = new InterventionRepository();
            //EngineerCostDummy accDataBank = new EngineerCostDummy();
            List <Intervention> accData = accDataBank.GetListAcc();

            DataTable reportTableData = accInstance.GetAverageCostNHoursPerEngineer(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);
            }
        }