public void ConvertTestXpathMultiLine() { Converter target = new Converter(); string source = @"abc def$foo$ghi jkl"; IQuerier data = new StubQuerier(new Dictionary <string, IEnumerable <string> >() { { "foo", new string[] { "bar" } }, { "baz", new string[] { "qux" } } }); Keywords keys = new Keywords() { XPath = "$" }; string expected = @"abc defbarghi jkl"; string actual; actual = target.Convert(source, data, keys); Assert.AreEqual(expected, actual); }
public void ConvertTestLatexEscapeCharacters() { Converter target = new Converter(); string source = "$1$ $2$ $3$ $4$ $5$ $6$ $7$ $8$ $9$ $10$"; // http://tex.stackexchange.com/questions/34580/escape-character-in-latex IQuerier data = new StubQuerier(new Dictionary <string, IEnumerable <string> >() { { "1", new string[] { "&" } }, { "2", new string[] { "%" } }, { "3", new string[] { "$" } }, { "4", new string[] { "#" } }, { "5", new string[] { "_" } }, { "6", new string[] { "{" } }, { "7", new string[] { "}" } }, { "8", new string[] { "~" } }, { "9", new string[] { "^" } }, { "10", new string[] { "\\" } }, }); Keywords keys = new Keywords() { XPath = "$", ForEach = "#" }; string expected = "\\& \\% \\$ \\# \\_ \\{ \\} \\textasciitilde \\textasciicircum \\textbackslash"; string actual; actual = target.Convert(source, data, keys); Assert.AreEqual(expected, actual); }
public void ConvertTestForEachSingleLine() { Converter target = new Converter(); string source = "some#foo$baz$#text"; IQuerier data = new StubQuerier(new Dictionary <string, IEnumerable <string> >() { { "foo", new string[] { "bar" } }, { "baz", new string[] { "qux", "fox" } } }); Keywords keys = new Keywords() { XPath = "$", ForEach = "#" }; string expected = "somefooquxfoofoxtext"; string actual; actual = target.Convert(source, data, keys); Assert.AreEqual(expected, actual); }
public void ConvertTestXpathXPathInNonLoop() { Converter target = new Converter(); string source = "a$b$c#d$e$f#h$i$"; IQuerier data = new StubQuerier(new Dictionary <string, IEnumerable <string> >() { { "b", new string[] { "B" } }, { "e", new string[] { "E", "G" } }, { "i", new string[] { "I" } } }); Keywords keys = new Keywords() { XPath = "$", ForEach = "#" }; string expected = "aBcdEfdGfhI"; string actual; actual = target.Convert(source, data, keys); Assert.AreEqual(expected, actual); }
// TODO [TestMethod()] public void ConvertTestLoopWithinLoop() { Converter target = new Converter(); string source = "a #1 b $c$ e #2 f $g$ h #2 i #1 j"; IQuerier data = new StubQuerier(new Dictionary <string, IEnumerable <string> >() { { "c", new string[] { "c1", "c2" } }, { "g", new string[] { "g1", "g2", "g3" } }, { "gc1", new string[] { "x1", "x2", "x3" } }, { "gc2", new string[] { "y1", "y2" } }, }); Keywords keys = new Keywords() { XPath = "$", ForEach = "#" }; string expected = "a b c1 e f x1 h f x2 h f x3 h i b c2 e f y1 h f y2 h i j"; string actual; actual = target.Convert(source, data, keys); Assert.AreEqual(expected, actual); }