public void TestDefineTag() { TestTagTemplate data = GadgetTestData.TagTemplates.SimpleTemplate; OsTagTemplate target = new OsTagTemplate(data.Tag); Assert.AreEqual(data.Tag, target.Tag); }
public void TestTagAndSource() { TestTagTemplate data = GadgetTestData.TagTemplates.SimpleTemplate; OsTagTemplate target = new OsTagTemplate(); // OsTagTemplate target = new OsTagTemplate(data.Tag, data.Source, TEST_FACTORY_KEY); target.MyRootMaster.MyControlFactory = ControlFactory.GetControlFactory(TEST_FACTORY_KEY); target.LoadTag(data.Source); Assert.AreEqual(data.Source, target.RawTag); }
public void TagTemplateHasControls() { string template = "<script type='text/os-template' tag='my:foo'>Hello world <os:name person='${vwr}' />. I am a walrus</script>"; string tag = "my:foo"; //CustomTagTemplate control = new CustomTagTemplate(tag, template, factory.MyRootMaster); OsTagTemplate control = new OsTagTemplate(tag, template, factory.MyRootMaster.MyControlFactory); Assert.Greater(control.Controls.Count, 1, "Only one control inside"); Assert.AreNotEqual(typeof(GadgetLiteral), control.Controls[1].GetType(), "Incorrect type of child control"); Assert.AreEqual(typeof(GadgetLiteral), control.Controls[0].GetType(), "First item not a literal"); }
public void TestTagParse() { TestTagTemplate data = GadgetTestData.TagTemplates.SimpleTemplate; OsTagTemplate target = new OsTagTemplate(); target.MyRootMaster.MyControlFactory = ControlFactory.GetControlFactory(TEST_FACTORY_KEY); target.LoadTag(data.Source); Assert.AreEqual(data.Tag, target.Tag); CustomTagFactory fact = new CustomTagFactory(); fact.RegisterCustomTag(target); CustomTag result = fact.CreateTagInstance(data.Tag); Assert.AreEqual(data.Tag, result.MarkupTag); Assert.AreEqual("my", target.Prefix); Assert.AreEqual("Thing", target.LocalTag); }