Ejemplo n.º 1
0
        public void AgroforestryReport()
        {
            string reportValue;
            int    scenarioCount = 0;

            foreach (var scenario in xmlReport.AgroforestryReportScenarioList)
            {
                int parcelCount = 0;
                foreach (var report in scenario.AgroforestryReportList)
                {
                    var aValues = new AgroforestryValues();

                    aValues.SetExpected(report);

                    //Select Croplands Tab
                    gMethods.FindAndClick(By.XPath("//div[contains(@id,'reportTabs')]/div/div/div/div[*]/em/button/span[contains(.,'Agroforestry')]"), driver, true);

                    gMethods.AddDelay(2000);

                    // Grabs the values off the report table and compares to expected values
                    for (int i = 0; i < 5; i++)
                    {
                        //reportValue = gMethods.FindValue(By.XPath("//div[contains(@id,'reportTabContainer')]/div/div[2]/div[1]/div/div[3]/div/div[1]/div/table/tbody/tr[" + (parcelCount * 3) + "]/td/table/tbody/tr[" + (i + 2) + "]/td[" + (scenarioCount + 6) + "]/div"), driver);
                        reportValue = gMethods.FindValue(By.XPath("//div[contains(@id,'13_AGRO-body')]/div/div/div/div/table/tbody/tr[3]/td/table/tbody/tr[" + (2 + i) + "]/td[5]/div"), driver);

                        gMethods.AddDelay(300);

                        aValues.SetActual(i, reportValue);
                    }

                    //reportValue = gMethods.FindValue(By.XPath("//div[contains(@id,'reportTabContainer')]/div/div[2]/div[1]/div/div[3]/div/div[1]/div/table/tbody/tr[" + (parcelCount * 3 + 1) + "]/td[" + (scenarioCount + 6) + "]/div"), driver);
                    reportValue = gMethods.FindValue(By.XPath("//div[contains(@id,'13_AGRO-body')]/div/div/div/div/table/tbody/tr[4]/td[5]/div"), driver);

                    aValues.SetActual(5, reportValue);

                    aValues.CalculatePYield();

                    AgroforestryReports.Add(aValues);

                    parcelCount++;
                }
                scenarioCount++;
                if (scenario.Name != "Baseline")
                {
                    scenarioCount++;
                }
            }
        }
Ejemplo n.º 2
0
        public object createAgroForestryReport(AgroforestryValues values)
        {
            var Expected = values.GetExpected();
            var Actual   = values.GetActual();
            var PYield   = values.GetPYield();

            var aReport = new
            {
                Live_Trees       = MakeReportObj(Expected[0].ToString(), Actual[0], PYield[0]),
                Downed_Dead_Wood = MakeReportObj(Expected[1].ToString(), Actual[1], PYield[1]),
                Forest_Floor     = MakeReportObj(Expected[2].ToString(), Actual[2], PYield[2]),
                Standing_Trees   = MakeReportObj(Expected[3].ToString(), Actual[3], PYield[3]),
                Understory       = MakeReportObj(Expected[4].ToString(), Actual[4], PYield[4]),
                Total            = MakeReportObj(Expected[5].ToString(), Actual[5], PYield[5]),
            };


            return(aReport);
        }
Ejemplo n.º 3
0
        public void CreateAgroforestryTable(HtmlTextWriter writer, AgroforestryValues values)
        {
            var Expected = values.GetExpected();
            var Actual   = values.GetActual();
            var PYield   = values.GetPYield();


            //Agroforestry Table
            writer.RenderBeginTag("table style='width:100%' border='2' border-collapse: 'collapse'");
            CreateHeaderRow(writer, "Agroforestry", "Expected", "Reported", "Percent Yield");
            CreateNormalRow(writer, "Live Trees", Expected[0].ToString(), Actual[0], PYield[0]);
            CreateNormalRow(writer, "Downed Dead Wood", Expected[1].ToString(), Actual[1], PYield[1]);
            CreateNormalRow(writer, "Forest Floor", Expected[2].ToString(), Actual[2], PYield[2]);
            CreateNormalRow(writer, "Standing Trees", Expected[3].ToString(), Actual[3], PYield[3]);
            CreateNormalRow(writer, "Understory", Expected[4].ToString(), Actual[4], PYield[4]);
            CreateNormalRow(writer, "Total", Expected[5].ToString(), Actual[5], PYield[5]);
            CreateNormalRow(writer, "Site", "", "", MainWindow.getTestLoc());
            writer.RenderEndTag();
            writer.Write("<br>");
        }