public void LoadDataWithEmptyFile() { string fileName = null; try { fileName = MakeFile(); m_gd = GAFAWSData.LoadData(fileName); } finally { DeleteFile(fileName); } }
/// ----------------------------------------------------------------------------------- /// <summary> /// Implements the IGAFAWS interface. /// </summary> /// <param name="pathInput">Pathname to the input data.</param> /// <returns>The pathname for the processed data.</returns> /// ----------------------------------------------------------------------------------- public string Process(string pathInput) { // Replaces 8 lines in C++. GAFAWSData gData = GAFAWSData.LoadData(pathInput); if (gData == null) { return(null); } Process(gData); string outPath = GetOutputPathname(pathInput); m_gd.SaveData(outPath); return(outPath); }
public void LoadDataWrongXML() { string fileName = null; try { fileName = MakeFile("<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" + "<NOTGAFAWSData xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" + "</NOTGAFAWSData>"); m_gd = GAFAWSData.LoadData(fileName); } finally { DeleteFile(fileName); } }
public void LoadGoodData() { string fileName = null; try { Assert.AreEqual(0, m_gd.Morphemes.Count); // Shouldn't have any at this point. fileName = MakeFile(m_dataBefore); m_gd = GAFAWSData.LoadData(fileName); Assert.AreEqual(1, m_gd.Morphemes.Count); // Should be 1 of them now. Assert.AreEqual(1, m_gd.WordRecords.Count, "Wrong word record count."); WordRecord wr = m_gd.WordRecords[0]; Assert.IsNull(wr.Prefixes, "Should have null preffix collection."); Assert.IsNull(wr.Suffixes, "Should have null suffix collection."); } finally { DeleteFile(fileName); } }
public void AddOtherContents() { m_anyTop = m_otherTop.XmlElements; Assert.IsNotNull(m_anyTop); XmlDocument doc = new XmlDocument(); m_xe = doc.CreateElement("MyStuff"); string name = m_xe.Name; m_xe.SetAttribute("val", "true"); m_anyTop.Add(m_xe); XmlElement xeys = doc.CreateElement("YourStuff"); xeys.SetAttribute("ID", "YS1"); m_xe.AppendChild(xeys); m_gd.SaveData(m_fileName); m_otherTop = null; m_anyTop = null; m_gd = null; // Make sure it is there. m_gd = GAFAWSData.LoadData(m_fileName); }
public void LoadDataWithNullPathname() { m_gd = GAFAWSData.LoadData(null); }