public void ResetTests() { if (m_listarrTests != null) { m_listarrTests.Clear(); } if (m_listCurTests != null) { m_listCurTests.Clear(); m_listCurTests = null; } m_strTestWorkspace = null; m_objFactory = null; }
public bool RunFile(int index) { if (m_listFileNames != null && m_listFileNames.Count > 0) { if (index >= 0 && index < m_listFileNames.Count) { string fileName = m_listFileNames[index]; if (m_objCurrentDoc != null && m_objCurrentDoc.LoadFile(fileName)) { XmlTestCollection listTests = m_objCurrentDoc.CurrentTests; if (listTests != null && listTests.Count > 0) { return(listTests.RunTests()); } } } } return(false); }
public bool LoadFile(string fileName) { if (!File.Exists(fileName)) { throw new ArgumentException(fileName, "The file does not exits or the 'fileName' is not valid."); } try { XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(fileName); XmlElement root = xmldoc.DocumentElement; // Retrieve the "desc" tag, if any. XmlNode desc = root["desc"]; string strTestDescription = String.Empty; if (desc != null && desc.InnerText.Length > 0) { strTestDescription = desc.InnerText; } else { strTestDescription = Path.GetFileNameWithoutExtension(fileName); } // Retrieve the "workspace", if any. XmlNode workspace = root["workspace"]; if (workspace != null) { XmlAttributeCollection workspaceAttributes = workspace.Attributes; if (workspaceAttributes != null && workspaceAttributes.Count > 0) { m_strTestWorkspace = workspaceAttributes["dir"].InnerText; } } // Retrieve the "tolerance" attribute, if any. XmlNode tolerance = root["tolerance"]; double dTolerance = 0.0; if (tolerance != null) { string strTolerance = tolerance.InnerText; try { dTolerance = Double.Parse(strTolerance, GetNumberFormatInfo()); } catch (Exception ex) { XmlTestExceptionManager.Publish(ex); } } // Retrieve the precisionName" tag, if any. PrecisionModel pm = null; XmlNode precision = root["precisionModel"]; if (precision != null) { XmlAttributeCollection precisionAttributes = precision.Attributes; if (precisionAttributes != null && precisionAttributes.Count > 0) { XmlAttribute attribute = precisionAttributes["type"]; if (attribute != null) { string strPrecision = attribute.InnerText; if (strPrecision == "FIXED" && precisionAttributes.Count == 4) { try { double scale = Double.Parse(precisionAttributes["scale"].InnerText, GetNumberFormatInfo()); double offsetx = Double.Parse(precisionAttributes["offsetx"].InnerText, GetNumberFormatInfo()); double offsety = Double.Parse(precisionAttributes["offsety"].InnerText, GetNumberFormatInfo()); pm = new PrecisionModel(scale); } catch (Exception ex) { XmlTestExceptionManager.Publish(ex); } } else { pm = new PrecisionModel(); } } else { if (precisionAttributes.Count == 3) { double scale = Double.Parse(precisionAttributes["scale"].InnerText, GetNumberFormatInfo()); double offsetx = Double.Parse(precisionAttributes["offsetx"].InnerText, GetNumberFormatInfo()); double offsety = Double.Parse(precisionAttributes["offsety"].InnerText, GetNumberFormatInfo()); pm = new PrecisionModel(scale); } } } } if (pm == null) { pm = new PrecisionModel(); } IGeometryOperation geometryOperation = null; XmlNode go = root["geometryOperation"]; if (go != null) { go = go.FirstChild; switch (go.Value) { case "com.vividsolutions.jtstest.geomop.PreparedGeometryOperation": geometryOperation = new PreparedGeometryOperation(); break; case "com.vividsolutions.jtstest.geomop.BufferValidatedGeometryOperation": geometryOperation = new BufferValidatedGeometryOperation(); break; case "com.vividsolutions.jtstest.geomop.OverlayValidatedGeometryOperation": geometryOperation = new OverlayValidatedGeometryOperation(); break; default: Console.WriteLine(string.Format("\n *** {0} *** \n", go.Value)); Console.ReadKey(true); geometryOperation = new GeometryMethodOperation(); break; } } IResultMatcher resultMatcher = null; XmlNode rm = root["resultMatcher"]; if (rm != null) { rm = rm.FirstChild; if (rm.Value.EndsWith("BufferResultMatcher", StringComparison.InvariantCultureIgnoreCase)) resultMatcher = new BufferResultMatcher(); else { throw new NotSupportedException(); } } m_objFactory = new XmlTestFactory(pm, geometryOperation, resultMatcher); m_listCurTests = new XmlTestCollection(); m_listCurTests.Name = strTestDescription; // Now, handle the "case" nodes XmlNodeList elemList = xmldoc.GetElementsByTagName("case"); for (int i = 0; i < elemList.Count; i++) { ParseCaseNode(elemList[i], dTolerance); } m_listarrTests.Add(m_listCurTests); return true; } catch (Exception ex) { XmlTestExceptionManager.Publish(ex); return false; } }
public bool LoadFile(string fileName) { if (!File.Exists(fileName)) { throw new ArgumentException(fileName, "The file does not exits or the 'fileName' is not valid."); } try { XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(fileName); XmlElement root = xmldoc.DocumentElement; // Retrieve the "desc" tag, if any. XmlNode desc = root["desc"]; string strTestDescription = String.Empty; if (desc != null && desc.InnerText.Length > 0) { strTestDescription = desc.InnerText; } else { strTestDescription = Path.GetFileNameWithoutExtension(fileName); } // Retrieve the "workspace", if any. XmlNode workspace = root["workspace"]; if (workspace != null) { XmlAttributeCollection workspaceAttributes = workspace.Attributes; if (workspaceAttributes != null && workspaceAttributes.Count > 0) { m_strTestWorkspace = workspaceAttributes["dir"].InnerText; } } // Retrieve the "tolerance" attribute, if any. XmlNode tolerance = root["tolerance"]; double dTolerance = 0.0; if (tolerance != null) { string strTolerance = tolerance.InnerText; try { dTolerance = Double.Parse(strTolerance, GetNumberFormatInfo()); } catch (Exception ex) { XmlTestExceptionManager.Publish(ex); } } // Retrieve the precisionName" tag, if any. PrecisionModel pm = null; XmlNode precision = root["precisionModel"]; if (precision != null) { XmlAttributeCollection precisionAttributes = precision.Attributes; if (precisionAttributes != null && precisionAttributes.Count > 0) { XmlAttribute attribute = precisionAttributes["type"]; if (attribute != null) { string strPrecision = attribute.InnerText; if (strPrecision == "FIXED" && precisionAttributes.Count == 4) { try { double scale = Double.Parse(precisionAttributes["scale"].InnerText, GetNumberFormatInfo()); double offsetx = Double.Parse(precisionAttributes["offsetx"].InnerText, GetNumberFormatInfo()); double offsety = Double.Parse(precisionAttributes["offsety"].InnerText, GetNumberFormatInfo()); pm = new PrecisionModel(scale); } catch (Exception ex) { XmlTestExceptionManager.Publish(ex); } } else { pm = new PrecisionModel(); } } else { if (precisionAttributes.Count == 3) { double scale = Double.Parse(precisionAttributes["scale"].InnerText, GetNumberFormatInfo()); double offsetx = Double.Parse(precisionAttributes["offsetx"].InnerText, GetNumberFormatInfo()); double offsety = Double.Parse(precisionAttributes["offsety"].InnerText, GetNumberFormatInfo()); pm = new PrecisionModel(scale); } } } } if (pm == null) { pm = new PrecisionModel(); } m_objFactory = new XmlTestFactory(pm); m_listCurTests = new XmlTestCollection(); m_listCurTests.Name = strTestDescription; // Now, handle the "case" nodes XmlNodeList elemList = xmldoc.GetElementsByTagName("case"); for (int i = 0; i < elemList.Count; i++) { ParseCaseNode(elemList[i], dTolerance); } m_listarrTests.Add(m_listCurTests); return true; } catch (Exception ex) { XmlTestExceptionManager.Publish(ex); return false; } }
public bool LoadFile(string fileName) { if (!File.Exists(fileName)) { throw new ArgumentException(fileName, "The file does not exits or the 'fileName' is not valid."); } try { var xmldoc = new XmlDocument(); xmldoc.Load(fileName); var root = xmldoc.DocumentElement; // Retrieve the "desc" tag, if any. XmlNode desc = root["desc"]; string strTestDescription = string.Empty; if (desc != null && desc.InnerText.Length > 0) { strTestDescription = desc.InnerText; } else { strTestDescription = Path.GetFileNameWithoutExtension(fileName); } // Retrieve the "workspace", if any. XmlNode workspace = root["workspace"]; if (workspace != null) { var workspaceAttributes = workspace.Attributes; if (workspaceAttributes != null && workspaceAttributes.Count > 0) { m_strTestWorkspace = workspaceAttributes["dir"].InnerText; } } // Retrieve the "tolerance" attribute, if any. XmlNode tolerance = root["tolerance"]; double dTolerance = 0.0; if (tolerance != null) { string strTolerance = tolerance.InnerText; try { dTolerance = double.Parse(strTolerance, GetNumberFormatInfo()); } catch (Exception ex) { XmlTestExceptionManager.Publish(ex); } } // Retrieve the precisionName" tag, if any. PrecisionModel pm = null; XmlNode precision = root["precisionModel"]; if (precision != null) { var precisionAttributes = precision.Attributes; if (precisionAttributes != null && precisionAttributes.Count > 0) { var attribute = precisionAttributes["type"]; if (attribute != null) { string strPrecision = attribute.InnerText; if (strPrecision == "FIXED" && precisionAttributes.Count == 4) { try { double scale = double.Parse(precisionAttributes["scale"].InnerText, GetNumberFormatInfo()); double offsetx = double.Parse(precisionAttributes["offsetx"].InnerText, GetNumberFormatInfo()); double offsety = double.Parse(precisionAttributes["offsety"].InnerText, GetNumberFormatInfo()); pm = new PrecisionModel(scale); } catch (Exception ex) { XmlTestExceptionManager.Publish(ex); } } else { pm = new PrecisionModel(); } } else { if (precisionAttributes.Count == 3) { double scale = double.Parse(precisionAttributes["scale"].InnerText, GetNumberFormatInfo()); double offsetx = double.Parse(precisionAttributes["offsetx"].InnerText, GetNumberFormatInfo()); double offsety = double.Parse(precisionAttributes["offsety"].InnerText, GetNumberFormatInfo()); pm = new PrecisionModel(scale); } } } } if (pm == null) { pm = new PrecisionModel(); } IGeometryOperation geometryOperation = null; XmlNode go = root["geometryOperation"]; if (go != null) { go = go.FirstChild; switch (go.Value) { case "com.vividsolutions.jtstest.geomop.PreparedGeometryOperation": geometryOperation = new PreparedGeometryOperation(); break; case "com.vividsolutions.jtstest.geomop.BufferValidatedGeometryOperation": geometryOperation = new BufferValidatedGeometryOperation(); break; case "com.vividsolutions.jtstest.geomop.OverlayValidatedGeometryOperation": geometryOperation = new OverlayValidatedGeometryOperation(); break; default: Console.WriteLine(string.Format("\n *** {0} *** \n", go.Value)); Console.ReadKey(true); geometryOperation = new GeometryMethodOperation(); break; } } IResultMatcher resultMatcher = null; XmlNode rm = root["resultMatcher"]; if (rm != null) { rm = rm.FirstChild; if (rm.Value.EndsWith("BufferResultMatcher", StringComparison.InvariantCultureIgnoreCase)) { resultMatcher = new BufferResultMatcher(); } else { throw new NotSupportedException(); } } m_objFactory = new XmlTestFactory(pm, geometryOperation, resultMatcher); m_listCurTests = new XmlTestCollection(); m_listCurTests.Name = strTestDescription; // Now, handle the "case" nodes var elemList = xmldoc.GetElementsByTagName("case"); for (int i = 0; i < elemList.Count; i++) { ParseCaseNode(elemList[i], dTolerance); } m_listarrTests.Add(m_listCurTests); return(true); } catch (Exception ex) { XmlTestExceptionManager.Publish(ex); return(false); } }
public bool LoadFile(string fileName) { if (!File.Exists(fileName)) { throw new ArgumentException(fileName, "The file does not exits or the 'fileName' is not valid."); } try { XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(fileName); XmlElement root = xmldoc.DocumentElement; // Retrieve the "desc" tag, if any. XmlNode desc = root["desc"]; string strTestDescription = String.Empty; if (desc != null && desc.InnerText.Length > 0) { strTestDescription = desc.InnerText; } else { strTestDescription = Path.GetFileNameWithoutExtension(fileName); } // Retrieve the "workspace", if any. XmlNode workspace = root["workspace"]; if (workspace != null) { XmlAttributeCollection workspaceAttributes = workspace.Attributes; if (workspaceAttributes != null && workspaceAttributes.Count > 0) { m_strTestWorkspace = workspaceAttributes["dir"].InnerText; } } // Retrieve the "tolerance" attribute, if any. XmlNode tolerance = root["tolerance"]; double dTolerance = 0.0; if (tolerance != null) { string strTolerance = tolerance.InnerText; try { dTolerance = Double.Parse(strTolerance, GetNumberFormatInfo()); } catch (Exception ex) { XmlTestExceptionManager.Publish(ex); } } // Retrieve the precisionName" tag, if any. PrecisionModel pm = null; XmlNode precision = root["precisionModel"]; if (precision != null) { XmlAttributeCollection precisionAttributes = precision.Attributes; if (precisionAttributes != null && precisionAttributes.Count > 0) { XmlAttribute attribute = precisionAttributes["type"]; if (attribute != null) { string strPrecision = attribute.InnerText; if (strPrecision == "FIXED" && precisionAttributes.Count == 4) { try { double scale = Double.Parse(precisionAttributes["scale"].InnerText, GetNumberFormatInfo()); double offsetx = Double.Parse(precisionAttributes["offsetx"].InnerText, GetNumberFormatInfo()); double offsety = Double.Parse(precisionAttributes["offsety"].InnerText, GetNumberFormatInfo()); pm = new PrecisionModel(scale); } catch (Exception ex) { XmlTestExceptionManager.Publish(ex); } } else { pm = new PrecisionModel(); } } else { if (precisionAttributes.Count == 3) { double scale = Double.Parse(precisionAttributes["scale"].InnerText, GetNumberFormatInfo()); double offsetx = Double.Parse(precisionAttributes["offsetx"].InnerText, GetNumberFormatInfo()); double offsety = Double.Parse(precisionAttributes["offsety"].InnerText, GetNumberFormatInfo()); pm = new PrecisionModel(scale); } } } } if (pm == null) { pm = new PrecisionModel(); } m_objFactory = new XmlTestFactory(pm); m_listCurTests = new XmlTestCollection(); m_listCurTests.Name = strTestDescription; // Now, handle the "case" nodes XmlNodeList elemList = xmldoc.GetElementsByTagName("case"); for (int i = 0; i < elemList.Count; i++) { ParseCaseNode(elemList[i], dTolerance); } m_listarrTests.Add(m_listCurTests); return(true); } catch (Exception ex) { XmlTestExceptionManager.Publish(ex); return(false); } }