Exemplo n.º 1
0
        public void Deny_Unrestricted()
        {
            ControlBuilder cb = new ControlBuilder();

            Assert.IsNull(cb.ControlType, "ControlType");
            Assert.IsFalse(cb.HasAspCode, "HasAspCode");
            cb.ID = "mono";
            Assert.AreEqual("mono", cb.ID, "ID");
            Assert.AreEqual(typeof(Control), cb.NamingContainerType, "NamingContainerType");
            Assert.IsNull(cb.TagName, "TagName");
            Assert.IsTrue(cb.AllowWhitespaceLiterals(), "AllowWhitespaceLiterals");
            cb.AppendLiteralString("mono");
            cb.AppendSubBuilder(cb);
            cb.CloseControl();
            Assert.IsNull(cb.GetChildControlType(null, null), "GetChildControlType");
            Assert.IsTrue(cb.HasBody(), "HasBody");
            Assert.IsFalse(cb.HtmlDecodeLiterals(), "HtmlDecodeLiterals");
            cb.Init(null, cb, typeof(TemplateBuilder), "span", "mono", null);
            Assert.IsFalse(cb.NeedsTagInnerText(), "NeedsTagInnerText");
            //cb.OnAppendToParentBuilder (null);
            cb.SetTagInnerText("mono");

            cb = ControlBuilder.CreateBuilderFromType(null, cb, typeof(TemplateBuilder), "span", "mono", null, 0, String.Empty);
            Assert.IsNotNull(cb, "CreateBuilderFromType");
        }
Exemplo n.º 2
0
 private static void GetChildControlOfControlBuilder(ControlBuilder builder, string tagName)
 {
     try
     {
         // Get the child control type of passed
         // builder using passed tag name.
         var type = builder.GetChildControlType(
             tagName,
             new Dictionary <string, string>()
             );
         Logging.Log($"Child Control Type of {builder.GetType().Name} (ID: {builder.ID}) is {type}");
     }
     catch (System.Web.HttpParseException exception)
     {
         // Output expected HttpParseExceptions.
         Logging.Log(exception);
     }
     catch (Exception exception)
     {
         // Output unexpected Exceptions.
         Logging.Log(exception, false);
     }
 }