public void SortersEtc() { PropertyRecordSorter prs = new PropertyRecordSorter("longName"); // Save and restore! string xml = DynamicLoader.PersistObject(prs, "sorter"); XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); // And check all the pieces... PropertyRecordSorter prsOut = DynamicLoader.RestoreObject(doc.DocumentElement) as PropertyRecordSorter; prsOut.Cache = Cache; Assert.AreEqual("longName", prsOut.PropertyName); }
public void SortersEtc() { PropertyRecordSorter prs = new PropertyRecordSorter("longName"); // Save and restore! string xml = DynamicLoader.PersistObject(prs, "sorter"); XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); // And check all the pieces... PropertyRecordSorter prsOut = DynamicLoader.RestoreObject(doc.DocumentElement) as PropertyRecordSorter; prsOut.Cache = m_cache; Assert.AreEqual("longName", prsOut.PropertyName); // Putting an IntStringComparer here is utterly bizarre, but it tests out one more class. StringFinderCompare sfComp = new StringFinderCompare(new OwnMonoPropFinder(m_cache.MainCacheAccessor, 445), new ReverseComparer(new IntStringComparer())); sfComp.SortedFromEnd = true; // Save and restore! xml = DynamicLoader.PersistObject(sfComp, "comparer"); doc = new XmlDocument(); doc.LoadXml(xml); // And check all the pieces... StringFinderCompare sfCompOut = DynamicLoader.RestoreObject(doc.DocumentElement) as StringFinderCompare; sfCompOut.Cache = m_cache; Assert.IsTrue(sfCompOut.Finder is OwnMonoPropFinder); Assert.IsTrue(sfCompOut.SubComparer is ReverseComparer); Assert.IsTrue(sfCompOut.SortedFromEnd); ReverseComparer rcOut = sfCompOut.SubComparer as ReverseComparer; Assert.IsTrue(rcOut.SubComp is IntStringComparer); }