static TypedMarkupParser() { defaultImplementers = new Dictionary<string, ITypedMarkupParserImpl>(); defaultImplementers["str"] = new StringMarkupParser(); defaultImplementers["int"] = new IntMarkupParser(); defaultImplementers["pos"] = new PositionMarkupParser(); defaultImplementers["bool"] = new BoolMarkupParser(); defaultImplementers["code"] = new CodeMarkupParser(); }
public void TestParse_ArrayValuesWork() { var actual = new StringMarkupParser().Parse("str", true, "", null); Assert.AreEqual("new string[] { }", actual.InitializerString); Assert.IsTrue(new string[0].SequenceEqual((string[])actual.ValueRetriever())); actual = new StringMarkupParser().Parse("str", true, " ", null); Assert.AreEqual("new string[] { @\" \" }", actual.InitializerString); Assert.IsTrue(new string[] { " " }.SequenceEqual((string[])actual.ValueRetriever())); actual = new StringMarkupParser().Parse("str", true, " | ", null); Assert.AreEqual("new string[] { @\" \", @\" \" }", actual.InitializerString); Assert.IsTrue(new string[] { " ", " " }.SequenceEqual((string[])actual.ValueRetriever())); actual = new StringMarkupParser().Parse("str", true, " a || b ", null); Assert.AreEqual("new string[] { @\" a \", @\"\", @\" b \" }", actual.InitializerString); Assert.IsTrue(new string[] { " a ", "", " b " }.SequenceEqual((string[])actual.ValueRetriever())); actual = new StringMarkupParser().Parse("str", true, "a|\"|b", null); Assert.AreEqual("new string[] { @\"a\", @\"\"\"\", @\"b\" }", actual.InitializerString); Assert.IsTrue(new string[] { "a", "\"", "b" }.SequenceEqual((string[])actual.ValueRetriever())); }
public void TestParse_EmptyValueWorks() { var actual = new StringMarkupParser().Parse("str", false, "", null); Assert.AreEqual("@\"\"", actual.InitializerString); Assert.AreEqual("", (string)actual.ValueRetriever()); }