//Created July 2016, refactored by Chien Si Harriman.  The tolerance checks are based on percentage tolerances, not absolute.
        public static bool TestSpaceVolumes(List<XmlDocument> gbXMLDocs, List<XmlNamespaceManager> gbXMLnsm, ref CampusReport cr, Conversions.volumeUnitEnum standardUnits, Conversions.volumeUnitEnum testUnits, double testvolConversion, double standardvolConversion, DOEgbXMLTestDetail testDetails, double tolerance)
        {

            string spaceId = String.Empty;
            Dictionary<string, double> standardFileVolumeDict = new Dictionary<string, double>();
            Dictionary<string, double> testFileVolumeDict = new Dictionary<string, double>();
            bool thinWalled = false;
            try
            {
                //check to see if the test file comes from OpenStudio or Bentley (non-thick wall, or non-centerline geometry)
                XmlNamespaceManager gbXMLnstw = gbXMLnsm[0];
                XmlNode productName = gbXMLDocs[0].SelectSingleNode("/gbXMLv5:gbXML/gbXMLv5:DocumentHistory/gbXMLv5:ProgramInfo/gbXMLv5:ProductName", gbXMLnstw);
                if (productName.InnerText.ToLower().Replace(" ", String.Empty).Trim() == "openstudio") //TODO: consider a different test
                {
                    thinWalled = true;
                }
                for (int i = 0; i < gbXMLDocs.Count; i++)
                {
                    XmlDocument gbXMLTestFile = gbXMLDocs[i];
                    XmlNamespaceManager gbXMLns = gbXMLnsm[i];

                    XmlNodeList spaceNodes = gbXMLDocs[i].SelectNodes("/gbXMLv5:gbXML/gbXMLv5:Campus/gbXMLv5:Building/gbXMLv5:Space/gbXMLv5:Volume", gbXMLnsm[i]);
                    //make lists of the areas in each project
                    foreach (XmlNode spaceNode in spaceNodes)
                    {
                        string volume = spaceNode.InnerText;
                        if (i % 2 != 0)
                        {
                            for (int n = 0; n < spaceNode.ParentNode.Attributes.Count; n++)
                            {
                                if (spaceNode.ParentNode.Attributes[n].Name == "id")
                                {
                                    spaceId = spaceNode.ParentNode.Attributes[n].Value;
                                    if (!thinWalled)
                                    {
                                        //no conversion necessary
                                        standardFileVolumeDict.Add(spaceId, (Convert.ToDouble(volume) * standardvolConversion));
                                    }
                                    else
                                    {
                                        if(testDetails.ThinWalledSpecs.Count > 0)
                                        {
                                            var twSpec = testDetails.ThinWalledSpecs.Find(x => x.SpaceName == spaceId);
                                            standardFileVolumeDict.Add(spaceId, twSpec.Volume);
                                            break;
                                        }
                                        else
                                        {
                                            //no conversion necessary
                                            standardFileVolumeDict.Add(spaceId, (Convert.ToDouble(volume) * standardvolConversion));
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            for (int n = 0; n < spaceNode.ParentNode.Attributes.Count; n++)
                            {
                                if (spaceNode.ParentNode.Attributes[n].Name == "id")
                                {
                                    spaceId = spaceNode.ParentNode.Attributes[n].Value;
                                    double convertedValue = Convert.ToDouble(volume) * testvolConversion;
                                    testFileVolumeDict.Add(spaceId, convertedValue);
                                    break;
                                }
                            }
                        }
                    }
                }
                var standardKeys = standardFileVolumeDict.Keys;
                foreach (string key in standardKeys)
                {
                    logger.Info("SPACE ID:" + key);
                    //important, we don't make a new report unless one has already been created
                    DetailedSpaceSummary ds = new DetailedSpaceSummary();
                    if (cr.SpacesReport.Count() != 0) { 
                        var result = cr.SpacesReport.Find(x => x.ID == key);
                        if (result == null)
                        {
                            ds.ID = key;
                        }
                        else
                        {
                            ds = cr.SpacesReport.Find(x => x.ID == key);
                        }
                    }
                    else
                    {
                        ds.ID = key;
                    }
                    ds.VolumeUnits = "Cubic Feet";
                    if (testFileVolumeDict.ContainsKey(key))
                    {
                        double standardFileVolume = standardFileVolumeDict[key];
                        double testFileVolume = testFileVolumeDict[key];
                        ds.TotalVolume = standardFileVolume;
                        ds.TotalTestVolume = testFileVolume;
                        

                        double pctdifference = Math.Abs(testFileVolume - standardFileVolume)/standardFileVolume;
                        if (pctdifference == 0)
                        {
                            logger.Info("TEST FILE SUCCESS:PERFECT : " + key + ".  Success finding matching space volume.");
                            ds.FoundMatch = true;
                        }
                        else if (pctdifference <= tolerance)
                        {
                            logger.Info("TEST FILE SUCCESS: " + key + ".  Success finding matching space volume.");
                            ds.FoundMatch = true;
                        }
                        else
                        {
                            //at the point of failure, the test will return with details about which volume failed.
                            logger.Info("TEST FILE FAILURE: " + key + ".  Failure to find a volume match.");
                            ds.FoundMatch = false;
                            return false;
                        }
                    }
                    else
                    {
                        logger.Info("TEST FILE FAILURE: " + key + ".  Failure to find a volume match.");
                        //at the point of failure, the test will return with details about which volume failed.
                        logger.Info("PROGRAMMER's NOTE: Test File and Standard File space names could not be matched.  SpaceId: " + key + " could not be found in the test file.");
                        ds.FoundMatch = false;
                    }
                }
                var failures = cr.SpacesReport.FindAll(x => x.FoundMatch == false);
                return (failures.Count > 0) ? false : true;
            }

            catch (Exception e)
            {
                logger.Debug(e.ToString());
                logger.Fatal(" Failed to complete the Spaces Volume Test.  See exceptions noted.");
                return false;
            }
            logger.Fatal("Fatal Spaces Volume Test Failure");
            return false;
        }
        public void StartTest(XmlReader xmldoc, string testToRun, ref gbXMLReport gbr, string username = "******")
        {
            
            log4net.Config.XmlConfigurator.Configure();

            TestToRun = testToRun;
            globalMatchObject = new gbXMLMatches();
            globalMatchObject.Init();

            //first create a list of lists that is indexed identically to the drop down list the user selects
            TestDetail = new DOEgbXMLTestDetail();
            //then populate the list of lists.  All indexing is done "by hand" in InitializeTestResultStrings()
            TestDetail.InitializeTestResultStrings();

            //create report list reportlist will store all the test result
            ReportList = new List<DOEgbXMLReportingObj>();

            //Load an XML File for the test at hand
            gbXMLTestFile = new XmlDocument();
            gbXMLTestFile.Load(xmldoc);

            gbXMLStandardFile = new XmlDocument();
            gbXMLStandardFile.Load(filepaths[TestToRun]);
            
            
            if (!TestFileIsAvailable())
            {
                //TODO:  update browser json with something to indicate there is a problem
                return;
            }
                

            //Define the namespace
            XmlNamespaceManager gbXMLns1 = new XmlNamespaceManager(gbXMLTestFile.NameTable);
            gbXMLns1.AddNamespace("gbXMLv5", "http://www.gbxml.org/schema");
            XmlNamespaceManager gbXMLns2 = new XmlNamespaceManager(gbXMLStandardFile.NameTable);
            gbXMLns2.AddNamespace("gbXMLv5", "http://www.gbxml.org/schema");

            List<XmlDocument> gbXMLdocs = new List<XmlDocument>();
            gbXMLdocs.Add(gbXMLTestFile);
            gbXMLdocs.Add(gbXMLStandardFile);
            List<XmlNamespaceManager> gbXMLnsm = new List<XmlNamespaceManager>();
            gbXMLnsm.Add(gbXMLns1);
            gbXMLnsm.Add(gbXMLns2);
            
            //standardizing all tests on US-IP
            Conversions c = new Conversions();
            Conversions.volumeUnitEnum testVol = Conversions.volumeUnitEnum.CubicFeet;
            Conversions.volumeUnitEnum validatorVol = Conversions.volumeUnitEnum.CubicFeet;
            Conversions.areaUnitEnum testArea = Conversions.areaUnitEnum.SquareFeet;
            Conversions.areaUnitEnum validatorArea = Conversions.areaUnitEnum.SquareFeet;
            Conversions.lengthUnitEnum testLength = Conversions.lengthUnitEnum.Feet;
            Conversions.lengthUnitEnum validatorLength = Conversions.lengthUnitEnum.Feet;

            Conversions.lengthUnitEnum standardLength = Conversions.lengthUnitEnum.Feet;
            Conversions.areaUnitEnum standardArea = Conversions.areaUnitEnum.SquareFeet;
            Conversions.volumeUnitEnum standardVol = Conversions.volumeUnitEnum.CubicFeet;

            //standardize all units to feet, square feet, and cubic feet
            double testlengthConversion = 1;
            double testareaConversion = 1;
            double testvolumeConversion = 1;
            double standardlengthConversion = 1;
            double standardareaConversion = 1;
            double standardvolConversion = 1;

            bool mustBePlanar = false;

            for(int ns=0; ns< gbXMLnsm.Count; ns++)
            {
                if (ns == 0)
                {
                    XmlNodeList nodes = gbXMLdocs[ns].SelectNodes("/gbXMLv5:gbXML", gbXMLnsm[ns]);
                    StandardizeToUSIP(nodes, c, ref testlengthConversion, ref testareaConversion, ref testvolumeConversion, ref testLength, ref testArea, ref testVol);
                }
                else
                {
                    XmlNodeList nodes = gbXMLdocs[ns].SelectNodes("/gbXMLv5:gbXML", gbXMLnsm[ns]);
                    StandardizeToUSIP(nodes, c, ref standardlengthConversion, ref standardareaConversion, ref standardvolConversion, ref standardLength, ref standardArea, ref standardVol);
                }
            }
            
           //TODO:  Add a summary of the Unit of Measures stuff above to the final result

            //Create a Log file that logs the success or failure of each test.
            //Eventually maybe I want to create a little HTML factory

            output = "";
            log = "";
            table += "<div class='container'>" +
                    "<h3>" + "Test Sections" + "</h3>";
            table += "<table class='table table-bordered'>";
            table += "<tr class='info'>" +
                                   "<td>" + "Test Section Name" + "</td>" +
                                   "<td>" + "Standard Result" + "</td>" +
                                   "<td>" + "Test File Result" + "</td>" +
                                   "<td>" + "Tolerances" + "</td>" +
                                   "<td>" + "Pass/Fail" + "</td>" +
                                   "</tr>";

            string units;
            DOEgbXMLReportingObj report = new DOEgbXMLReportingObj();
            CampusReport camprep = new CampusReport();

            //this string I can manipulate to produce the final test output
            string menujson = JsonConvert.SerializeXmlNode(gbXMLStandardFile);
            //prepare json for view
            menujson = MakeViewJson(menujson);

            gbr.menu = menujson;
            gbr.CampusReport = camprep;

            report.standResult = new List<string>();
            report.testResult = new List<string>();
            report.idList = new List<string>();
            report.MessageList = new List<string>();
            report.TestPassedDict = new Dictionary<string, bool>();

            //Set up the Global Pass/Fail criteria for the test case file
            TestCriteria = new DOEgbXMLTestCriteriaObject();
            TestCriteria.InitializeTestCriteriaWithTestName(testToRun);
            //needed specially for area and volume tests
            DOEgbXMLTestDetail afile = TestDetail.TestDetailList.Find(x => x.testName == TestToRun);

            BuildingSummary bs = new BuildingSummary();
            bs.FileType = "Standard";
            camprep.BuildingSummary.Add(bs);
            BuildingSummary bst = new BuildingSummary();
            bst.FileType = "Test";
            camprep.BuildingSummary.Add(bst);
            //Test 2 execute
            //report.tolerance = DOEgbXMLBasics.Tolerances.AreaTolerance;
            //report.testType = TestType.Building_Area;
            //units = DOEgbXMLBasics.MeasurementUnits.sqft.ToString();
            //report = GetBuildingArea(gbXMLdocs, gbXMLnsm, report, validatorArea, testArea, testareaConversion, standardareaConversion);
            logger.Info("START: BUILDING AREA TEST");
            var baresult = GetBuildingArea(gbXMLdocs, gbXMLnsm, ref camprep, validatorArea, testArea, testareaConversion, standardareaConversion, DOEgbXMLBasics.Tolerances.AreaPercentageTolerance, afile );
            if(!baresult)
            {
                camprep.BuildingSummary.Find(x => x.FileType == "Standard").PassedAllTests = false;
            }
            logger.Info("END: BUILDING AREA TEST");

            //GetBuildingArea(gbXMLdocs,gbXMLnsm,)
            //AddToOutPut("Building Area Test Passed: ", report, true);

            //Test 3 execute
            //report.Clear();
            //report.tolerance = DOEgbXMLBasics.Tolerances.SpaceCountTolerance;
            //report.testType = TestType.Space_Count;
            //units = DOEgbXMLBasics.MeasurementUnits.spaces.ToString();
            //report = GetBuildingSpaceCount(gbXMLdocs, gbXMLnsm, report, units);
            logger.Info("START: BUILDING SPACE COUNT TEST");
            SpacesSummary ssm = new SpacesSummary();
            ssm.FileType = "Standard";
            camprep.SpacesSummary.Add(ssm);
            SpacesSummary ssmt = new SpacesSummary();
            ssmt.FileType = "Test";
            camprep.SpacesSummary.Add(ssmt);
            var spctResult = GetBuildingSpaceCount(gbXMLdocs, gbXMLnsm, "", DOEgbXMLBasics.Tolerances.SpaceCountTolerance, ref camprep);
            if(!spctResult)
            {
                camprep.BuildingSummary.Find(x => x.FileType == "Standard").PassedAllTests = false;
                camprep.SpacesSummary.Find(x => x.FileType == "Standard").PassedAllTests = false;
            }
            logger.Info("END: BUILDING SPACE COUNT TEST");
            //AddToOutPut("Building Space Quantity Count Test Passed: ", report, true);

            // Building Stories Tests....
            ////Test 4 execute
            //report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.LevelCountTolerance;
            //report.testType = TestType.Building_Story_Count;
            //units = DOEgbXMLBasics.MeasurementUnits.levels.ToString();
            //report = GetBuildingStoryCount(gbXMLdocs, gbXMLnsm, report, units);
            logger.Info("START: Building Storey Count Test");
            var blstctresult = GetBuildingStoryCount(gbXMLdocs, gbXMLnsm, ref camprep, DOEgbXMLBasics.Tolerances.LevelCountTolerance);
            if(!blstctresult)
            {
                camprep.BuildingSummary.Find(x => x.FileType == "Standard").PassedAllTests = false;
                //TODO: Need a Building Story Summary Field
            }
            logger.Info("END: Building Storey Count Test");
            //AddToOutPut("Building Story Count Test Passed: ", report, true);


            //Test 5 execute
            //report.Clear();
            //report.tolerance = DOEgbXMLBasics.Tolerances.LevelHeightTolerance;
            //report.testType = TestType.Building_Story_Z_Height;
            //units = DOEgbXMLBasics.MeasurementUnits.ft.ToString();
            report = GetStoryHeights(gbXMLdocs, gbXMLnsm, report, validatorLength, testLength, testlengthConversion, standardlengthConversion);
            logger.Info("START: Building Storey Height Test");
            var storyHeightsres = GetStoryHeights(gbXMLdocs, gbXMLnsm, ref camprep, validatorLength, testLength, testlengthConversion, standardlengthConversion, DOEgbXMLBasics.Tolerances.LevelHeightTolerance);
            if (!storyHeightsres)
            {
                camprep.BuildingSummary.Find(x => x.FileType == "Standard").PassedAllTests = false;
                //TODO: Need a Building Story Summary Field
            }
            logger.Info("END: Building Storey Height Test");
            //AddToOutPut("Building Story Z-Height Test: ", report, true);


            //Test 6 execute
            //report.Clear();
            //report.tolerance = DOEgbXMLBasics.Tolerances.VectorAngleTolerance;
            //report.testType = TestType.Building_Story_PolyLoop_RHR;
            //units = "degrees";
            //report = TestBuildingStoryRHR(gbXMLdocs, gbXMLnsm, report, units);
            logger.Info("START: Building Story Right Hand Rule Test.");
            var blstRHResult = TestBuildingStoryRHR(gbXMLdocs, gbXMLnsm, ref camprep);
            if(!blstRHResult)
            {
                //this method has no bearing on the overall pass or fail tests.
                //camprep.BuildingSummary.Find(x => x.FileType == "Standard").PassedAllTests = false;
                //TODO: Need a Building Story Summary Field
            }
            logger.Info("END: Building Story Right Hand Rule Test.");
            //AddToOutPut("Building Story PolyLoop Right Hand Rule Test Result:", report, true);


            //String spShellGeometrySurfaceNum = TestShellGeomSurfaceNum(gbXMLTestFile, gbXMLns);

            //Space Tests .............................................................
            //Test 7 execute
            //only needs to test the test file
            //report.Clear();
            //report.testType = TestType.SpaceId_Match_Test;
            logger.Info("START: UNIQUE SPACE ID TEST");
            var spaceIDresults = UniqueSpaceIdTest(gbXMLdocs, gbXMLnsm, ref camprep);
            if(!spaceIDresults)
            {
                camprep.SpacesSummary.Find(x => x.FileType == "Standard").PassedAllTests = false;
            }
            logger.Info("END: UNIQUE SPACE ID TEST");
            //AddToOutPut("SpaceId Match Test: ", report, true);

            
            //Test 8 execute
            //report.Clear();
            //report.tolerance = DOEgbXMLBasics.Tolerances.SpaceAreaTolerance;
            //report.testType = TestType.Space_Area;
            //units = DOEgbXMLBasics.MeasurementUnits.sqft.ToString();
            logger.Info("START: SPACE AREAS TEST");
            //report = TestSpaceAreas(gbXMLdocs, gbXMLnsm, report, validatorArea, testArea, testareaConversion,standardareaConversion,afile);
            var result = TestSpaceAreas(gbXMLdocs, gbXMLnsm, ref camprep, validatorArea, testArea, testareaConversion, standardareaConversion, afile, DOEgbXMLBasics.Tolerances.SpaceAreaTolerance);
            if(!result)
            {
                camprep.SpacesSummary.Find(x => x.FileType == "Standard").PassedAllTests = false;
                //gbxml detailed compliance results?
            }
            logger.Info("END: SPACE AREAS TEST");
            //AddToOutPut("Space Areas Test: ", report, true);


            //Test 9 execute
            //report.Clear();
            //report.tolerance = DOEgbXMLBasics.Tolerances.VolumeTolerance;
            //report.testType = TestType.Space_Volume;
            //units = DOEgbXMLBasics.MeasurementUnits.cubicft.ToString();
            logger.Info("START: SPACE VOLUMES TEST");
            //report = TestSpaceVolumes(gbXMLdocs, gbXMLnsm, report, validatorVol, testVol, testvolumeConversion,standardvolConversion,afile);
            var volresult = TestSpaceVolumes(gbXMLdocs, gbXMLnsm, ref camprep, validatorVol, testVol, testvolumeConversion, standardvolConversion, afile, DOEgbXMLBasics.Tolerances.VolumePercentageTolerance);
            logger.Info("END: SPACE VOLUMES TEST");
            if (!volresult)
            {
                camprep.SpacesSummary.Find(x => x.FileType == "Standard").PassedAllTests = false;
                //gbxml detailed compliance results?
            }
            //AddToOutPut("Space Volumes Test: ", report, true);


            //Test 10 Execute
            //report.Clear();
            //report.tolerance = DOEgbXMLBasics.Tolerances.VectorAngleTolerance;
            //report.testType = TestType.Shell_Geom_RHR;
            //units = "degrees";
            //report = TestShellGeomPLRHR(gbXMLdocs, gbXMLnsm, report, units);
            //AddToOutPut("Shell Geometry RHR Test: ",report);

            //Surface Element tests
            //deprecating all counts tests as criteria for passing and failing.  Use this now only to indicate counts in the surfaces summary
            ////Test 11 Execute
            //report.Clear();
            //report.tolerance = DOEgbXMLBasics.Tolerances.SurfaceCountTolerance;
            //report.testType = TestType.Total_Surface_Count;
            //units = "";
            //report = GetSurfaceCount(gbXMLdocs, gbXMLnsm, report, units);
            //AddToOutPut("Surface Count Test Result: ", report, true);


            ////Surface Element tests
            ////Test 12 Execute
            //report.Clear();
            //report.tolerance = DOEgbXMLBasics.Tolerances.ExteriorWallCountTolerance;
            //report.testType = TestType.Exterior_Wall_Surface_Count;
            //units = "";
            SurfaceSummary ss = new SurfaceSummary();
            ss.FileType = "Standard";
            camprep.SurfacesSummary.Add(ss);
            SurfaceSummary sst = new SurfaceSummary();
            sst.FileType = "Test";
            camprep.SurfacesSummary.Add(sst); //initialization of summaries complete
            logger.Info("START: EXTERIOR WALL COUNT");
            //report = GetEWSurfaceCount(gbXMLdocs, gbXMLnsm, report, units);
            var ewctresult = GetEWSurfaceCount(gbXMLdocs, gbXMLnsm, ref camprep);
            logger.Info("END: EXTERIOR WALL COUNT");
            if (!ewctresult)
            {
                //do nothing, it has no consequence for now
                //gbxml detailed compliance results?
            }
            //AddToOutPut("Exterior Wall Surface Count Test Result: ", report, true);

            //report.Clear();
            //report.tolerance = DOEgbXMLBasics.Tolerances.SurfaceCountTolerance;
            //report.testType = TestType.Underground_Surface_Count;
            //units = "";
            //report = GetUGSurfaceCount(gbXMLdocs, gbXMLnsm, report, units);
            logger.Info("START: UNDERGROUND WALL COUNT");
            var ugwctresult = GetUGSurfaceCount(gbXMLdocs, gbXMLnsm, ref camprep);
            if (!ugwctresult)
            {
                //do nothing, it has no consequence for now
                //gbxml detailed compliance results?
            }
            logger.Info("END: UNDERGROUND WALL COUNT");
            //AddToOutPut("Underground Wall Count Test Result: ", report, true);

            logger.Info("START: SLABONGRADE COUNT");
            var sogctresult = GetSOGSurfaceCount(gbXMLdocs, gbXMLnsm, ref camprep);
            if (!sogctresult)
            {
                //do nothing, it has no consequence for now
                //gbxml detailed compliance results?
            }
            logger.Info("END: SLABONGRADE WALL COUNT");

            ////Surface Element tests
            ////Test 13 Execute
            //report.Clear();
            //report.tolerance = DOEgbXMLBasics.Tolerances.InteriorWallCountTolerance;
            //report.testType = TestType.Interior_Wall_Surface_Count;
            //units = "";
            logger.Info("START: INTERIOR WALL COUNT");
            //report = GetIWSurfaceCount(gbXMLdocs, gbXMLnsm, report, units);
            var iwctresult = GetIWSurfaceCount(gbXMLdocs, gbXMLnsm, ref camprep);
            if (!iwctresult)
            {
                //do nothing, it has no consequence for now
                //gbxml detailed compliance results?
            }
            logger.Info("END: INTERIOR WALL COUNT");
            //AddToOutPut("Interior Wall Surface Count Test Result: ", report, true);

            ////Surface Element tests
            ////Test 13 Execute
            //report.Clear();
            //report.tolerance = DOEgbXMLBasics.Tolerances.InteriorFloorCountTolerance;
            //report.testType = TestType.Interior_Floor_Surface_Count;
            //units = "";
            //report = GetIFSurfaceCount(gbXMLdocs, gbXMLnsm, report, units);
            logger.Info("START: INTERIOR FLOOR/CEILING COUNT");
            var ifctresult = GetIFSurfaceCount(gbXMLdocs, gbXMLnsm, ref camprep);
            if (!ifctresult)
            {
                //do nothing, it has no consequence for now
                //gbxml detailed compliance results?
            }
            logger.Info("END: INTERIOR FLOOR/CEILING COUNT");

            //AddToOutPut("Interior Floor Surface Count Test Result: ", report, true);


            ////Surface Element tests
            ////Test 14 Execute
            //report.Clear();
            //report.tolerance = DOEgbXMLBasics.Tolerances.InteriorWallCountTolerance;
            //report.testType = TestType.Roof_Surface_Count;
            //units = "";
            //report = GetRoofSurfaceCount(gbXMLdocs, gbXMLnsm, report, units);
            logger.Info("START: ROOF COUNT");
            var irctresult = GetRoofSurfaceCount(gbXMLdocs, gbXMLnsm, ref camprep);
            if (!irctresult)
            {
                //do nothing, it has no consequence for now
                //gbxml detailed compliance results?
            }
            logger.Info("END: ROOF COUNT");
            //AddToOutPut("Roof Surface Count Test Result: ", report, true);


            ////Surface Element tests
            ////Test 15 Execute
            //report.Clear();
            //report.tolerance = DOEgbXMLBasics.Tolerances.InteriorWallCountTolerance;
            //report.testType = TestType.Shading_Surface_Count;
            //units = "";
            //report = GetShadeSurfaceCount(gbXMLdocs, gbXMLnsm, report, units);
            logger.Info("START: SHADING DEVICE COUNT");
            var shadectresult = GetShadeSurfaceCount(gbXMLdocs, gbXMLnsm, ref camprep);
            if (!shadectresult)
            {
                //do nothing, it has no consequence for now
                //gbxml detailed compliance results?
            }
            //AddToOutPut("Shading Surface Count Test Result: ", report, true);
            logger.Info("END: SHADING DEVICE COUNT");

            ////Test 16 Execute
            //report.Clear();
            //report.tolerance = DOEgbXMLBasics.Tolerances.AirWallCountTolerance;
            //report.testType = TestType.Air_Surface_Count;
            //units = "";
            //report = GetAirSurfaceCount(gbXMLdocs, gbXMLnsm, report, units);
            logger.Info("START: AIR SURFACE COUNT");
            var asctresult = GetAirSurfaceCount(gbXMLdocs, gbXMLnsm, ref camprep);
            if (!asctresult)
            {
                //do nothing, it has no consequence for now
                //gbxml detailed compliance results?
            }
            logger.Info("END: AIR SURFACE COUNT");
            //AddToOutPut("Air Surface Count Test Result: ", report, true);


            #region surface detailed test
            //Jan 31-2012:  We may not want to perform these if the surface counts fail, but for now, we will include these tests
            //Detailed Surface Checks
            //Store Surface Element Information
            List<SurfaceDefinitions> TestSurfaces = new List<SurfaceDefinitions>();
            XmlDocument TestFile = gbXMLdocs[0];
            XmlNamespaceManager TestNSM = gbXMLnsm[0];
            List<SurfaceDefinitions> StandardSurfaces = new List<SurfaceDefinitions>();
            XmlDocument StandardFile = gbXMLdocs[1];
            XmlNamespaceManager StandardNSM = gbXMLnsm[1];
            TestSurfaces = GetFileSurfaceDefs(TestFile, TestNSM);
            StandardSurfaces = GetFileSurfaceDefs(StandardFile, StandardNSM);
            string TestSurfaceTable = " <div class='container'><table class='table table-bordered'>";
            TestSurfaceTable += "<tr class='info'>" +
                                   "<td>" + "Test Section Name" + "</td>" +
                                   "<td>" + "Stand Surface ID" + "</td>" +
                                   "<td>" + "Test Surface ID" + "</td>" +
                                   "<td>" + "Stand Surface Tilt" + "</td>" +
                                   "<td>" + "Test Surface Tilt" + "</td>" +
                                   "<td>" + "Stand Surface Azimuth" + "</td>" +
                                   "<td>" + "Test Surface Azimuth" + "</td>" +
                                    "<td>" + "Stand Surface Height" + "</td>" +
                                   "<td>" + "Test Surface Height" + "</td>" +
                                    "<td>" + "Stand Surface Width" + "</td>" +
                                   "<td>" + "Test Surface Width" + "</td>" +
                                   "<td>" + "Pass/Fail" + "</td>" +
                                   "</tr>";
            //Test Surfaces Planar Test
            //all polyloops must be such that the surface defined by the coordinates is planar
            //report.Clear();
            //report.testType = TestType.Surface_Planar_Test;
            logger.Info("START: SURFACE PLANARITY TEST");
            //report = TestSurfacePlanarTest(TestSurfaces, report);
            var planarityResult = TestSurfacePlanarTest(TestSurfaces,ref camprep);
            if (!planarityResult)
            {
                camprep.SurfacesSummary.Find(x => x.FileType == "Standard").PassedAllTests = false;
                //gbxml detailed compliance results?
            }
            logger.Info("END: SURFACE PLANARITY TEST");

            //if (!report.passOrFail && mustBePlanar)
            //{
            //    AddToOutPut("Test File Planar Surface Check: ", report, true);
            //    report.Clear();
            //}


            //only run detailed surface checks if the surfaces are planar
            if(planarityResult)
            {
                //<For each surface in the Standard File, try to find a match for this surface in the test file>
                //Written Jan 31, 2013 by Chien Si Harriman, Senior Product Manager, Carmel Software Corporation
                //Execute Tests


                //  globalMatchObject.MatchedSurfaceIds = new Dictionary<string, List<string>>();
                int i = 1;

                foreach (SurfaceDefinitions surface in StandardSurfaces)
                {
                    report.Clear();
                    DetailedSurfaceSummary ssSummary = new DetailedSurfaceSummary();
                    //multiple tolerances used
                    report.testType = TestType.Detailed_Surface_Checks;
                    report.subTestIndex = i;
                    if (surface.SurfaceId == "su-zone_5_Srf_7" || surface.SurfaceId == "su-zone_0_Srf_0")
                    {
                        var d = 1;
                    }
                    logger.Info("START: DETAILED SURFACE TEST");
                    GetSurfaceMatches(surface, TestSurfaces, ref ssSummary, validatorLength, testLength, testlengthConversion, standardlengthConversion, validatorArea, testArea, testareaConversion, standardareaConversion);
                    logger.Info("END: DETAILED SURFACE TEST");
                    camprep.SurfacesReport.Add(ssSummary);
                    
                }
            #endregion
                

                


                #region opending detailed test
                //openings detailed tests
                List<OpeningDefinitions> TestOpenings = new List<OpeningDefinitions>();
                XmlDocument testFile = gbXMLdocs[0];
                XmlNamespaceManager testNSM = gbXMLnsm[0];
                List<OpeningDefinitions> StandardOpenings = new List<OpeningDefinitions>();
                XmlDocument standardFile = gbXMLdocs[1];
                XmlNamespaceManager standardNSM = gbXMLnsm[1];
                TestOpenings = GetFileOpeningDefs(TestFile, TestNSM);
                StandardOpenings = GetFileOpeningDefs(StandardFile, StandardNSM);

                string TestOpeningTable = "";
                report.Clear();
                report.testType = TestType.Opening_Planar_Test;
                report = TestOpeningPlanarTest(TestOpenings, report);

                if (!report.passOrFail)
                {
                    AddToOutPut("Test File Planar Opening Check: ", report, true);
                    report.Clear();
                }
                //only run detailed opening checks if the opening are planar
                else
                {
                    TestOpeningTable = "<div class='container'><table class='table table-bordered'>";
                    TestOpeningTable += "<tr class='info'>" +
                                           "<td>" + "Test Section Name" + "</td>" +
                                            "<td>" + "Standard Opening Id" + "</td>" +
                                            "<td>" + "Test Opening Id" + "</td>" +
                                            "<td>" + "Standard Parent Surface Id" + "</td>" +
                                            "<td>" + "Test Parent Surface Id" + "</td>" +
                                            "<td>" + "Standard Parent Azimuth" + "</td>" +
                                            "<td>" + "Test Parent Azimuth" + "</td>" +
                                            "<td>" + "Standard Parent Tilt" + "</td>" +
                                            "<td>" + "Test Parent Tilt" + "</td>" +
                                            "<td>" + "Standard Surface Area" + "</td>" +
                                            "<td>" + "Test Surface Area" + "</td>" +
                                            "<td>" + "Pass/Fail" + "</td>" +
                                           "</tr>";

                    globalMatchObject.MatchedOpeningIds = new Dictionary<string, List<string>>();
                    int j = 1;
                    //if no openings remove the table.
                    if (StandardOpenings.Count < 1)
                        TestOpeningTable = "";
                    //compare the openings
                    foreach (OpeningDefinitions opening in StandardOpenings)
                    {
                        report.Clear();

                        report.testType = TestType.Detailed_Opening_Checks;
                        report.subTestIndex = j;

                        report = GetPossibleOpeningMatches(opening, TestOpenings, report);

                        AddToOutPut("Test 17 for Opening number " + j + " Result: ", report, false);

                        foreach (OpeningDefinitions to in TestOpenings)
                        {
                            if (globalMatchObject.MatchedOpeningIds.ContainsKey(opening.OpeningId))
                            {
                                foreach (string id in globalMatchObject.MatchedOpeningIds[opening.OpeningId])
                                {
                                    if (to.OpeningId == id)
                                    {
                                        if (report.passOrFail)
                                            TestOpeningTable += "<tr class='success'>" +
                                                "<td>" + "<a href='TestDetailPage.aspx?type=" + (int)report.testType + "&subtype=" + report.subTestIndex + "' target='_blank'>" +
                                                "Detailed Opening Checks " + report.subTestIndex + "</a>" + "</td>" +
                                               "<td>" + opening.OpeningId + "</td>" +
                                                "<td>" + to.OpeningId + "</td>" +
                                                "<td>" + opening.ParentSurfaceId + "</td>" +
                                                "<td>" + to.ParentSurfaceId + "</td>" +
                                                "<td>" + String.Format("{0:#,0.00}", opening.ParentAzimuth) + "</td>" +
                                                "<td>" + String.Format("{0:#,0.00}", to.ParentAzimuth) + "</td>" +
                                                "<td>" + String.Format("{0:#,0.00}", opening.ParentTilt) + "</td>" +
                                                "<td>" + String.Format("{0:#,0.00}", to.ParentTilt) + "</td>" +
                                                "<td>" + String.Format("{0:#,0.00}", opening.surfaceArea) + "</td>" +
                                                "<td>" + String.Format("{0:#,0.00}", to.surfaceArea) + "</td>" +
                                                "<td>" + "Pass" + "</td>" +
                                                "</tr>";
                                    }

                                }

                            }
                        }
                        //if didn't find match means it failed the test
                        if (!report.passOrFail)
                            TestOpeningTable += "<tr class='error'>" +
                                              "<td>" + "<a href='TestDetailPage.aspx?type=" + (int)report.testType + "&subtype=" + report.subTestIndex + "' target='_blank'>" +
                                              "Detailed Opening Checks " + report.subTestIndex + "</a>" + "</td>" +
                                              "<td>" + opening.OpeningId + "</td>" +
                                              "<td>" + "---" + "</td>" +
                                                "<td>" + opening.ParentSurfaceId + "</td>" +
                                                "<td>" + "---" + "</td>" +
                                                "<td>" + String.Format("{0:#,0.00}", opening.ParentAzimuth) + "</td>" +
                                                "<td>" + "---" + "</td>" +
                                                 "<td>" + String.Format("{0:#,0.00}", opening.ParentTilt) + "</td>" +
                                                "<td>" + "---" + "</td>" +
                                                 "<td>" + String.Format("{0:#,0.00}", opening.surfaceArea) + "</td>" +
                                                "<td>" + "---" + "</td>" +
                                              "<td>" + "Fail" + "</td>" +
                                              "</tr>";
                        j += 1;

                    }
                }
                TestOpeningTable += "</table></div><br/>";
                #endregion

                //close table
                table += "</table></div><br/>";
                //add TestSurfaceTable
                table += TestSurfaceTable + TestOpeningTable;

                
            }
            //CreateSummaryTable();
            ((FileAppender)LogManager.GetCurrentLoggers()[0].Logger.Repository.GetAppenders()[0]).Close();

        }
        //created July 2016 by Chien Si Harriman, Independent Contractor
        public static bool TestSpaceAreas(List<XmlDocument> gbXMLDocs, List<XmlNamespaceManager> gbXMLnsm, ref CampusReport cr, Conversions.areaUnitEnum standardUnits, Conversions.areaUnitEnum testUnits, double testareaConversion, double standardareaConversion, DOEgbXMLTestDetail testDetails, double tolerance)
        {
            

            string spaceId = "";
            Dictionary<string, double> standardFileAreaDict = new Dictionary<string, double>();
            Dictionary<string, double> testFileAreaDict = new Dictionary<string, double>();
            bool thinWalled = false;
            try
            {
                //check to see if the test file comes from OpenStudio or Bentley (non-thick wall, or non-centerline geometry)
                XmlNamespaceManager gbXMLnstw = gbXMLnsm[0];
                XmlNode productName = gbXMLDocs[0].SelectSingleNode("/gbXMLv5:gbXML/gbXMLv5:DocumentHistory/gbXMLv5:ProgramInfo/gbXMLv5:ProductName", gbXMLnstw);
                if (productName.InnerText.ToLower().Replace(" ", String.Empty).Trim() == "openstudio")//TODO: consider a different test
                {
                    thinWalled = true;
                }
                for (int i = 0; i < gbXMLDocs.Count; i++)
                {
                    XmlDocument gbXMLTestFile = gbXMLDocs[i];
                    XmlNamespaceManager gbXMLns = gbXMLnsm[i];

                    XmlNodeList spaceNodes = gbXMLDocs[i].SelectNodes("/gbXMLv5:gbXML/gbXMLv5:Campus/gbXMLv5:Building/gbXMLv5:Space/gbXMLv5:Area", gbXMLnsm[i]);
                    //make lists of the areas in each project
                    foreach (XmlNode spaceNode in spaceNodes)
                    {
                        string area = spaceNode.InnerText;
                        if (i % 2 != 0)
                        {
                            for (int n = 0; n < spaceNode.ParentNode.Attributes.Count; n++)
                            {
                                if (spaceNode.ParentNode.Attributes[n].Name == "id")
                                {
                                    spaceId = spaceNode.ParentNode.Attributes[n].Value;
                                    if (!thinWalled)
                                    {
                                        //no conversion necessary
                                        standardFileAreaDict.Add(spaceId, Convert.ToDouble(area) * standardareaConversion);
                                    }
                                    else
                                    {
                                        if(testDetails.ThinWalledSpecs.Count > 0)
                                        {
                                            var thinwalleddef = testDetails.ThinWalledSpecs.Find(x => x.SpaceName == spaceId); //it is critical that space names match for these tests.
                                            standardFileAreaDict.Add(spaceId, thinwalleddef.FloorArea);
                                        }
                                        else
                                        {
                                            //no conversion necessary
                                            standardFileAreaDict.Add(spaceId, Convert.ToDouble(area) * standardareaConversion);
                                        }
                                    }
                                    break;
                                }
                            }

                        }
                        else
                        {
                            for (int n = 0; n < spaceNode.ParentNode.Attributes.Count; n++)
                            {
                                if (spaceNode.ParentNode.Attributes[n].Name == "id")
                                {
                                    spaceId = spaceNode.ParentNode.Attributes[n].Value;

                                    double convertedArea = Convert.ToDouble(area) * testareaConversion;
                                    testFileAreaDict.Add(spaceId, convertedArea);
                                    break;
                                }
                            }

                        }
                    }
                }
                var standardKeys = standardFileAreaDict.Keys;

                foreach (string key in standardKeys)
                {
                    logger.Info("SPACE ID: " + key);
                    //important, we don't make a new report unless one has already been created
                    DetailedSpaceSummary ds = new DetailedSpaceSummary();
                    if (cr.SpacesReport.Count() != 0) { 
                        var res = cr.SpacesReport.Find(x => x.ID == key); 
                        if(res == null)
                        {
                            ds.ID = key;
                        }
                        else
                        {
                            ds = cr.SpacesReport.Find(x => x.ID == key);
                        }
                    }
                    else
                    {
                        ds.ID = key;
                    }
                    ds.AreaUnits = "SquareFeet";
                    if (testFileAreaDict.ContainsKey(key))
                    {
                        double testFileSpaceArea = testFileAreaDict[key];
                        double standardFileSpaceArea = standardFileAreaDict[key];
                        ds.TotalSurfaceArea = standardFileSpaceArea;
                        ds.TotalTestSurfaceArea = testFileSpaceArea;

                        double difference = Math.Abs(testFileSpaceArea - standardFileSpaceArea);
                        if (difference == 0)
                        {
                            logger.Info("TEST FILE SUCCESS:PERFECT : Found matching space area with an area = " + testFileSpaceArea.ToString("#.000") +" "+standardUnits+". ");
                            ds.FoundMatch = true;
                        }
                        else if (difference < tolerance)
                        {
                            logger.Info("TEST FILE SUCCESS: Found matching space area with an area = " + testFileSpaceArea.ToString("#.000") + " " + standardUnits + ".");
                            ds.FoundMatch = true;
                        }
                        else
                        {
                            logger.Info("TEST FILE FAILURE: " + key + ".  Failure to find an space area match.");
                            ds.FoundMatch = false;
                        }
                    }
                    else
                    {
                        logger.Info("TEST FILE FAILURE: "+key +" Could not be matched");
                        //failure to match spaceIds
                        logger.Info("Test File and Standard File space names could not be matched.  SpaceId: " + key + " could not be found in the test file.");
                        ds.FoundMatch = false;
                        return false;
                    }
                    cr.SpacesReport.Add(ds);
                }
            }

            catch (Exception e)
            {
                logger.Debug(e.ToString());
                logger.Fatal("Failed to complete the Space Area Test.  See exceptions noted.");
                return false;
            }
            return true;
        }
        //Tolerance checks depend upon percentage tolerances
        public static DOEgbXMLReportingObj TestSpaceVolumes(List<XmlDocument> gbXMLDocs, List<XmlNamespaceManager> gbXMLnsm, DOEgbXMLReportingObj report, Conversions.volumeUnitEnum standardUnits, Conversions.volumeUnitEnum testUnits, double testvolConversion, double standardvolConversion,DOEgbXMLTestDetail testDetails)
        {
            report.passOrFail = true;
            string spaceId = "";
            report.unit = standardUnits.ToString();
            //assuming that this will be plenty large for now
            Dictionary<string, double> standardFileVolumeDict = new Dictionary<string, double>();
            Dictionary<string, double> testFileVolumeDict = new Dictionary<string, double>();
            bool thinWalled = false;
            try
            {
                //check to see if the test file comes from OpenStudio or Bentley (non-thick wall, or non-centerline geometry)
                XmlNamespaceManager gbXMLnstw = gbXMLnsm[0];
                XmlNode productName = gbXMLDocs[0].SelectSingleNode("/gbXMLv5:gbXML/gbXMLv5:DocumentHistory/gbXMLv5:ProgramInfo/gbXMLv5:ProductName", gbXMLnstw);
                if (productName.InnerText.ToLower().Replace(" ", String.Empty).Trim() == "openstudio") //TODO: consider a different test.
                {
                    thinWalled = true;
                }
                for (int i = 0; i < gbXMLDocs.Count; i++)
                {
                    XmlDocument gbXMLTestFile = gbXMLDocs[i];
                    XmlNamespaceManager gbXMLns = gbXMLnsm[i];

                    XmlNodeList spaceNodes = gbXMLDocs[i].SelectNodes("/gbXMLv5:gbXML/gbXMLv5:Campus/gbXMLv5:Building/gbXMLv5:Space/gbXMLv5:Volume", gbXMLnsm[i]);
                    //make lists of the areas in each project
                    foreach (XmlNode spaceNode in spaceNodes)
                    {
                        string volume = spaceNode.InnerText;
                        if (i % 2 != 0)
                        {
                            spaceId = spaceNode.ParentNode.Attributes[0].Value;
                            if(!thinWalled)
                            {
                                //no conversion necessary
                                standardFileVolumeDict.Add(spaceId, (Convert.ToDouble(volume) * standardvolConversion));
                            }
                            else
                            {
                                if(testDetails.ThinWalledSpecs.Count > 0)
                                {
                                    var twSpec = testDetails.ThinWalledSpecs.Find(x => x.SpaceName == spaceId);
                                    standardFileVolumeDict.Add(spaceId, twSpec.Volume);
                                }
                                else
                                {
                                    //no conversion necessary
                                    standardFileVolumeDict.Add(spaceId, (Convert.ToDouble(volume) * standardvolConversion));
                                }
                            }
                        }
                        else
                        {
                            spaceId = spaceNode.ParentNode.Attributes[0].Value;
                            double convertedValue = Convert.ToDouble(volume) * testvolConversion;
                            testFileVolumeDict.Add(spaceId, convertedValue);
                        }
                    }
                }
                var standardKeys = standardFileVolumeDict.Keys;
                foreach (string key in standardKeys)
                {
                    if (testFileVolumeDict.ContainsKey(key))
                    {
                        double standardFileVolume = standardFileVolumeDict[key];
                        double testFileVolume = testFileVolumeDict[key];

                        report.standResult.Add(standardFileVolume.ToString("#.000"));
                        report.testResult.Add(testFileVolume.ToString("#.000"));
                        report.idList.Add(key);

                        double pctdifference = Math.Abs(testFileVolume - standardFileVolume)/standardFileVolume;
                        if (pctdifference == 0)
                        {
                            report.MessageList.Add("For Space Id: " + key + ".  Success finding matching space volume.  The Standard and Test Files both have identical volumes: " + testFileVolume.ToString("#.000") + " " + report.unit + "for Space Id: " + key);
                            report.TestPassedDict.Add(key, true);
                        }
                        else if (pctdifference <= report.tolerance)
                        {
                            report.MessageList.Add("For Space Id: " + key + ".  Success finding matching space volume.  The Standard Files space volume of " + standardFileVolume.ToString("#.000") + " " + report.unit + "and the Test File space volume: " + testFileVolume.ToString("#.000") + " are within the allowed tolerance of" + report.tolerance.ToString() + " " + report.unit + ".");
                            report.TestPassedDict.Add(key, true);
                        }
                        else
                        {
                            //at the point of failure, the test will return with details about which volume failed.
                            report.MessageList.Add("For Space Id: " + key + ".  Failure to find a volume match.  The Volume in the Test File equal to: " + testFileVolume.ToString("#.000") + " " + report.unit + " was not within the allowed tolerance.  SpaceId: " + key + " in the Standard file has a volume: " + standardFileVolume.ToString("#.000") + " .");
                            report.TestPassedDict.Add(key, false);
                        }
                    }
                    else
                    {
                        report.standResult.Add("Space Id: " + key);
                        report.testResult.Add("Could not be matched");
                        report.idList.Add("");

                        //at the point of failure, the test will return with details about which volume failed.
                        report.MessageList.Add("Test File and Standard File space names could not be matched.  SpaceId: " + key + " could not be found in the test file.");
                        report.passOrFail = false;
                        return report;
                    }
                }
                return report;
            }

            catch (Exception e)
            {
                report.MessageList.Add(e.ToString());
                report.longMsg = " Failed to complete the " + report.testType + ".  See exceptions noted.";
                report.passOrFail = false;
                return report;
            }

            report.longMsg = "Fatal " + report.testType + " Test Failure";
            report.passOrFail = false;
            return report;
        }
        //Created July 2016, Chien Si Harriman
        //note we made a change to this method where the tolerance is now based on a percentage to the standard, and is not absolute.
        public static bool GetBuildingArea(List<XmlDocument> gbXMLDocs, List<XmlNamespaceManager> gbXMLnsm, ref CampusReport cr, Conversions.areaUnitEnum standardUnits, Conversions.areaUnitEnum testUnits, double testareaConversion, double standardareaConversion, double tolerance, DOEgbXMLTestDetail t)
        {
            
            //assuming that this will be plenty large for now, all test cases only have one building currently.
            string[] resultsArray = new string[50];
            bool thinWalled = false;
            for (int i = 0; i < gbXMLDocs.Count; i++)
            {
                try
                {
                    XmlNode productName = gbXMLDocs[0].SelectSingleNode("/gbXMLv5:gbXML/gbXMLv5:DocumentHistory/gbXMLv5:ProgramInfo/gbXMLv5:ProductName", gbXMLnsm[i]);
                    if (productName.InnerText.ToLower().Replace(" ",String.Empty).Trim() == "openstudio") //TODO:  Consider a different test.
                    {
                        thinWalled = true;
                    }
                    XmlDocument gbXMLTestFile = gbXMLDocs[i];
                    XmlNamespaceManager gbXMLns = gbXMLnsm[i];

                    var node = gbXMLDocs[i].SelectSingleNode("/gbXMLv5:gbXML/gbXMLv5:Campus/gbXMLv5:Building/gbXMLv5:Area", gbXMLnsm[i]);
                    string area = node.InnerText;
                    //need to test for accuracy of result if accurate then pass, if not, how much inaccuracy and return this result 
                    resultsArray[i] = area;
                    if (i % 2 != 0)
                    {
                        //setup standard result and test result
                        if (testareaConversion != 1) { logger.Info("PROGRAMMER'S NOTE: Converted the test file building area units."); }
                        //apply the conversion factor on the test file always, regardless.
                        double standardArea = Convert.ToDouble(resultsArray[i]) * standardareaConversion;
                        double testArea = Convert.ToDouble(resultsArray[(i - 1)]) * testareaConversion;
                        if (thinWalled)
                        {
                            //no conversion necessary, it was already accounted for when it was entered by the administrator.
                            if (Math.Abs(testArea - t.thinWalledExpectedBuildingArea)/t.thinWalledAltBuildingArea < tolerance) { testArea = t.thinWalledAltBuildingArea; }
                            else
                            {
                                logger.Info("TEST FILE FAILURE:  The test file's Building Area  is not within the allowable tolerance of " + tolerance.ToString() + ".");
                                return false;
                            }
                        }
                        
                        logger.Info("Standard Building Area: "+String.Format("{0:#,0.00}", standardArea.ToString()));
                        logger.Info("Test Building Area: "+String.Format("{0:#,0.00}", testArea.ToString()));

                        cr.BuildingSummary.Find(x => x.FileType == "Standard").BuildingArea = new Area(standardArea,"Square Feet");
                        cr.BuildingSummary.Find(x => x.FileType == "Test").BuildingArea = new Area(testArea, "Square Feet");

                        double difference = Math.Abs(standardArea - testArea)/standardArea;
                        if (difference == 0)
                        {
                            logger.Info("TEST FILE SUCCESS:PERFECT: The test file's Building Area matches the standard file Building Area exactly.");
                        }

                        else if (difference <= tolerance)
                        {
                            logger.Info("TEST FILE SUCCESS: The test file's Building Area is within the allowable tolerance of = " + tolerance.ToString());
                        }
                        else
                        {
                            logger.Info("TEST FILE FAILURE:  The test file's Building Area  is not within the allowable tolerance of " + tolerance.ToString() + ".");
                            return false;
                        }
                    }
                    else { continue; }
                }
                catch (Exception e)
                {
                    logger.Debug(e.ToString());
                    logger.Fatal(" Failed to locate Building Area in the XML file.");
                    return false;
                }
            }

            return true;
        }
        public static DOEgbXMLReportingObj TestSpaceAreas(List<XmlDocument> gbXMLDocs, List<XmlNamespaceManager> gbXMLnsm, DOEgbXMLReportingObj report, Conversions.areaUnitEnum standardUnits, Conversions.areaUnitEnum testUnits, double testareaConversion,double standardareaConversion,DOEgbXMLTestDetail testDetails)
        {
            //this summary is text that describes to a lay user what this test does, and how it works functionally.  The user should have some familiarity with the basic knowledge of gbXML 
            //added Feb 13 2013
            report.testSummary = "This test compares the square footage of spaces in the test and standard files.  It does this by searching";
            report.testSummary += "for a unique Space id in both the test and standard files, and finding a match.  Once a match is found, it then";
            report.testSummary += " finds the square footage reported for the Space area, and compares them to ensure they are the same or";
            report.testSummary += " within tolerance. For example, if the standard file has a Space with id = \"Space-1\" with an area of";
            report.testSummary += "250 square feet, then this test searches through the test file for a Space with the identical id.";
            report.testSummary += "  Once this space has been located, the test then compares the Area to 250 square feet.  ";
            report.testSummary += "If they are identical, the test is done, and passes.  We have built a tolerance in this test, meaning the";
            report.testSummary += " areas do not need to match perfectly in the standard file and test file.  As long as your test file's value";
            report.testSummary += " for Space Area is +/- this tolerance, the test will pass.  Using the previous example, if the allowable";
            report.testSummary += " tolerance is 1% (1% of 250 is 2.5 sf), then the test file may have a space area ranging from 247.5 to 252.5";
            report.testSummary += " square feet, and the test will still delcare \"Pass\".";


            report.unit = standardUnits.ToString();
            report.passOrFail = true;
            string spaceId = "";
            //assuming that this will be plenty large for now
            Dictionary<string, double> standardFileAreaDict = new Dictionary<string, double>();
            Dictionary<string, double> testFileAreaDict = new Dictionary<string, double>();
            bool thinWalled = false;
            try
            {
                //check to see if the test file comes from OpenStudio or Bentley (non-thick wall, or non-centerline geometry)
                XmlNamespaceManager gbXMLnstw = gbXMLnsm[0];
                XmlNode productName = gbXMLDocs[0].SelectSingleNode("/gbXMLv5:gbXML/gbXMLv5:DocumentHistory/gbXMLv5:ProgramInfo/gbXMLv5:ProductName",gbXMLnstw);
                if (productName.InnerText.ToLower().Replace(" ", String.Empty).Trim() == "openstudio")//TODO: consider a different test
                {
                    thinWalled = true;
                }
                for (int i = 0; i < gbXMLDocs.Count; i++)
                {
                    XmlDocument gbXMLTestFile = gbXMLDocs[i];
                    XmlNamespaceManager gbXMLns = gbXMLnsm[i];

                    XmlNodeList spaceNodes = gbXMLDocs[i].SelectNodes("/gbXMLv5:gbXML/gbXMLv5:Campus/gbXMLv5:Building/gbXMLv5:Space/gbXMLv5:Area", gbXMLnsm[i]);
                    //make lists of the areas in each project
                    foreach (XmlNode spaceNode in spaceNodes)
                    {
                        string area = spaceNode.InnerText;
                        if (i % 2 != 0)
                        {
                            for (int n = 0; n < spaceNode.ParentNode.Attributes.Count; n++)
                            {
                                if (spaceNode.ParentNode.Attributes[n].Name == "id")
                                {
                                    spaceId = spaceNode.ParentNode.Attributes[n].Value;
                                    if(!thinWalled)
                                    {
                                        //no conversion necessary
                                        standardFileAreaDict.Add(spaceId, Convert.ToDouble(area)*standardareaConversion);
                                    }
                                    else
                                    {
                                        if(testDetails.ThinWalledSpecs.Count > 0)
                                        {
                                            var thinwalleddef = testDetails.ThinWalledSpecs.Find(x => x.SpaceName == spaceId); //it is critical that space names match for these tests.
                                            standardFileAreaDict.Add(spaceId, thinwalleddef.FloorArea);
                                        }
                                        else
                                        {
                                            //no conversion necessary
                                            standardFileAreaDict.Add(spaceId, Convert.ToDouble(area) * standardareaConversion);
                                        }
                                    }
                                    break;
                                }
                            }
                            
                        }
                        else
                        {
                            for (int n = 0; n < spaceNode.ParentNode.Attributes.Count; n++)
                            {
                                if (spaceNode.ParentNode.Attributes[n].Name == "id")
                                {
                                    spaceId = spaceNode.ParentNode.Attributes[n].Value;

                                    double convertedArea = Convert.ToDouble(area) * testareaConversion;
                                    testFileAreaDict.Add(spaceId, convertedArea);
                                    break;
                                }
                            }
                            
                        }
                    }
                }
                var standardKeys = standardFileAreaDict.Keys;

                foreach (string key in standardKeys)
                {
                    if (testFileAreaDict.ContainsKey(key))
                    {
                        double testFileSpaceArea = testFileAreaDict[key];
                        double standardFileSpaceArea = standardFileAreaDict[key];


                        report.standResult.Add(standardFileSpaceArea.ToString("#.000"));
                        report.testResult.Add(testFileSpaceArea.ToString("#.000"));
                        report.idList.Add(key);

                        double difference = Math.Abs(testFileSpaceArea - standardFileSpaceArea);
                        if (difference == 0)
                        {
                            report.MessageList.Add("For Space Id: " + key + ".  Success finding matching space area.  The Standard File and the Test File both have a space with an area = " + testFileSpaceArea.ToString("#.000") + " " + report.unit + ". ");
                            report.TestPassedDict.Add(key, true);
                        }
                        else if (difference < report.tolerance)
                        {
                            report.MessageList.Add("For Space Id: " + key + ".  Success finding matching space area.  The Standard File space area of " + standardFileSpaceArea.ToString("#.000") + " and the Test File space area of " + testFileSpaceArea.ToString("#.000") + " " + report.unit + " is within the allowable tolerance of " + report.tolerance.ToString() + " " + report.unit);
                            report.TestPassedDict.Add(key, true);
                        }
                        else
                        {
                            report.MessageList.Add("For space Id: " + key + ".  Failure to find an space area match.  THe area equal to  = " + standardFileSpaceArea.ToString("#.000") + " " + report.unit + " in the Standard File could not be found in the Test File. ");
                            report.TestPassedDict.Add(key, false);
                        }
                    }
                    else
                    {
                        report.standResult.Add("---");
                        report.testResult.Add("Could not be matched");
                        report.idList.Add(key);
                        //failure to match spaceIds
                        report.MessageList.Add("Test File and Standard File space names could not be matched.  SpaceId: " + key + " could not be found in the test file.");
                        report.passOrFail = false;
                        return report;
                    }
                }
                return report;
            }

            catch (Exception e)
            {
                report.MessageList.Add(e.ToString());
                report.longMsg = "Failed to complete the " + report.testType + ".  See exceptions noted.";
                report.passOrFail = false;
                return report;
            }
            report.longMsg = "Fatal " + report.testType + " Test Failure";
            report.passOrFail = false;
            return report;
        }
        public void InitializeTestResultStrings()
        {
            //holds the Detail object for all the tests
            TestDetailList = new List <DOEgbXMLTestDetail>();

            //get the strings for the summary page table
            //initialize the testdetails for all the tests
            //DOEgbXMLTestDetail test1detail = new DOEgbXMLTestDetail();
            //DOEgbXMLTestDetail test2detail = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test3detail = new DOEgbXMLTestDetail();
            //DOEgbXMLTestDetail test4detail = new DOEgbXMLTestDetail();
            //DOEgbXMLTestDetail test5detail = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test6detail = new DOEgbXMLTestDetail();

            DOEgbXMLTestDetail test7detail  = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test8detail  = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test12detail = new DOEgbXMLTestDetail();

            //DOEgbXMLTestDetail test25detail = new DOEgbXMLTestDetail();
            //DOEgbXMLTestDetail test28detail = new DOEgbXMLTestDetail();

            DOEgbXMLTestDetail testwholeBuild1detail = new DOEgbXMLTestDetail();

            //DOEgbXMLTestDetail testwholeBuild2detail = new DOEgbXMLTestDetail();

            //create the strings
            //reach test.  TBD
            //Test1
            //test1detail.testName = "Test1";
            //test1detail.shortTitle = "2 Walls of Different Thicknesses with Parallel Aligned Faces";
            //test1detail.testSummary = "This test is designed to make sure that when walls of different thicknesses are joined with their faces aligned, that the centerline offset does not create extra walls during the gbXML creation process.  If these extra sliver walls are found in the gbXML file, this test will fail.";
            //test1detail.passString = "This test has passed.";
            //test1detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            //TestDetailList.Add(test1detail);

            //reach test.  TBD
            //test 2
            //test2detail.testName = "Test2";
            //test2detail.shortTitle = "Single window with overhang that bisects the window's height.";
            //test2detail.testSummary = "A 1-zone, one story, simple model with exterior shading devices that act as overhangs and exterior light shelves for windows on the south façade.  Light shelves are 1” thick and split a single window instance in the BIM along its centerline.  This test is designed to ensure that this window should be represented as two windows in gbXML, the one window that is above the overhang, and the other that is below.";
            //test2detail.passString = "This test has passed.";
            //test2detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            //TestDetailList.Add(test2detail);

            //test 3
            test3detail.testName    = "Test3";
            test3detail.shortTitle  = "Interior walls and Floor Second Level Space Boundary Test  ";
            test3detail.testSummary = "A 5-zone model with overlapping zones and a double-height zone.  This test is designed to ensure that the tool used to create the zones can properly follow the basic conventions for second level space boundaries.";
            test3detail.passString  = "This test has passed.";
            test3detail.failString  = "This test has failed.";
            test3detail.thinWalledAltBuildingArea      = 6321.25;
            test3detail.thinWalledExpectedBuildingArea = 6500.00;
            ThinWalledAlternatives sp2 = new ThinWalledAlternatives("sp-2-Space", 600, 7800); //spacename in standard file, thin walled area (ft2), thin walled volume (ft3)

            test3detail.ThinWalledSpecs.Add(sp2);
            ThinWalledAlternatives sp3 = new ThinWalledAlternatives("sp-3-Space", 1400, 18200);

            test3detail.ThinWalledSpecs.Add(sp3);
            ThinWalledAlternatives sp4 = new ThinWalledAlternatives("sp-4-Space", 2500, 65000);

            test3detail.ThinWalledSpecs.Add(sp4);
            ThinWalledAlternatives sp5 = new ThinWalledAlternatives("sp-5-Space", 1400, 18200);

            test3detail.ThinWalledSpecs.Add(sp5);
            ThinWalledAlternatives sp6 = new ThinWalledAlternatives("sp-6-Space", 600, 7800);

            test3detail.ThinWalledSpecs.Add(sp6);
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test3detail);

            //reach test.  TBD
            //test 4
            //test4detail.testName = "Test4";
            //test4detail.shortTitle = "Double height space with hole cut in floor and a skylight";
            //test4detail.testSummary = "This test is a large open atrium with a hole cut in the floor to allow light to penetrate through to the floor below.";
            //test4detail.passString = "This test has passed.";
            //test4detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            //TestDetailList.Add(test4detail);

            //reach test.  TBD
            //test 5
            //test5detail.testName = "Test5";
            //test5detail.shortTitle = "Basement walls that extend above grade and bound two different spaces";
            //test5detail.testSummary = "A two zone model that ensures exterior walls can properly be defined as underground and above grade.  A single wall has been drawn by the user that begins below grade, and terminates above grade.  Above grade, the walls bound a space that is above grade.  Below grade, the walls bound a space that is entirely below grade.";
            //test5detail.passString = "This test has passed.";
            //test5detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            //TestDetailList.Add(test5detail);


            //Test 6
            test6detail.testName    = "Test6";
            test6detail.shortTitle  = "Simple box adjacency test.";
            test6detail.testSummary = "All above-grade zones, being tested to see if adjacency relationships are preserved.  Zones with surfaces touching one another should have these surfaces defined as \"Interior\" types and the correct adjacency conditions.";
            test6detail.passString  = "This test has passed.";
            test6detail.failString  = "This test has failed.";
            test6detail.thinWalledExpectedBuildingArea = 1160;
            test6detail.thinWalledAltBuildingArea      = 1160;
            //ADD list to local testStrings List of Lists
            ThinWalledAlternatives sp_0_0_6 = new ThinWalledAlternatives("Space_0_0", 6027.79, 138433.493); //remember has to be in feet2 and feet3

            test6detail.ThinWalledSpecs.Add(sp_0_0_6);
            ThinWalledAlternatives sp_1_0_6 = new ThinWalledAlternatives("Space_1_0", 2152.78, 49440.533);

            test6detail.ThinWalledSpecs.Add(sp_1_0_6);
            ThinWalledAlternatives sp_2_0_6 = new ThinWalledAlternatives("Space_2_0", 2152.78, 49440.533);

            test6detail.ThinWalledSpecs.Add(sp_2_0_6);
            ThinWalledAlternatives sp_3_0_6 = new ThinWalledAlternatives("Space_3_0", 2152.78, 49440.533);

            test6detail.ThinWalledSpecs.Add(sp_3_0_6);
            TestDetailList.Add(test6detail);

            //test 7
            test7detail.testName    = "Test7";
            test7detail.shortTitle  = "Folded roof element.";
            test7detail.testSummary = "This is the first in a proposed series of tests that focus on roof elements that grow in geometric complexity.";
            test7detail.passString  = "This test has passed.";
            test7detail.failString  = "This test has failed.";
            test7detail.thinWalledExpectedBuildingArea = 3200;
            test7detail.thinWalledAltBuildingArea      = 3042;
            ThinWalledAlternatives sp1_7 = new ThinWalledAlternatives("sp-1-Space", 1600, 16000); //remember has to be in feet2 and feet3

            test7detail.ThinWalledSpecs.Add(sp1_7);
            ThinWalledAlternatives sp2_7 = new ThinWalledAlternatives("sp-2-Space", 1600, 22925.25); //remember has to be in feet2 and feet3

            test7detail.ThinWalledSpecs.Add(sp2_7);
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test7detail);

            //test 8
            test8detail.testName    = "Test8";
            test8detail.shortTitle  = "Sloping slab on grade";
            test8detail.testSummary = "Ensures that sloping slab on grade comes through properly in gbXML, and that walls, which terminate at grade, are turned into the appropriate surfaceType (\"UndergroundWall\")";
            test8detail.passString  = "This test has passed.";
            test8detail.failString  = "This test has failed.";
            test8detail.thinWalledExpectedBuildingArea = 6029.88;
            test8detail.thinWalledAltBuildingArea      = 5870.7183;
            //ADD list to local testStrings List of Lists
            ThinWalledAlternatives sp1_Aud_occ = new ThinWalledAlternatives("sp-1-Occupied_Auditorium", 6029.88, 90000); //enter expected thin walled values

            test8detail.ThinWalledSpecs.Add(sp1_Aud_occ);
            ThinWalledAlternatives sp2_Aud_unocc = new ThinWalledAlternatives("sp-2-Unoccupied_Auditorium", 6000, 120000);

            test8detail.ThinWalledSpecs.Add(sp2_Aud_unocc);
            ThinWalledAlternatives sp3_Roof = new ThinWalledAlternatives("sp-3-Roof_Void", 6000, 45000);

            test8detail.ThinWalledSpecs.Add(sp3_Roof);
            TestDetailList.Add(test8detail);

            //test 12
            test12detail.testName    = "Test12";
            test12detail.shortTitle  = "Simple box stacking test.";
            test12detail.testSummary = "All above-grade zones, being tested to see if adjacency relationships are preserved.  Zones with surfaces touching one another should have these surfaces defined as \"Interior\" types and the correct adjacency conditions.";
            test12detail.passString  = "This test has passed.";
            test12detail.failString  = "This test has failed.";
            test12detail.thinWalledExpectedBuildingArea = 16791.7003; //this is already a thin walled test case, so the two are the same
            test12detail.thinWalledAltBuildingArea      = 16791.7003;
            //ADD list to local testStrings List of Lists
            ThinWalledAlternatives sp_0_0_12 = new ThinWalledAlternatives("Space_0_0", 6027.79, 138433.493); //remember has to be in feet2 and feet3

            test12detail.ThinWalledSpecs.Add(sp_0_0_12);
            ThinWalledAlternatives sp_1_0_12 = new ThinWalledAlternatives("Space_1_0", 2152.78, 49440.533);

            test12detail.ThinWalledSpecs.Add(sp_1_0_12);
            ThinWalledAlternatives sp_2_0_12 = new ThinWalledAlternatives("Space_2_0", 2152.78, 49440.533);

            test12detail.ThinWalledSpecs.Add(sp_2_0_12);
            ThinWalledAlternatives sp_3_0_12 = new ThinWalledAlternatives("Space_3_0", 2152.78, 49440.533);

            test12detail.ThinWalledSpecs.Add(sp_3_0_12);
            ThinWalledAlternatives sp_4_0_12 = new ThinWalledAlternatives("Space_4_0", 4305.564, 98881.0668);

            test12detail.ThinWalledSpecs.Add(sp_4_0_12);
            TestDetailList.Add(test12detail);

            //test whole building 1
            testwholeBuild1detail.testName    = "Whole Building Test 1";
            testwholeBuild1detail.shortTitle  = "Test for multi-floor building with ceiling return plenum.";
            testwholeBuild1detail.testSummary = "Ensures that the plenum horizontal surfaces are properly translated into interior surfaces, and have the proper adjacency conditions.";
            testwholeBuild1detail.passString  = "This test has passed.";
            testwholeBuild1detail.failString  = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(testwholeBuild1detail);

            //test whole building 2
            //testwholeBuild2detail.testName = "Whole Building Test 2";
            //testwholeBuild2detail.shortTitle = "Test for plenums and multi-zone objects over basement.";
            //testwholeBuild2detail.testSummary = "Tests a simple building that is multiple stories and with plenums.  This is a very standard building, typical of DOE prototype buildings, e.g.  In addition to the features of Whole Building Test Case 1, this building also has underground surfaces.  Ensures that the plenum horizontal surfaces are properly translated into interior surfaces, and have the proper adjacency conditions.";
            //testwholeBuild2detail.passString = "This test has passed.";
            //testwholeBuild2detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            //TestDetailList.Add(testwholeBuild2detail);

            ////test 25
            //test25detail.testName = "Test25";
            //test25detail.shortTitle = "Stacked interior walls with openings";
            //test25detail.testSummary = "A simplified 4-zone model of a building that has interior walls stacked on top of one another.  The interior walls each have openings cut into them, to simulate something that may be drawn as a hallway by a designer.";
            //test25detail.passString = "This test has passed.";
            //test25detail.failString = "This test has failed.";
            ////ADD list to local testStrings List of Lists
            //TestDetailList.Add(test25detail);

            ////test 28
            //test28detail.testName = "Test28";
            //test28detail.shortTitle = "Roof eaves are turned into shading devices automatically";
            //test28detail.testSummary = "A simplified 3-zone model of a building shaped like a residential home has been created.  The home is a simple two story example that has a small attic formed by a roof with a 30 degree pitch which slopes along one of the site’s Cartesian axes.  This test is a simple test that ensures the authoring tool is able to automatically break the roof into a space bounding object and shade object appropriately without any user intervention.";
            //test28detail.passString = "This test has passed.";
            //test28detail.failString = "This test has failed.";
            ////ADD list to local testStrings List of Lists
            //TestDetailList.Add(test28detail);
        }
        public void InitializeTestResultStrings()
        {
            //holds the Detail object for all the tests
            TestDetailList = new List<DOEgbXMLTestDetail>();

            //get the strings for the summary page table
            //initialize the testdetails for all the tests
            //DOEgbXMLTestDetail test1detail = new DOEgbXMLTestDetail();
            //DOEgbXMLTestDetail test2detail = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test3detail = new DOEgbXMLTestDetail();
            //DOEgbXMLTestDetail test4detail = new DOEgbXMLTestDetail();
            //DOEgbXMLTestDetail test5detail = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test6detail = new DOEgbXMLTestDetail();

            DOEgbXMLTestDetail test7detail = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test8detail = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test12detail = new DOEgbXMLTestDetail();

            //DOEgbXMLTestDetail test25detail = new DOEgbXMLTestDetail();
            //DOEgbXMLTestDetail test28detail = new DOEgbXMLTestDetail();

            DOEgbXMLTestDetail testwholeBuild1detail = new DOEgbXMLTestDetail();
            //DOEgbXMLTestDetail testwholeBuild2detail = new DOEgbXMLTestDetail();

            //create the strings
            //reach test.  TBD
            //Test1
            //test1detail.testName = "Test1";
            //test1detail.shortTitle = "2 Walls of Different Thicknesses with Parallel Aligned Faces";
            //test1detail.testSummary = "This test is designed to make sure that when walls of different thicknesses are joined with their faces aligned, that the centerline offset does not create extra walls during the gbXML creation process.  If these extra sliver walls are found in the gbXML file, this test will fail.";
            //test1detail.passString = "This test has passed.";
            //test1detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            //TestDetailList.Add(test1detail);

            //reach test.  TBD
            //test 2
            //test2detail.testName = "Test2";
            //test2detail.shortTitle = "Single window with overhang that bisects the window's height.";
            //test2detail.testSummary = "A 1-zone, one story, simple model with exterior shading devices that act as overhangs and exterior light shelves for windows on the south façade.  Light shelves are 1” thick and split a single window instance in the BIM along its centerline.  This test is designed to ensure that this window should be represented as two windows in gbXML, the one window that is above the overhang, and the other that is below.";
            //test2detail.passString = "This test has passed.";
            //test2detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            //TestDetailList.Add(test2detail);

            //test 3
            test3detail.testName = "Test3";
            test3detail.shortTitle = "Interior walls and Floor Second Level Space Boundary Test  ";
            test3detail.testSummary = "A 5-zone model with overlapping zones and a double-height zone.  This test is designed to ensure that the tool used to create the zones can properly follow the basic conventions for second level space boundaries.";
            test3detail.passString = "This test has passed.";
            test3detail.failString = "This test has failed.";
            test3detail.thinWalledAltBuildingArea = 6321.25;
            test3detail.thinWalledExpectedBuildingArea = 6500.00;
            ThinWalledAlternatives sp2 = new ThinWalledAlternatives("sp-2-Space",600,7800); //spacename in standard file, thin walled area (ft2), thin walled volume (ft3)
            test3detail.ThinWalledSpecs.Add(sp2);
            ThinWalledAlternatives sp3 = new ThinWalledAlternatives("sp-3-Space", 1400, 18200);
            test3detail.ThinWalledSpecs.Add(sp3);
            ThinWalledAlternatives sp4 = new ThinWalledAlternatives("sp-4-Space",2500,65000);
            test3detail.ThinWalledSpecs.Add(sp4);
            ThinWalledAlternatives sp5 = new ThinWalledAlternatives("sp-5-Space", 1400, 18200);
            test3detail.ThinWalledSpecs.Add(sp5);
            ThinWalledAlternatives sp6 = new ThinWalledAlternatives("sp-6-Space",600,7800);
            test3detail.ThinWalledSpecs.Add(sp6);
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test3detail);

            //reach test.  TBD
            //test 4 
            //test4detail.testName = "Test4";
            //test4detail.shortTitle = "Double height space with hole cut in floor and a skylight";
            //test4detail.testSummary = "This test is a large open atrium with a hole cut in the floor to allow light to penetrate through to the floor below.";
            //test4detail.passString = "This test has passed.";
            //test4detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            //TestDetailList.Add(test4detail);

            //reach test.  TBD
            //test 5 
            //test5detail.testName = "Test5";
            //test5detail.shortTitle = "Basement walls that extend above grade and bound two different spaces";
            //test5detail.testSummary = "A two zone model that ensures exterior walls can properly be defined as underground and above grade.  A single wall has been drawn by the user that begins below grade, and terminates above grade.  Above grade, the walls bound a space that is above grade.  Below grade, the walls bound a space that is entirely below grade.";
            //test5detail.passString = "This test has passed.";
            //test5detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            //TestDetailList.Add(test5detail);


            //Test 6
            test6detail.testName = "Test6";
            test6detail.shortTitle = "Simple box adjacency test.";
            test6detail.testSummary = "All above-grade zones, being tested to see if adjacency relationships are preserved.  Zones with surfaces touching one another should have these surfaces defined as \"Interior\" types and the correct adjacency conditions.";
            test6detail.passString = "This test has passed.";
            test6detail.failString = "This test has failed.";
            test6detail.thinWalledExpectedBuildingArea = 1160;
            test6detail.thinWalledAltBuildingArea = 1160;
            //ADD list to local testStrings List of Lists
            ThinWalledAlternatives sp_0_0_6 = new ThinWalledAlternatives("Space_0_0", 6027.79, 138433.493); //remember has to be in feet2 and feet3
            test6detail.ThinWalledSpecs.Add(sp_0_0_6);
            ThinWalledAlternatives sp_1_0_6 = new ThinWalledAlternatives("Space_1_0", 2152.78, 49440.533);
            test6detail.ThinWalledSpecs.Add(sp_1_0_6);
            ThinWalledAlternatives sp_2_0_6 = new ThinWalledAlternatives("Space_2_0", 2152.78, 49440.533);
            test6detail.ThinWalledSpecs.Add(sp_2_0_6);
            ThinWalledAlternatives sp_3_0_6 = new ThinWalledAlternatives("Space_3_0", 2152.78, 49440.533);
            test6detail.ThinWalledSpecs.Add(sp_3_0_6);
            TestDetailList.Add(test6detail);

            //test 7 
            test7detail.testName = "Test7";
            test7detail.shortTitle = "Folded roof element.";
            test7detail.testSummary = "This is the first in a proposed series of tests that focus on roof elements that grow in geometric complexity.";
            test7detail.passString = "This test has passed.";
            test7detail.failString = "This test has failed.";
            test7detail.thinWalledExpectedBuildingArea = 3200;
            test7detail.thinWalledAltBuildingArea = 3042;
            ThinWalledAlternatives sp1_7 = new ThinWalledAlternatives("sp-1-Space", 1600, 16000); //remember has to be in feet2 and feet3
            test7detail.ThinWalledSpecs.Add(sp1_7);
            ThinWalledAlternatives sp2_7 = new ThinWalledAlternatives("sp-2-Space", 1600, 22925.25); //remember has to be in feet2 and feet3
            test7detail.ThinWalledSpecs.Add(sp2_7);
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test7detail);

            //test 8 
            test8detail.testName = "Test8";
            test8detail.shortTitle = "Sloping slab on grade";
            test8detail.testSummary = "Ensures that sloping slab on grade comes through properly in gbXML, and that walls, which terminate at grade, are turned into the appropriate surfaceType (\"UndergroundWall\")";
            test8detail.passString = "This test has passed.";
            test8detail.failString = "This test has failed.";
            test8detail.thinWalledExpectedBuildingArea = 6029.88;
            test8detail.thinWalledAltBuildingArea = 5870.7183;
            //ADD list to local testStrings List of Lists
            ThinWalledAlternatives sp1_Aud_occ = new ThinWalledAlternatives("sp-1-Occupied_Auditorium", 6029.88, 90000); //enter expected thin walled values
            test8detail.ThinWalledSpecs.Add(sp1_Aud_occ);
            ThinWalledAlternatives sp2_Aud_unocc = new ThinWalledAlternatives("sp-2-Unoccupied_Auditorium",6000,120000);
            test8detail.ThinWalledSpecs.Add(sp2_Aud_unocc);
            ThinWalledAlternatives sp3_Roof = new ThinWalledAlternatives("sp-3-Roof_Void", 6000, 45000);
            test8detail.ThinWalledSpecs.Add(sp3_Roof);
            TestDetailList.Add(test8detail);

            //test 12
            test12detail.testName = "Test12";
            test12detail.shortTitle = "Simple box stacking test.";
            test12detail.testSummary = "All above-grade zones, being tested to see if adjacency relationships are preserved.  Zones with surfaces touching one another should have these surfaces defined as \"Interior\" types and the correct adjacency conditions.";
            test12detail.passString = "This test has passed.";
            test12detail.failString = "This test has failed.";
            test12detail.thinWalledExpectedBuildingArea = 16791.7003; //this is already a thin walled test case, so the two are the same
            test12detail.thinWalledAltBuildingArea = 16791.7003;
            //ADD list to local testStrings List of Lists
            ThinWalledAlternatives sp_0_0_12 = new ThinWalledAlternatives("Space_0_0", 6027.79, 138433.493); //remember has to be in feet2 and feet3
            test12detail.ThinWalledSpecs.Add(sp_0_0_12);
            ThinWalledAlternatives sp_1_0_12 = new ThinWalledAlternatives("Space_1_0", 2152.78, 49440.533);
            test12detail.ThinWalledSpecs.Add(sp_1_0_12);
            ThinWalledAlternatives sp_2_0_12 = new ThinWalledAlternatives("Space_2_0", 2152.78, 49440.533);
            test12detail.ThinWalledSpecs.Add(sp_2_0_12);
            ThinWalledAlternatives sp_3_0_12 = new ThinWalledAlternatives("Space_3_0", 2152.78, 49440.533);
            test12detail.ThinWalledSpecs.Add(sp_3_0_12);
            ThinWalledAlternatives sp_4_0_12 = new ThinWalledAlternatives("Space_4_0", 4305.564, 98881.0668);
            test12detail.ThinWalledSpecs.Add(sp_4_0_12);
            TestDetailList.Add(test12detail);

            //test whole building 1
            testwholeBuild1detail.testName = "Whole Building Test 1";
            testwholeBuild1detail.shortTitle = "Test for multi-floor building with ceiling return plenum.";
            testwholeBuild1detail.testSummary = "Ensures that the plenum horizontal surfaces are properly translated into interior surfaces, and have the proper adjacency conditions.";
            testwholeBuild1detail.passString = "This test has passed.";
            testwholeBuild1detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(testwholeBuild1detail);

            //test whole building 2 
            //testwholeBuild2detail.testName = "Whole Building Test 2";
            //testwholeBuild2detail.shortTitle = "Test for plenums and multi-zone objects over basement.";
            //testwholeBuild2detail.testSummary = "Tests a simple building that is multiple stories and with plenums.  This is a very standard building, typical of DOE prototype buildings, e.g.  In addition to the features of Whole Building Test Case 1, this building also has underground surfaces.  Ensures that the plenum horizontal surfaces are properly translated into interior surfaces, and have the proper adjacency conditions.";
            //testwholeBuild2detail.passString = "This test has passed.";
            //testwholeBuild2detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            //TestDetailList.Add(testwholeBuild2detail);

            ////test 25
            //test25detail.testName = "Test25";
            //test25detail.shortTitle = "Stacked interior walls with openings";
            //test25detail.testSummary = "A simplified 4-zone model of a building that has interior walls stacked on top of one another.  The interior walls each have openings cut into them, to simulate something that may be drawn as a hallway by a designer.";
            //test25detail.passString = "This test has passed.";
            //test25detail.failString = "This test has failed.";
            ////ADD list to local testStrings List of Lists
            //TestDetailList.Add(test25detail);

            ////test 28
            //test28detail.testName = "Test28";
            //test28detail.shortTitle = "Roof eaves are turned into shading devices automatically";
            //test28detail.testSummary = "A simplified 3-zone model of a building shaped like a residential home has been created.  The home is a simple two story example that has a small attic formed by a roof with a 30 degree pitch which slopes along one of the site’s Cartesian axes.  This test is a simple test that ensures the authoring tool is able to automatically break the roof into a space bounding object and shade object appropriately without any user intervention.";
            //test28detail.passString = "This test has passed.";
            //test28detail.failString = "This test has failed.";
            ////ADD list to local testStrings List of Lists
            //TestDetailList.Add(test28detail);


        }
        public void InitializeTestResultStrings()
        {
            //holds the Detail object for all the tests
            TestDetailList = new List<DOEgbXMLTestDetail>();

            //get the strings for the summary page table
            //initialize the testdetails for all the tests
            DOEgbXMLTestDetail test1detail = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test2detail = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test3detail = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test4detail = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test5detail = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test7detail = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test8detail = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test25detail = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test28detail = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail genericphase2 = new DOEgbXMLTestDetail();
            //create the strings
            //Test1
            test1detail.testName = "Test1";
            test1detail.shortTitle = "2 Walls of Different Thicknesses with Parallel Aligned Faces";
            test1detail.testSummary = "This test is designed to make sure that when walls of different thicknesses are joined with their faces aligned, that the centerline offset does not create extra walls during the gbXML creation process.  If these extra sliver walls are found in the gbXML file, this test will fail.";
            test1detail.passString = "This test has passed.";
            test1detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test1detail);

            //test 2
            test2detail.testName = "Test2";
            test2detail.shortTitle = "Single window with overhang that bisects the window's height.";
            test2detail.testSummary = "A 1-zone, one story, simple model with exterior shading devices that act as overhangs and exterior light shelves for windows on the south façade.  Light shelves are 1” thick and split a single window instance in the BIM along its centerline.  This test is designed to ensure that this window should be represented as two windows in gbXML, the one window that is above the overhang, and the other that is below.";
            test2detail.passString = "This test has passed.";
            test2detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test2detail);

            //test 3
            test3detail.testName = "Test3";
            test3detail.shortTitle = "Interior walls and Floor Second Level Space Boundary Test  ";
            test3detail.testSummary = "A 5-zone model with overlapping zones and a double-height zone.  This test is designed to ensure that the tool used to create the zones can properly follow the basic conventions for second level space boundaries.";
            test3detail.passString = "This test has passed.";
            test3detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test3detail);

            //test 4 
            test4detail.testName = "Test4";
            test4detail.shortTitle = "Double height space with hole cut in floor and a skylight";
            test4detail.testSummary = "This test is a large open atrium with a hole cut in the floor to allow light to penetrate through to the floor below.";
            test4detail.passString = "This test has passed.";
            test4detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test4detail);

            //test 5 
            test5detail.testName = "Test5";
            test5detail.shortTitle = "Basement walls that extend above grade and bound two different spaces";
            test5detail.testSummary = "A two zone model that ensures exterior walls can properly be defined as underground and above grade.  A single wall has been drawn by the user that begins below grade, and terminates above grade.  Above grade, the walls bound a space that is above grade.  Below grade, the walls bound a space that is entirely below grade.";
            test5detail.passString = "This test has passed.";
            test5detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test5detail);

            //test 7 
            test7detail.testName = "Test7";
            test7detail.shortTitle = "Folded roof element.";
            test7detail.testSummary = "This is the first in a proposed series of tests that focus on roof elements that grow in geometric complexity.";
            test7detail.passString = "This test has passed.";
            test7detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test7detail);

            //test 8 
            test8detail.testName = "Test8";
            test8detail.shortTitle = "Sloping slab on grade";
            test8detail.testSummary = "Ensures that sloping slab on grade comes through properly in gbXML, and that walls, which terminate at grade, are turned into the appropriate surfaceType (\"UndergroundWall\")";
            test8detail.passString = "This test has passed.";
            test8detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test8detail);

            //test 25
            test25detail.testName = "Test25";
            test25detail.shortTitle = "Stacked interior walls with openings";
            test25detail.testSummary = "A simplified 4-zone model of a building that has interior walls stacked on top of one another.  The interior walls each have openings cut into them, to simulate something that may be drawn as a hallway by a designer.";
            test25detail.passString = "This test has passed.";
            test25detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test25detail);

            //test 28
            test28detail.testName = "Test28";
            test28detail.shortTitle = "Roof eaves are turned into shading devices automatically";
            test28detail.testSummary = "A simplified 3-zone model of a building shaped like a residential home has been created.  The home is a simple two story example that has a small attic formed by a roof with a 30 degree pitch which slopes along one of the site’s Cartesian axes.  This test is a simple test that ensures the authoring tool is able to automatically break the roof into a space bounding object and shade object appropriately without any user intervention.";
            test28detail.passString = "This test has passed.";
            test28detail.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test28detail);

            //Generic Phase 2 Test
            genericphase2.testName = "GenericPhase2";
            genericphase2.shortTitle = "A validation tool for any gbXML geometry.";
            genericphase2.testSummary = "gbXML has recently released this validation tool for you to test any of your gbXML files.  Simply upload your gbXML file, choose the schema (most recent is 5.12) and hit the green button to generate your report, and view the results by browsing.";
            genericphase2.passString = "This test has passed.";
            genericphase2.failString = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(genericphase2);


        }
Esempio n. 10
0
        public void InitializeTestResultStrings()
        {
            //holds the Detail object for all the tests
            TestDetailList = new List <DOEgbXMLTestDetail>();

            //get the strings for the summary page table
            //initialize the testdetails for all the tests
            DOEgbXMLTestDetail test1detail   = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test2detail   = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test3detail   = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test4detail   = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test5detail   = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test7detail   = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test8detail   = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test25detail  = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail test28detail  = new DOEgbXMLTestDetail();
            DOEgbXMLTestDetail genericphase2 = new DOEgbXMLTestDetail();

            //create the strings
            //Test1
            test1detail.testName    = "Test1";
            test1detail.shortTitle  = "2 Walls of Different Thicknesses with Parallel Aligned Faces";
            test1detail.testSummary = "This test is designed to make sure that when walls of different thicknesses are joined with their faces aligned, that the centerline offset does not create extra walls during the gbXML creation process.  If these extra sliver walls are found in the gbXML file, this test will fail.";
            test1detail.passString  = "This test has passed.";
            test1detail.failString  = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test1detail);

            //test 2
            test2detail.testName    = "Test2";
            test2detail.shortTitle  = "Single window with overhang that bisects the window's height.";
            test2detail.testSummary = "A 1-zone, one story, simple model with exterior shading devices that act as overhangs and exterior light shelves for windows on the south façade.  Light shelves are 1” thick and split a single window instance in the BIM along its centerline.  This test is designed to ensure that this window should be represented as two windows in gbXML, the one window that is above the overhang, and the other that is below.";
            test2detail.passString  = "This test has passed.";
            test2detail.failString  = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test2detail);

            //test 3
            test3detail.testName    = "Test3";
            test3detail.shortTitle  = "Interior walls and Floor Second Level Space Boundary Test  ";
            test3detail.testSummary = "A 5-zone model with overlapping zones and a double-height zone.  This test is designed to ensure that the tool used to create the zones can properly follow the basic conventions for second level space boundaries.";
            test3detail.passString  = "This test has passed.";
            test3detail.failString  = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test3detail);

            //test 4
            test4detail.testName    = "Test4";
            test4detail.shortTitle  = "Double height space with hole cut in floor and a skylight";
            test4detail.testSummary = "This test is a large open atrium with a hole cut in the floor to allow light to penetrate through to the floor below.";
            test4detail.passString  = "This test has passed.";
            test4detail.failString  = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test4detail);

            //test 5
            test5detail.testName    = "Test5";
            test5detail.shortTitle  = "Basement walls that extend above grade and bound two different spaces";
            test5detail.testSummary = "A two zone model that ensures exterior walls can properly be defined as underground and above grade.  A single wall has been drawn by the user that begins below grade, and terminates above grade.  Above grade, the walls bound a space that is above grade.  Below grade, the walls bound a space that is entirely below grade.";
            test5detail.passString  = "This test has passed.";
            test5detail.failString  = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test5detail);

            //test 7
            test7detail.testName    = "Test7";
            test7detail.shortTitle  = "Folded roof element.";
            test7detail.testSummary = "This is the first in a proposed series of tests that focus on roof elements that grow in geometric complexity.";
            test7detail.passString  = "This test has passed.";
            test7detail.failString  = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test7detail);

            //test 8
            test8detail.testName    = "Test8";
            test8detail.shortTitle  = "Sloping slab on grade";
            test8detail.testSummary = "Ensures that sloping slab on grade comes through properly in gbXML, and that walls, which terminate at grade, are turned into the appropriate surfaceType (\"UndergroundWall\")";
            test8detail.passString  = "This test has passed.";
            test8detail.failString  = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test8detail);

            //test 25
            test25detail.testName    = "Test25";
            test25detail.shortTitle  = "Stacked interior walls with openings";
            test25detail.testSummary = "A simplified 4-zone model of a building that has interior walls stacked on top of one another.  The interior walls each have openings cut into them, to simulate something that may be drawn as a hallway by a designer.";
            test25detail.passString  = "This test has passed.";
            test25detail.failString  = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test25detail);

            //test 28
            test28detail.testName    = "Test28";
            test28detail.shortTitle  = "Roof eaves are turned into shading devices automatically";
            test28detail.testSummary = "A simplified 3-zone model of a building shaped like a residential home has been created.  The home is a simple two story example that has a small attic formed by a roof with a 30 degree pitch which slopes along one of the site’s Cartesian axes.  This test is a simple test that ensures the authoring tool is able to automatically break the roof into a space bounding object and shade object appropriately without any user intervention.";
            test28detail.passString  = "This test has passed.";
            test28detail.failString  = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(test28detail);

            //Generic Phase 2 Test
            genericphase2.testName    = "GenericPhase2";
            genericphase2.shortTitle  = "A validation tool for any gbXML geometry.";
            genericphase2.testSummary = "gbXML has recently released this validation tool for you to test any of your gbXML files.  Simply upload your gbXML file, choose the schema (most recent is 5.12) and hit the green button to generate your report, and view the results by browsing.";
            genericphase2.passString  = "This test has passed.";
            genericphase2.failString  = "This test has failed.";
            //ADD list to local testStrings List of Lists
            TestDetailList.Add(genericphase2);
        }
Esempio n. 11
0
        public void StartTest(XmlReader xmldoc, string testToRun, string username)
        {
            TestToRun = testToRun;
            globalMatchObject = new gbXMLMatches();
            globalMatchObject.Init();

            //first create a list of lists that is indexed identically to the drop down list the user selects
            TestDetail = new DOEgbXMLTestDetail();
            //then populate the list of lists.  All indexing is done "by hand" in InitializeTestResultStrings()
            TestDetail.InitializeTestResultStrings();

            //create report list reportlist will store all the test result
            ReportList = new List<DOEgbXMLReportingObj>();

            //Load an XML File for the test at hand
            gbXMLTestFile = new XmlDocument();
            gbXMLTestFile.Load(xmldoc);

            gbXMLStandardFile = new XmlDocument();
            //   gbXMLStandardFile.Load(filepaths[testToRun]);

            if (!TestFileIsAvailable())
                return;

            //Define the namespace
            XmlNamespaceManager gbXMLns1 = new XmlNamespaceManager(gbXMLTestFile.NameTable);
            gbXMLns1.AddNamespace("gbXMLv5", "http://www.gbxml.org/schema");
            XmlNamespaceManager gbXMLns2 = new XmlNamespaceManager(gbXMLStandardFile.NameTable);
            gbXMLns2.AddNamespace("gbXMLv5", "http://www.gbxml.org/schema");

            //is the test file metric or not?
            bool isMetric = false;
            XmlNodeList nodes = gbXMLTestFile.SelectNodes("/gbXMLv5:gbXML", gbXMLns1);
            foreach (XmlNode Node in nodes)
            {
                XmlAttributeCollection spaceAtts = Node.Attributes;
                foreach (XmlAttribute at in spaceAtts)
                {
                    if (at.Name == "volumeUnit")
                    {
                        string type = at.Value;
                        if (type == "CubicMeters")
                        {
                            isMetric = true;
                        }
                        else { isMetric = false; }
                    }
                    else if (at.Name == "areaUnit")
                    {
                        string type = at.Value;
                        if (type == "CubicMeters")
                        {
                            isMetric = true;
                        }
                        else { isMetric = false; }
                    }
                    else if (at.Name == "lengthUnit")
                    {
                        string type = at.Value;
                        if (type == "Meters")
                        {
                            isMetric = true;
                        }
                        else { isMetric = false; }
                    }
                }
            }

            //if isMetric is true, then we would like to convert the test file's numbers to US-IP units
            if(isMetric) gbXMLTestFile = ConvertMetricToUS(gbXMLTestFile);

            List<XmlDocument> gbXMLdocs = new List<XmlDocument>();
            gbXMLdocs.Add(gbXMLTestFile);
            gbXMLdocs.Add(gbXMLStandardFile);
            List<XmlNamespaceManager> gbXMLnsm = new List<XmlNamespaceManager>();
            gbXMLnsm.Add(gbXMLns1);
            gbXMLnsm.Add(gbXMLns2);

            //Create a Log file that logs the success or failure of each test.
            //Eventually maybe I want to create a little HTML factory
         
            output = "";
            log = "";
            table += "<div class='container'>" +
                    "<h3>" + "Test Sections" + "</h3>";
            table += "<table class='table table-bordered'>";
            table += "<tr class='info'>" +
                                   "<td>" + "Test Section Name" + "</td>" +
                                   "<td>" + "Standard Result" + "</td>" +
                                   "<td>" + "Test File Result" + "</td>" +
                                   "<td>" + "Tolerances" + "</td>" +
                                   "<td>" + "Pass/Fail" + "</td>" +
                                   "</tr>";

            string units;
            DOEgbXMLReportingObj report = new DOEgbXMLReportingObj();
            report.standResult = new List<string>();
            report.testResult = new List<string>();
            report.idList = new List<string>();
            report.MessageList = new List<string>();
            report.TestPassedDict = new Dictionary<string, bool>();

            //Set up the Global Pass/Fail criteria for the test case file
            TestCriteria = new DOEgbXMLTestCriteriaObject();
            TestCriteria.InitializeTestCriteriaWithTestName(testToRun);

            //Test 2 execute
            report.tolerance = DOEgbXMLBasics.Tolerances.AreaTolerance;
            report.testType = TestType.Building_Area;
            units = DOEgbXMLBasics.MeasurementUnits.sqft.ToString();
            report = GetBuildingArea(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Building Area Test Passed: ", report, true);

            //Test 3 execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.SpaceCountTolerance;
            report.testType = TestType.Space_Count;
            units = DOEgbXMLBasics.MeasurementUnits.spaces.ToString();
            report = GetBuildingSpaceCount(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Building Space Quantity Count Test Passed: ", report, true);


            ////Test 4 execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.LevelCountTolerance;
            report.testType = TestType.Building_Story_Count;
            units = DOEgbXMLBasics.MeasurementUnits.levels.ToString();
            report = GetBuildingStoryCount(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Building Story Count Test Passed: ", report, true);


            //Test 5 execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.LevelHeightTolerance;
            report.testType = TestType.Building_Story_Z_Height;
            units = DOEgbXMLBasics.MeasurementUnits.ft.ToString();
            report = GetStoryHeights(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Building Story Z-Height Test: ", report, true);


            //Test 6 execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.VectorAngleTolerance;
            report.testType = TestType.Building_Story_PolyLoop_RHR;
            units = "degrees";
            report = TestBuildingStoryRHR(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Building Story PolyLoop Right Hand Rule Test Result:", report, true);


            //String spShellGeometrySurfaceNum = TestShellGeomSurfaceNum(gbXMLTestFile, gbXMLns);

            //Space Tests .............................................................
            //Test 7 execute
            //only needs to test the test file
            report.Clear();
            report.testType = TestType.SpaceId_Match_Test;
            report = UniqueSpaceIdTest(gbXMLdocs, gbXMLnsm, report);
            AddToOutPut("SpaceId Match Test: ", report, true);


            //Test 8 execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.SpaceAreaTolerance;
            report.testType = TestType.Space_Area;
            units = DOEgbXMLBasics.MeasurementUnits.sqft.ToString();
            report = TestSpaceAreas(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Space Areas Test: ", report, true);


            //Test 9 execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.VolumeTolerance;
            report.testType = TestType.Space_Volume;
            units = DOEgbXMLBasics.MeasurementUnits.cubicft.ToString();
            report = TestSpaceVolumes(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Space Volumes Test: ", report, true);


            //Test 10 Execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.VectorAngleTolerance;
            report.testType = TestType.Shell_Geom_RHR;
            units = "degrees";
            report = TestShellGeomPLRHR(gbXMLdocs, gbXMLnsm, report, units);
            //AddToOutPut("Shell Geometry RHR Test: ",report);

            //Surface Element tests
            //Test 11 Execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.SurfaceCountTolerance;
            report.testType = TestType.Total_Surface_Count;
            units = "";
            report = GetSurfaceCount(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Surface Count Test Result: ", report, true);


            //Surface Element tests
            //Test 12 Execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.ExteriorWallCountTolerance;
            report.testType = TestType.Exterior_Wall_Surface_Count;
            units = "";
            report = GetEWSurfaceCount(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Exterior Wall Surface Count Test Result: ", report, true);

            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.SurfaceCountTolerance;
            report.testType = TestType.Underground_Surface_Count;
            units = "";
            report = GetUGSurfaceCount(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Underground Wall Count Test Result: ", report, true);

            //Surface Element tests
            //Test 13 Execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.InteriorWallCountTolerance;
            report.testType = TestType.Interior_Wall_Surface_Count;
            units = "";
            report = GetIWSurfaceCount(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Interior Wall Surface Count Test Result: ", report, true);

            //Surface Element tests
            //Test 13 Execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.InteriorFloorCountTolerance;
            report.testType = TestType.Interior_Floor_Surface_Count;
            units = "";
            report = GetIFSurfaceCount(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Interior Floor Surface Count Test Result: ", report, true);


            //Surface Element tests
            //Test 14 Execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.InteriorWallCountTolerance;
            report.testType = TestType.Roof_Surface_Count;
            units = "";
            report = GetRoofSurfaceCount(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Roof Surface Count Test Result: ", report, true);


            //Surface Element tests
            //Test 15 Execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.InteriorWallCountTolerance;
            report.testType = TestType.Shading_Surface_Count;
            units = "";
            report = GetShadeSurfaceCount(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Shading Surface Count Test Result: ", report, true);


            //Test 16 Execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.AirWallCountTolerance;
            report.testType = TestType.Air_Surface_Count;
            units = "";
            report = GetAirSurfaceCount(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Air Surface Count Test Result: ", report, true);


            #region surface detailed test
            //Jan 31-2012:  We may not want to perform these if the surface counts fail, but for now, we will include these tests
            //Detailed Surface Checks
            //Store Surface Element Information
            List<SurfaceDefinitions> TestSurfaces = new List<SurfaceDefinitions>();
            XmlDocument TestFile = gbXMLdocs[0];
            XmlNamespaceManager TestNSM = gbXMLnsm[0];
            List<SurfaceDefinitions> StandardSurfaces = new List<SurfaceDefinitions>();
            XmlDocument StandardFile = gbXMLdocs[1];
            XmlNamespaceManager StandardNSM = gbXMLnsm[1];
            TestSurfaces = GetFileSurfaceDefs(TestFile, TestNSM);
            StandardSurfaces = GetFileSurfaceDefs(StandardFile, StandardNSM);
            string TestSurfaceTable = " <div class='container'><table class='table table-bordered'>";
            TestSurfaceTable += "<tr class='info'>" +
                                   "<td>" + "Test Section Name" + "</td>" +
                                   "<td>" + "Stand Surface ID" + "</td>" +
                                   "<td>" + "Test Surface ID" + "</td>" +
                                   "<td>" + "Stand Surface Tilt" + "</td>" +
                                   "<td>" + "Test Surface Tilt" + "</td>" +
                                   "<td>" + "Stand Surface Azimuth" + "</td>" +
                                   "<td>" + "Test Surface Azimuth" + "</td>" +
                                    "<td>" + "Stand Surface Height" + "</td>" +
                                   "<td>" + "Test Surface Height" + "</td>" +
                                    "<td>" + "Stand Surface Width" + "</td>" +
                                   "<td>" + "Test Surface Width" + "</td>" +
                                   "<td>" + "Pass/Fail" + "</td>" +
                                   "</tr>";
            //Test Surfaces Planar Test
            //all polyloops must be such that the surface defined by the coordinates is planar
            report.Clear();
            report.testType = TestType.Surface_Planar_Test;
            report = TestSurfacePlanarTest(TestSurfaces, report);

            if (!report.passOrFail)
            {
                AddToOutPut("Test File Planar Surface Check: ", report, true);
                report.Clear();
            }
            //only run detailed surface checks if the surfaces are planar
            else
            {
                //<For each surface in the Standard File, try to find a match for this surface in the test file>
                //Written Jan 31, 2013 by Chien Si Harriman, Senior Product Manager, Carmel Software Corporation
                //Execute Tests


                //  globalMatchObject.MatchedSurfaceIds = new Dictionary<string, List<string>>();
                int i = 1;

                foreach (SurfaceDefinitions surface in StandardSurfaces)
                {
                    report.Clear();
                    //multiple tolerances used
                    report.testType = TestType.Detailed_Surface_Checks;
                    report.subTestIndex = i;

                    //multiple units used, so ignore units
                    report = GetPossibleSurfaceMatches(surface, TestSurfaces, report);

                    AddToOutPut("Test 17 for Surface number " + i + " Result: ", report, false);

                    foreach (SurfaceDefinitions ts in TestSurfaces)
                    {
                        if (globalMatchObject.MatchedSurfaceIds.ContainsKey(surface.SurfaceId))
                        {
                            foreach (string id in globalMatchObject.MatchedSurfaceIds[surface.SurfaceId])
                            {
                                if (ts.SurfaceId == id)
                                {
                                    if (report.passOrFail)
                                        TestSurfaceTable += "<tr class='success'>" +
                                            "<td>" + "<a href='TestDetailPage.aspx?type=" + (int)report.testType + "&subtype=" + report.subTestIndex + "' target='_blank'>" +
                                            "Detailed Surface Checks " + report.subTestIndex + "</a>" + "</td>" +

                                            "<td>" + surface.SurfaceId + "</td>" +
                                            "<td>" + ts.SurfaceId + "</td>" +
                                            "<td>" + String.Format("{0:#,0.00}", surface.Tilt) + "</td>" +
                                            "<td>" + String.Format("{0:#,0.00}", ts.Tilt) + "</td>" +
                                            "<td>" + String.Format("{0:#,0.00}", surface.Azimuth) + "</td>" +
                                            "<td>" + String.Format("{0:#,0.00}", ts.Azimuth) + "</td>" +
                                            "<td>" + String.Format("{0:#,0.00}", surface.Height) + "</td>" +
                                            "<td>" + String.Format("{0:#,0.00}", ts.Height) + "</td>" +
                                            "<td>" + String.Format("{0:#,0.00}", surface.Width) + "</td>" +
                                            "<td>" + String.Format("{0:#,0.00}", ts.Width) + "</td>" +
                                            "<td>" + "Pass" + "</td>" +
                                            "</tr>";
                                }

                            }

                        }
                    }
                    //if didn't find match means it failed the test
                    if (!report.passOrFail)
                        TestSurfaceTable += "<tr class='error'>" +
                                          "<td>" + "<a href='TestDetailPage.aspx?type=" + (int)report.testType + "&subtype=" + report.subTestIndex + "' target='_blank'>" +
                                          "Detailed Surface Checks " + report.subTestIndex + "</a>" + "</td>" +
                                          "<td>" + surface.SurfaceId + "</td>" +
                                          "<td>" + "---</td>" +
                                          "<td>" + String.Format("{0:#,0.00}", surface.Tilt) + "</td>" +
                                          "<td>" + "---</td>" +
                                          "<td>" + String.Format("{0:#,0.00}", surface.Azimuth) + "</td>" +
                                          "<td>" + "---</td>" +
                                          "<td>" + String.Format("{0:#,0.00}", surface.Height) + "</td>" +
                                          "<td>" + "---</td>" +
                                          "<td>" + String.Format("{0:#,0.00}", surface.Width) + "</td>" +
                                          "<td>" + "---</td>" +
                                          "<td>" + "Fail" + "</td>" +
                                          "</tr>";
                    i += 1;
                }

                TestSurfaceTable += "</table></div><br/>";
            }
            #endregion

            //test 18 CountFixedWindows
            //Test 18 Execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.FixedWindowCountTolerance;
            report.testType = TestType.Fixed_Windows_Count;
            units = "";
            report = CountFixedWindows(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Fixed Windows Count Test Result: ", report, true);

            //test 19 CountOperableWindows
            //Test 19 Execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.OperableWindowCountTolerance;
            report.testType = TestType.Operable_Windows_Count;
            units = "";
            report = CountOperableWindows(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Operable Windows Count Test Result: ", report, true);

            //test 20 CountFixedSkylights
            //Test 20 Execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.FixedSkylightCountTolerance;
            report.testType = TestType.Fixed_Skylight_Count;
            units = "";
            report = CountFixedSkylights(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Fixed Skylight Count Test Result: ", report, true);

            //test 21 CountOperableSkylights
            //Test 21 Execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.OperableSkylightCountTolerance;
            report.testType = TestType.Operable_Skylight_Count;
            units = "";
            report = CountOperableSkylights(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Operable Skylight Count Test Result: ", report, true);


            //test 22 CountSlidingDoors
            //Test 22 Execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.SlidingDoorCountTolerance;
            report.testType = TestType.Sliding_Doors_Count;
            units = "";
            report = CountSlidingDoors(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Sliding Doors Count Test Result: ", report, true);

            //test 23 CountNonSlidingDoors
            //Test 23 Execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.NonSlidingDoorCountTolerance;
            report.testType = TestType.Non_Sliding_Doors_Count;
            units = "";
            report = CountNonSlidingDoors(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Non Sliding Doors Count Test Result: ", report, true);

            //test 24 CountAirOpenings
            //Test 24 Execute
            report.Clear();
            report.tolerance = DOEgbXMLBasics.Tolerances.AirOpeningCountTolerance;
            report.testType = TestType.Air_Openings_Count;
            units = "";
            report = CountAirOpenings(gbXMLdocs, gbXMLnsm, report, units);
            AddToOutPut("Air Openings Count Test Result: ", report, true);


            #region opending detailed test
            //openings detailed tests
            List<OpeningDefinitions> TestOpenings = new List<OpeningDefinitions>();
            XmlDocument testFile = gbXMLdocs[0];
            XmlNamespaceManager testNSM = gbXMLnsm[0];
            List<OpeningDefinitions> StandardOpenings = new List<OpeningDefinitions>();
            XmlDocument standardFile = gbXMLdocs[1];
            XmlNamespaceManager standardNSM = gbXMLnsm[1];
            TestOpenings = GetFileOpeningDefs(TestFile, TestNSM);
            StandardOpenings = GetFileOpeningDefs(StandardFile, StandardNSM);

            string TestOpeningTable = "";
            report.Clear();
            report.testType = TestType.Opening_Planar_Test;
            report = TestOpeningPlanarTest(TestOpenings, report);

            if (!report.passOrFail)
            {
                AddToOutPut("Test File Planar Opening Check: ", report, true);
                report.Clear();
            }
            //only run detailed opening checks if the opening are planar
            else
            {
                TestOpeningTable = "<div class='container'><table class='table table-bordered'>";
                TestOpeningTable += "<tr class='info'>" +
                                       "<td>" + "Test Section Name" + "</td>" +
                                        "<td>" + "Standard Opening Id" + "</td>" +
                                        "<td>" + "Test Opening Id" + "</td>" +
                                        "<td>" + "Standard Parent Surface Id" + "</td>" +
                                        "<td>" + "Test Parent Surface Id" + "</td>" +
                                        "<td>" + "Standard Parent Azimuth" + "</td>" +
                                        "<td>" + "Test Parent Azimuth" + "</td>" +
                                        "<td>" + "Standard Parent Tilt" + "</td>" +
                                        "<td>" + "Test Parent Tilt" + "</td>" +
                                        "<td>" + "Standard Surface Area" + "</td>" +
                                        "<td>" + "Test Surface Area" + "</td>" +
                                        "<td>" + "Pass/Fail" + "</td>" +
                                       "</tr>";

                globalMatchObject.MatchedOpeningIds = new Dictionary<string, List<string>>();
                int i = 1;
                //if no openings remove the table.
                if (StandardOpenings.Count < 1)
                    TestOpeningTable = "";
                //compare the openings
                foreach (OpeningDefinitions opening in StandardOpenings)
                {
                    report.Clear();

                    report.testType = TestType.Detailed_Opening_Checks;
                    report.subTestIndex = i;

                    report = GetPossibleOpeningMatches(opening, TestOpenings, report);

                    AddToOutPut("Test 17 for Opening number " + i + " Result: ", report, false);

                    foreach (OpeningDefinitions to in TestOpenings)
                    {
                        if (globalMatchObject.MatchedOpeningIds.ContainsKey(opening.OpeningId))
                        {
                            foreach (string id in globalMatchObject.MatchedOpeningIds[opening.OpeningId])
                            {
                                if (to.OpeningId == id)
                                {
                                    if (report.passOrFail)
                                        TestOpeningTable += "<tr class='success'>" +
                                            "<td>" + "<a href='TestDetailPage.aspx?type=" + (int)report.testType + "&subtype=" + report.subTestIndex + "' target='_blank'>" +
                                            "Detailed Opening Checks " + report.subTestIndex + "</a>" + "</td>" +
                                           "<td>" + opening.OpeningId + "</td>" +
                                            "<td>" + to.OpeningId + "</td>" +
                                            "<td>" + opening.ParentSurfaceId + "</td>" +
                                            "<td>" + to.ParentSurfaceId + "</td>" +
                                            "<td>" + String.Format("{0:#,0.00}", opening.ParentAzimuth) + "</td>" +
                                            "<td>" + String.Format("{0:#,0.00}", to.ParentAzimuth) + "</td>" +
                                            "<td>" + String.Format("{0:#,0.00}", opening.ParentTilt) + "</td>" +
                                            "<td>" + String.Format("{0:#,0.00}", to.ParentTilt) + "</td>" +
                                            "<td>" + String.Format("{0:#,0.00}", opening.surfaceArea) + "</td>" +
                                            "<td>" + String.Format("{0:#,0.00}", to.surfaceArea) + "</td>" +
                                            "<td>" + "Pass" + "</td>" +
                                            "</tr>";
                                }

                            }

                        }
                    }
                    //if didn't find match means it failed the test
                    if (!report.passOrFail)
                        TestOpeningTable += "<tr class='error'>" +
                                          "<td>" + "<a href='TestDetailPage.aspx?type=" + (int)report.testType + "&subtype=" + report.subTestIndex + "' target='_blank'>" +
                                          "Detailed Opening Checks " + report.subTestIndex + "</a>" + "</td>" +
                                          "<td>" + opening.OpeningId + "</td>" +
                                          "<td>" + "---" + "</td>" +
                                            "<td>" + opening.ParentSurfaceId + "</td>" +
                                            "<td>" + "---" + "</td>" +
                                            "<td>" + String.Format("{0:#,0.00}", opening.ParentAzimuth) + "</td>" +
                                            "<td>" + "---" + "</td>" +
                                             "<td>" + String.Format("{0:#,0.00}", opening.ParentTilt) + "</td>" +
                                            "<td>" + "---" + "</td>" +
                                             "<td>" + String.Format("{0:#,0.00}", opening.surfaceArea) + "</td>" +
                                            "<td>" + "---" + "</td>" +
                                          "<td>" + "Fail" + "</td>" +
                                          "</tr>";
                    i += 1;

                }
            }
            TestOpeningTable += "</table></div><br/>";
            #endregion

            //close table
            table += "</table></div><br/>";
            //add TestSurfaceTable
            table += TestSurfaceTable + TestOpeningTable;

            CreateSummaryTable();

        }
Esempio n. 12
0
        private void ProcessValidXML(XMLParser parser, XmlReader xmlreader2)
        {
            // Phase 2 Testing
            XmlDocument myxml = new XmlDocument();
            myxml.Load(xmlreader2);
            //3-get the namespace
            XmlNamespaceManager nsm = parser.getnsmanager(myxml);
            //figure out if metric or USIP (we have not found a reason to use this yet)
            parser.getunits(nsm, myxml);

            /* Begin Parsing the XML and reporting on it----------------------------------------------------------*/

            //make a reporting object
            DOEgbXMLPhase2Report report = new DOEgbXMLPhase2Report();

            /* Basic Uniqueness Constraints check-------------------------------------------------*/

            //Basic requirements check

            // Setup the results view for the log and web.
            log = "";
            TestResultPanel.Controls.Add(new LiteralControl("<div class='well-lg'><h3>Test Sections</h3><table class='table table-bordered'><tr class='info'><td>Test Section Name</td><td>Tolerances</td><td>Pass/Fail</td></tr>"));

            //first create a list of lists that is indexed identically to the drop down list the user selects
            TestDetail = new DOEgbXMLTestDetail();
            //then populate the list of lists.  All indexing is done "by hand" in InitializeTestResultStrings()
            TestDetail.InitializeTestResultStrings();                        //Set up the Global Pass/Fail criteria for the test case file
            TestCriteria = new DOEgbXMLTestCriteriaObject();
            TestCriteria.InitializeTestCriteriaWithTestName(TestToRun); // ("Test1");

            // Reports
            //ensure that all names of spaces are unique--------------------------------------------------------------------------------------------------------Unique_Space_ID_Test//
            report.testType = TestType.Unique_Space_ID_Test;
            report = DOEgbXML.gbXMLSpaces.UniqueSpaceIdTest2(myxml, nsm, report);
            ProcessReport(report, true);
            report.Clear();

            //ensure that all space boundary names are unique--------------------------------------------------------------------------------------------------Unique_Space_Boundary//
            XmlNodeList nodes = myxml.SelectNodes("/gbXMLv5:gbXML/gbXMLv5:Campus/gbXMLv5:Building/gbXMLv5:Space/gbXMLv5:SpaceBoundary", nsm);
            if (nodes.Count > 0)
            {
                spaceBoundsPresent = true;
                report.testType = TestType.Unique_Space_Boundary;
                report = DOEgbXML.gbXMLSpaces.UniqueSpaceBoundaryIdTest2(myxml, nsm, report);
                ProcessReport(report, true);
                report.Clear();
            }
            else
            {
                //needs to be included so the report can be processed
                report.testType = TestType.Unique_Space_Boundary;
                report.passOrFail = true;
                report.longMsg = "A test is usually performed here to ensure Space Boundaries have valid naming conventions.  This test was skipped (legally) because your file does not have space boundaries present.  Continuing to next test.";
                ProcessReport(report, true);
                report.Clear();
            }

            //Space Tests
            //make a simplified representation of the spaces
            List<DOEgbXML.gbXMLSpaces> spaces = DOEgbXML.gbXMLSpaces.getSimpleSpaces(myxml, nsm);

            //4-check for self-intersecting polygons
            //report = DOEgbXML.gbXMLSpaces.SpaceSurfacesSelfIntersectionTest(spaces, report);
            //report.Clear();

            //check that all polyloops are in a counterclockwise direction-----------------------------------------------------------------------------------------Space_Surfaces_CC//
            report = DOEgbXML.gbXMLSpaces.SpaceSurfacesCCTest2(spaces, report);
            report.testType = TestType.Space_Surfaces_CC;
            ProcessReport(report, true);
            report.Clear();

            //check for non-planar objects for all Spaces' polyloops-------------------------------------------------------------------------------------------Space_Surfaces_Planar//
            report.coordtol = DOEgbXMLBasics.Tolerances.VectorAngleTolerance;
            report = DOEgbXML.gbXMLSpaces.SpaceSurfacesPlanarTest(spaces, report);
            report.testType = TestType.Space_Surfaces_Planar;
            ProcessReport(report, true);
            report.Clear();

            //valid space enclosure?---------------------------------------------------------------------------------------------------------------------------Check_Space_Enclosure//
            report.tolerance = 0.0001;
            //when we are comparing angles in this function, we are testing the angle between dot products
            report.vectorangletol = DOEgbXMLBasics.Tolerances.dotproducttol;
            report.lengthtol = DOEgbXMLBasics.Tolerances.lengthTolerance;
            //toler
            report.coordtol = DOEgbXMLBasics.Tolerances.coordToleranceIP;
            report = Validator.CheckSpaceEnclosureSG(spaces, report);
            report.testType = TestType.Check_Space_Enclosure;
            ProcessReport(report, true);
            report.Clear();

            /* Surface tests----------------------------------------------------------------------------------*/
            /* Basic Requirements ----------------------------------------------------------------------------*/

            //Are there at least 4 surface definitions?  (see the surface requirements at the campus node)-------------------------------------------------------At_Least_4_Surfaces//
            report.testType = TestType.At_Least_4_Surfaces;
            report = SurfaceDefinitions.AtLeast4Surfaces(myxml, nsm, report);
            ProcessReport(report, true);
            report.Clear();

            //Does the AdjacentSpaceId not exceed the max number allowable?-----------------------------------------------------------------------------------------Two_Adj_Space_Id//
            //this needs to be updated!
            report.testType = TestType.Two_Adj_Space_Id;
            report = SurfaceDefinitions.AtMost2SpaceAdjId(myxml, nsm, report);
            ProcessReport(report, true);
            report.Clear();

            //Are all required elements and attributes in place?---------------------------------------------------------------------------------------------Required_Surface_Fields//
            //report.testType = TestType.Required_Surface_Fields;
            //report = SurfaceDefinitions.RequiredSurfaceFields(myxml, nsm, report);
            //ProcessReport(report, true);
            //report.Clear();

            //ensure that all names of surfaces are unique------------------------------------------------------------------------------------------------------Surface_ID_Uniqueness//
            report.testType = TestType.Surface_ID_Uniqueness;
            report = DOEgbXML.SurfaceDefinitions.SurfaceIDUniquenessTest(myxml, nsm, report);
            ProcessReport(report, true);
            report.Clear();

            //now grab all the surfaceIds and make them available------------------------------------------------------------------------------------------------Surface_Adj_Id_Match//
            List<string> spaceIds = new List<string>();
            foreach (gbXMLSpaces s in spaces)
            {
                spaceIds.Add(s.id);
            }

            List<SurfaceDefinitions> surfaces = DOEgbXML.XMLParser.MakeSurfaceList(myxml, nsm);
            //make sure the surface Adjacent space Id names match only the the space Ids gathered above.  The adjacent space Ids can't have their own special values
            report.testType = TestType.Surface_Adj_Id_Match;
            report = DOEgbXML.SurfaceDefinitions.SurfaceAdjSpaceIdTest(spaceIds, surfaces, report);
            ProcessReport(report, true);
            report.Clear();

            //Surface_ID_SB_Match------------------------------------------------------------------------------------------------------------------------------Surface_ID_SB_Match//
            if (spaceBoundsPresent)
            {
                report.tolerance = DOEgbXMLBasics.Tolerances.coordToleranceIP;
                report.testType = TestType.Surface_ID_SB_Match;
                report = SurfaceDefinitions.SurfaceMatchesSpaceBoundary(myxml, nsm, report);
                ProcessReport(report, true);
                report.Clear();
            }
            else
            {
                report.testType = TestType.Surface_ID_SB_Match;
                report.passOrFail = true;
                report.longMsg = "A test is usually performed here to ensure Space Boundaries and Surfaces share the same ID.  This test was skipped (legally) because your file does not have space boundaries present.  Continuing to next test.";
                ProcessReport(report, true);
                report.Clear();
            }

            //Does the polyloop right hand rule vector form the proper azimuth and tilt? (with and without a CADModelAzimuth)----------------------------------Surface_Tilt_Az_Check//
            report.tolerance = DOEgbXMLBasics.Tolerances.VectorAngleTolerance;
            report.vectorangletol = DOEgbXMLBasics.Tolerances.VectorAngleTolerance;
            report.testType = TestType.Surface_Tilt_Az_Check;
            report = SurfaceDefinitions.SurfaceTiltAndAzCheck(myxml, nsm, report);
            ProcessReport(report, true);
            report.Clear();

            //planar surface test-------------------------------------------------------------------------------------------------------------------------------Surface_Planar_Test//
            report.vectorangletol = DOEgbXMLBasics.Tolerances.VectorAngleTolerance;
            report = SurfaceDefinitions.TestSurfacePlanarTest(surfaces, report);
            report.testType = TestType.Surface_Planar_Test;
            ProcessReport(report, true);
            report.Clear();

            //I must take the surfaces, group them, and rearrange any interior surfaces' coordinates that should be pointed the opposite way
            string searchpath = "/gbXMLv5:gbXML/gbXMLv5:Campus/gbXMLv5:Building/gbXMLv5:Space";
            List<string> spaceids = DOEgbXML.gbXMLSpaces.getSpaceIds(myxml, nsm, searchpath);
            Dictionary<string, List<SurfaceDefinitions>> enclosure = new Dictionary<string, List<SurfaceDefinitions>>();
            foreach (string id in spaceids)
            {
                //find all surfaces with this adjacent space id, get their polyloops, and then match their polyloops
                List<SurfaceDefinitions> surflist = new List<SurfaceDefinitions>();

                foreach (SurfaceDefinitions surf in surfaces)
                {
                    foreach (var adj in surf.AdjSpaceId)
                    {
                        if (adj == id)
                        {
                            surflist.Add(surf);
                            //don't want to add surfaces twice (slab on grade)
                            break;
                        }
                    }
                }
                enclosure[id] = surflist;
            }

            //counter clockwise winding test-------------------------------------------------------------------------------------------------------------------------Surface_CC_Test//
            report.testType = TestType.Surface_CC_Test;
            report = SurfaceDefinitions.SurfaceCCTest(enclosure, report);
            ProcessReport(report, true);
            report.Clear();

            //self intersecting polygon test
            //report = SurfaceDefinitions.SurfaceSelfIntersectionTest(surfaces, report);
            //report.Clear();

            //Is the Lower Left Corner properly defined?

            //surface enclosure tests------------------------------------------------------------------------------------------------------------------------Check_Surface_Enclosure//
            report.tolerance = 0.0001;
            report.vectorangletol = DOEgbXMLBasics.Tolerances.dotproducttol;
            report.lengthtol = DOEgbXMLBasics.Tolerances.lengthTolerance;
            report.coordtol = .01;
            report.testType = TestType.Check_Surface_Enclosure;
            report = Validator.CheckSurfaceEnclosure(enclosure, report);
            ProcessReport(report, true);
            report.Clear();

            TestResultPanel.Controls.Add(new LiteralControl("</table></div>"));
            CreateSummaryTable();
        }
Esempio n. 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //create testlist for creating dropdown list iteams dynamically
            DOEgbXMLTestDetail testList = new DOEgbXMLTestDetail();
            testList.InitializeTestResultStrings();

            //create dropdownlist items base on the tests
            if (DropDownList1 != null)
            {
                string selectedValue = DropDownList1.SelectedValue;

                //clear all iteam
                DropDownList1.Items.Clear();

                foreach (DOEgbXMLTestDetail detail in testList.TestDetailList)
                    //if test is the one selected before select it
                    if (detail.testName == selectedValue)
                    {
                        DropDownList1.Items.Add(new ListItem(detail.testName, detail.testName, true));
                        DropDownList1.SelectedValue = selectedValue;
                    }
                    else
                        DropDownList1.Items.Add(new ListItem(detail.testName, detail.testName));
            }

            if (DropDownList2 != null)
            {
                string selectedValue = DropDownList2.SelectedValue;

                //clear all iteam
                DropDownList2.Items.Clear();
                //get all of the available XSDs
                var root = AppDomain.CurrentDomain.BaseDirectory;
                var path = root + "SupportFiles//XSD";
                string[] files = Directory.GetFiles(path, "*.xsd");
                for(int i = 0; i < files.Length; i++)
                    files[i] = Path.GetFileName(files[i]);


                foreach (string file in files)
                    //if test is the one selected before select it
                    if (file == selectedValue)
                    {
                        DropDownList2.Items.Add(new ListItem(file, file, true));
                        DropDownList2.SelectedValue = selectedValue;
                    }
                    else
                        DropDownList2.Items.Add(new ListItem(file, file));
            }

            if (TestSummuryLabel != null)
            {
                //show the test summary of the selected test
                foreach (DOEgbXMLTestDetail detail in testList.TestDetailList)
                    if (detail.testName == DropDownList1.SelectedValue)
                    {
                        TestSummuryLabel.Text = detail.testSummary;
                        break;
                    }
            }
        }