Ejemplo n.º 1
0
        public void IDictionary_Deny_Unrestricted()
        {
            IDictionary d = new StateBag();

            d.Add("key", "value");
            Assert.IsTrue(d.Contains("key"), "Contains");
            Assert.AreEqual(1, d.Count, "Count");
            d.Remove("key");
            d["key"] = "value";
            Assert.AreEqual("value", d["key"], "this[string]");
            d.Clear();
            Assert.IsFalse(d.IsFixedSize, "IsFixedSize");
            Assert.IsFalse(d.IsReadOnly, "IsReadOnly");

            ICollection c = (d as ICollection);

            Assert.IsFalse(c.IsSynchronized, "IsSynchronized");
            Assert.IsNotNull(c.SyncRoot, "SyncRoot");
        }