// Create a function that iterates through the view-state
        // values stored for this class and returns the
        // results as a string.
        public string EnumerateViewState()
        {
            string                keyName, keyValue;
            string                result = String.Empty;
            StateItem             myStateItem;
            IDictionaryEnumerator myDictionaryEnumerator = _viewstate.GetEnumerator();

            while (myDictionaryEnumerator.MoveNext())
            {
                keyName     = (string)myDictionaryEnumerator.Key;
                myStateItem = (StateItem)myDictionaryEnumerator.Value;
                keyValue    = (string)myStateItem.Value;
                result      = result + "<br>ViewState[" + keyName + "] = " + keyValue;
            }
            return(result);
        }
Beispiel #2
0
        public void Deny_Unrestricted()
        {
            StateBag bag = new StateBag(true);

            Assert.IsNotNull(bag.Add("key", "value"), "Add");
            Assert.AreEqual(1, bag.Count, "Count");
            Assert.IsNotNull(bag.GetEnumerator(), "GetEnumerator");
            bag.SetItemDirty("key", true);
            Assert.IsTrue(bag.IsItemDirty("key"), "IsItemDirty");
            bag.Remove("key");

            bag.Clear();
            bag["key"] = "value";
            Assert.IsNotNull(bag["key"], "this[string]");
            Assert.IsNotNull(bag.Keys, "Keys");
            Assert.IsNotNull(bag.Values, "Values");
            bag.SetDirty(true);
        }
 public IDictionaryEnumerator GetEnumerator()
 {
     return(viewState.GetEnumerator());
 }