Ejemplo n.º 1
0
        public void InitialBag1()
        {
            StateBag bag = new StateBag(true);
            AC       ac  = new AC(bag);

            Assert.AreEqual(0, ac.Count, "count");
            Assert.AreEqual(null, ac ["hola"], "item");
            Assert.AreEqual(0, ac.Keys.Count, "keys");
            ac.Add("notexists", "invalid");
            ac.Remove("notexists");
            ac.Remove("notexists");

            HtmlTextWriter writer = new HtmlTextWriter(new StringWriter());

            ac.AddAttributes(writer);
            ac.Render(writer);
            Assert.AreEqual(0, writer.InnerWriter.ToString().Length, "length");
            CssStyleCollection css = ac.CssStyle;

            Assert.AreEqual(0, css.Count, "csscount");
            Assert.AreEqual(null, css ["hola"], "cssitem");
            Assert.AreEqual(0, css.Keys.Count, "csskeys");
            css.Add("notexists", "invalid");
            css.Remove("notexists");
            css.Remove("notexists");
            css.Add("notexists", "invalid");
            css.Clear();
            Assert.AreEqual(0, css.Keys.Count, "csskeys2");
        }
Ejemplo n.º 2
0
 public void Deny_Unrestricted()
 {
     Assert.AreEqual(0, css.Count, "Count");
     css ["mono"] = "monkey";
     Assert.AreEqual("monkey", css["mono"], "this[string]");
     Assert.IsNotNull(css.Keys, "Keys");
     css.Add("monkey", "mono");
     css.Remove("monkey");
     css.Clear();
     css[HtmlTextWriterStyle.Top] = "1";
     Assert.AreEqual("1", css[HtmlTextWriterStyle.Top], "this[HtmlTextWriterStyle]");
     Assert.IsNotNull(css.Value, "Value");
     css.Value = String.Empty;
     css.Add(HtmlTextWriterStyle.Left, "1");
     css.Remove(HtmlTextWriterStyle.Left);
 }