public XmlTest Create(XmlTestInfo testInfo, double tolerance) { XmlTest xmlTest = new XmlTest(testInfo.GetValue("desc"), testInfo.IsDefaultTarget(), tolerance, _geometryOperation, _resultMatcher); // Handle test type or name. string strTestType = testInfo.GetValue("name"); if (string.IsNullOrEmpty(strTestType)) return null; ParseType(strTestType, xmlTest); // Handle the Geometry A: string wkt = testInfo.GetValue("a"); if (!string.IsNullOrEmpty(wkt)) ParseGeometry(Target.A, wkt, xmlTest); // Handle the Geometry B: wkt = testInfo.GetValue("b"); if (!string.IsNullOrEmpty(wkt)) ParseGeometry(Target.B, wkt, xmlTest); string arg2 = testInfo.GetValue("arg2"); if (!string.IsNullOrEmpty(arg2)) { if (arg2 == "a" || arg2 == "A") xmlTest.Argument1 = xmlTest.A; else if (arg2 == "b" || arg2 == "B") xmlTest.Argument1 = xmlTest.B; else xmlTest.Argument1 = arg2; } string arg3 = testInfo.GetValue("arg3"); if (!string.IsNullOrEmpty(arg3)) xmlTest.Argument2 = arg3; string strResult = testInfo.GetValue("result"); if (string.IsNullOrEmpty(strResult)) return null; ParseResult(strResult, xmlTest); return xmlTest; }
public XmlTest Create(XmlTestInfo testInfo, double tolerance) { XmlTest xmlTest = new XmlTest(testInfo.GetValue("desc"), testInfo.IsDefaultTarget(), tolerance); // Handle test type or name. string strTestType = testInfo.GetValue("name"); if (strTestType == null || strTestType.Length == 0) return null; ParseType(strTestType, xmlTest); // Handle the Geometry A: string wktA = testInfo.GetValue("a"); if (wktA != null && wktA.Length > 0) ParseGeometry(Target.A, wktA, xmlTest); // Handle the Geometry B: string wktB = testInfo.GetValue("b"); if (wktB != null && wktB.Length > 0) ParseGeometry(Target.B, wktB, xmlTest); // Handle the arguments string arg2 = testInfo.GetValue("arg2"); if (arg2 != null && arg2.Length > 0) { if (arg2 == "a") xmlTest.Argument1 = xmlTest.A; else if (arg2 == "b") xmlTest.Argument1 = xmlTest.B; } string arg3 = testInfo.GetValue("arg3"); if (arg3 != null && arg3.Length > 0) xmlTest.Argument2 = arg3; string strResult = testInfo.GetValue("result"); if (strResult == null || strResult.Length == 0) return null; ParseResult(strResult, xmlTest); return xmlTest; }
public XmlTest Create(XmlTestInfo testInfo, double tolerance) { XmlTest xmlTest = new XmlTest(testInfo.GetValue("desc"), testInfo.IsDefaultTarget(), tolerance); // Handle test type or name. string strTestType = testInfo.GetValue("name"); if (strTestType == null || strTestType.Length == 0) { return(null); } ParseType(strTestType, xmlTest); // Handle the Geometry A: string wktA = testInfo.GetValue("a"); if (wktA != null && wktA.Length > 0) { ParseGeometry(Target.A, wktA, xmlTest); } // Handle the Geometry B: string wktB = testInfo.GetValue("b"); if (wktB != null && wktB.Length > 0) { ParseGeometry(Target.B, wktB, xmlTest); } // Handle the arguments string arg2 = testInfo.GetValue("arg2"); if (arg2 != null && arg2.Length > 0) { if (arg2 == "a") { xmlTest.Argument1 = xmlTest.A; } else if (arg2 == "b") { xmlTest.Argument1 = xmlTest.B; } } string arg3 = testInfo.GetValue("arg3"); if (arg3 != null && arg3.Length > 0) { xmlTest.Argument2 = arg3; } string strResult = testInfo.GetValue("result"); if (strResult == null || strResult.Length == 0) { return(null); } ParseResult(strResult, xmlTest); return(xmlTest); }
private void ParseCaseNode(XmlNode caseNode, double tolerance) { if (caseNode != null && m_objFactory != null) { XmlTestInfo testInfo = new XmlTestInfo(true); XmlNode desc = caseNode["desc"]; if (desc != null) { testInfo.SetValue("desc", desc.InnerText); } XmlElement a = (XmlElement)caseNode["a"]; if (a != null) { if (a.HasAttribute("file")) { } else { testInfo.SetValue("a", a.InnerText); } } XmlElement b = (XmlElement)caseNode["b"]; if (b != null) { if (b.HasAttribute("file")) { } else { testInfo.SetValue("b", b.InnerText); } } // Now, handle the "test" nodes XmlNodeList elemList = caseNode.SelectNodes("test"); if (elemList == null) return; if (elemList.Count <= 0) { return; } else if (elemList.Count == 1) { XmlElement testElement = ((XmlElement)elemList[0])["op"]; testInfo.SetValue("result", testElement.InnerText); if (testElement.HasAttribute("name")) { testInfo.SetValue("name", testElement.GetAttribute("name")); } if (testElement.HasAttribute("arg1")) { testInfo.SetValue("arg1", testElement.GetAttribute("arg1").ToLower()); } if (testElement.HasAttribute("arg2")) { testInfo.SetValue("arg2", testElement.GetAttribute("arg2").ToLower()); } if (testElement.HasAttribute("arg3")) { testInfo.SetValue("arg3", testElement.GetAttribute("arg3")); } XmlTest xmlTest = m_objFactory.Create(testInfo, tolerance); if (xmlTest != null && m_listCurTests != null) { m_listCurTests.Add(xmlTest); } } else { string baseDesc = testInfo.GetValue("desc"); for (int i = 0; i < elemList.Count; i++) { string strDescNew = baseDesc + " - " + (i + 1).ToString(); testInfo.SetValue("desc", strDescNew); XmlElement testElement = ((XmlElement)elemList[i])["op"]; testInfo.SetValue("result", testElement.InnerText); if (testElement.HasAttribute("name")) { testInfo.SetValue("name", testElement.GetAttribute("name")); } if (testElement.HasAttribute("arg1")) { testInfo.SetValue("arg1", testElement.GetAttribute("arg1")); } if (testElement.HasAttribute("arg2")) { testInfo.SetValue("arg2", testElement.GetAttribute("arg2")); } if (testElement.HasAttribute("arg3")) { testInfo.SetValue("arg3", testElement.GetAttribute("arg3")); } XmlTest xmlTest = m_objFactory.Create(testInfo, tolerance); if (xmlTest != null && m_listCurTests != null) { m_listCurTests.Add(xmlTest); } } } testInfo.Clear(); } }
private void ParseCaseNode(XmlNode caseNode, double tolerance) { if (caseNode != null && m_objFactory != null) { var testInfo = new XmlTestInfo(true); XmlNode desc = caseNode["desc"]; if (desc != null) { testInfo.SetValue("desc", desc.InnerText); } var a = (XmlElement)caseNode["a"]; if (a != null) { if (a.HasAttribute("file")) { } else { testInfo.SetValue("a", a.InnerText); } } var b = (XmlElement)caseNode["b"]; if (b != null) { if (b.HasAttribute("file")) { } else { testInfo.SetValue("b", b.InnerText); } } // Now, handle the "test" nodes var elemList = caseNode.SelectNodes("test"); if (elemList == null) { return; } if (elemList.Count <= 0) { return; } else if (elemList.Count == 1) { var testElement = ((XmlElement)elemList[0])["op"]; testInfo.SetValue("result", testElement.InnerText); if (testElement.HasAttribute("name")) { testInfo.SetValue("name", testElement.GetAttribute("name")); } if (testElement.HasAttribute("arg1")) { testInfo.SetValue("arg1", testElement.GetAttribute("arg1").ToLower()); } if (testElement.HasAttribute("arg2")) { testInfo.SetValue("arg2", testElement.GetAttribute("arg2").ToLower()); } if (testElement.HasAttribute("arg3")) { testInfo.SetValue("arg3", testElement.GetAttribute("arg3")); } var xmlTest = m_objFactory.Create(testInfo, tolerance); if (xmlTest != null && m_listCurTests != null) { m_listCurTests.Add(xmlTest); } } else { string baseDesc = testInfo.GetValue("desc"); for (int i = 0; i < elemList.Count; i++) { string strDescNew = baseDesc + " - " + (i + 1).ToString(); testInfo.SetValue("desc", strDescNew); var testElement = ((XmlElement)elemList[i])["op"]; testInfo.SetValue("result", testElement.InnerText); if (testElement.HasAttribute("name")) { testInfo.SetValue("name", testElement.GetAttribute("name")); } if (testElement.HasAttribute("arg1")) { testInfo.SetValue("arg1", testElement.GetAttribute("arg1")); } if (testElement.HasAttribute("arg2")) { testInfo.SetValue("arg2", testElement.GetAttribute("arg2")); } if (testElement.HasAttribute("arg3")) { testInfo.SetValue("arg3", testElement.GetAttribute("arg3")); } var xmlTest = m_objFactory.Create(testInfo, tolerance); if (xmlTest != null && m_listCurTests != null) { m_listCurTests.Add(xmlTest); } } } testInfo.Clear(); } }
public XmlTest Create(XmlTestInfo testInfo, double tolerance) { XmlTest xmlTest = new XmlTest(testInfo.GetValue("desc"), testInfo.IsDefaultTarget(), tolerance, _geometryOperation, _resultMatcher); // Handle test type or name. string strTestType = testInfo.GetValue("name"); if (string.IsNullOrEmpty(strTestType)) { return(null); } ParseType(strTestType, xmlTest); // Handle the Geometry A: string wkt = testInfo.GetValue("a"); if (!string.IsNullOrEmpty(wkt)) { ParseGeometry(Target.A, wkt, xmlTest); } // Handle the Geometry B: wkt = testInfo.GetValue("b"); if (!string.IsNullOrEmpty(wkt)) { ParseGeometry(Target.B, wkt, xmlTest); } string arg2 = testInfo.GetValue("arg2"); if (!string.IsNullOrEmpty(arg2)) { if (arg2 == "a" || arg2 == "A") { xmlTest.Argument1 = xmlTest.A; } else if (arg2 == "b" || arg2 == "B") { xmlTest.Argument1 = xmlTest.B; } else { xmlTest.Argument1 = arg2; } } string arg3 = testInfo.GetValue("arg3"); if (!string.IsNullOrEmpty(arg3)) { xmlTest.Argument2 = arg3; } string strResult = testInfo.GetValue("result"); if (string.IsNullOrEmpty(strResult)) { return(null); } ParseResult(strResult, xmlTest); return(xmlTest); }