public void FindFormat_ToString_Test1() { FindFormat find = new FindFormat(new FindFormatInitializerTest1()); String s = find.ToString(); Assert.AreEqual("2\nsite 0\nsite/news 12\n", s); }
public void Init(AFormat format) { FindFormat find = (FindFormat)format; find.n = 2; find.pathInfo = new PathInfo[2]; find.pathInfo[0] = new PathInfo("site", 0); find.pathInfo[1] = new PathInfo("site/news", 12); }
public AFormat Transform(AFormat aFormat) { find = (FindFormat)aFormat; xml = new XMLFormat(); xml.SetRoot(find.GetPath(0)); var root = (DirNode)xml.GetNode(0); FindSubNodesAndAppend(root, 1, root.name); return(xml); }
public override Boolean Equals(Object obj) { return(EqualityComparerHelper(this, obj, () => { FindFormat find = (FindFormat)obj; if (this.n == find.n && Enumerable.SequenceEqual(this.pathInfo, find.pathInfo)) { return true; } return false; })); }
public void FindFormat_Equals_NotEqualObjectsTest() { FindFormat find = new FindFormat(new FindFormatInitializerTest1()); FindFormat find1 = new FindFormat(); find1.n = 2; find1.pathInfo = new PathInfo[2]; find1.pathInfo[0] = new PathInfo("site", 0); find1.pathInfo[1] = new PathInfo("site/news", 10); Boolean res = find.Equals(find1); Assert.False(res); }
public void Init(AFormat format) { FindFormat find = (FindFormat)format; String line = Console.ReadLine(); find.n = Convert.ToInt32(line); find.pathInfo = new PathInfo[find.n]; for (Int32 i = 0; i < find.n; i++) { line = Console.ReadLine(); String[] s = line.Split(new Char[] { ' ' }); find.pathInfo[i] = new PathInfo(s[0], Convert.ToInt32(s[1])); } }
public void FindToXml_Test2() { XMLFormat xml = new XMLFormat(new XMLFormatInitializerTest1()); ITransformation tr = new FindToXmlTransformation(); FindFormat ff = new FindFormat(); ff.n = 2; ff.pathInfo = new PathInfo[2]; ff.pathInfo[0] = new PathInfo("site", 0); ff.pathInfo[1] = new PathInfo("site/news", 12); var resXml = tr.Transform(ff); Assert.True(resXml.Equals(xml)); }
public void XMLFormatTest2_ToFindFormat_Test() { XMLFormat xml = new XMLFormat(new XMLFormatInitializerTest2()); ITransformation tr = new XmlToFindTransformation(); FindFormat ff = new FindFormat(); ff.n = 6; ff.pathInfo = new PathInfo[6]; ff.pathInfo[0] = new PathInfo("deo", 0); ff.pathInfo[1] = new PathInfo("deo/sek", 36); ff.pathInfo[2] = new PathInfo("deo/sek/uig", 99); ff.pathInfo[3] = new PathInfo("deo/try", 121); ff.pathInfo[4] = new PathInfo("deo/sek/uig/xoj", 370); ff.pathInfo[5] = new PathInfo("deo/sek/qvg", 2092); var find = tr.Transform(xml); Assert.True(ff.Equals(find)); }
public void FindToXml_Test1() { XMLFormat xml = new XMLFormat(new XMLFormatInitializerTest2()); ITransformation tr = new FindToXmlTransformation(); FindFormat ff = new FindFormat(); ff.n = 6; ff.pathInfo = new PathInfo[6]; ff.pathInfo[0] = new PathInfo("deo", 0); ff.pathInfo[1] = new PathInfo("deo/sek", 36); ff.pathInfo[2] = new PathInfo("deo/sek/uig", 99); ff.pathInfo[3] = new PathInfo("deo/try", 121); ff.pathInfo[4] = new PathInfo("deo/sek/uig/xoj", 370); ff.pathInfo[5] = new PathInfo("deo/sek/qvg", 2092); var resXml = tr.Transform(ff); XmlToFindTransformation tr2 = new XmlToFindTransformation(); var resFind = tr2.Transform(resXml); String s = resFind.ToString(); Assert.True(resXml.Equals(xml)); }
public void FindFormatInitializerTest1() { FindFormat find = new FindFormat(new FindFormatInitializerTest1()); Assert.AreEqual(2, find.n); }