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 BoolMarkupParser().Parse("bool", true, "", null); Assert.AreEqual("new bool[] { }", actual.InitializerString); Assert.IsTrue(new bool[0].SequenceEqual((bool[])actual.ValueRetriever())); actual = new BoolMarkupParser().Parse("bool", true, " true ", null); Assert.AreEqual("new bool[] { true }", actual.InitializerString); Assert.IsTrue(new bool[] { true }.SequenceEqual((bool[])actual.ValueRetriever())); actual = new BoolMarkupParser().Parse("bool", true, " true | false", null); Assert.AreEqual("new bool[] { true, false }", actual.InitializerString); Assert.IsTrue(new bool[] { true, false }.SequenceEqual((bool[])actual.ValueRetriever())); actual = new BoolMarkupParser().Parse("bool", true, " true|false|true", null); Assert.AreEqual("new bool[] { true, false, true }", actual.InitializerString); Assert.IsTrue(new bool[] { true, false, true }.SequenceEqual((bool[])actual.ValueRetriever())); }
public void TestParse_FalseWorks() { var actual = new BoolMarkupParser().Parse("bool", false, " false ", null); Assert.AreEqual("false", actual.InitializerString); Assert.AreEqual(false, (bool)actual.ValueRetriever()); }