Exemplo n.º 1
0
        public void TestGetEnumerator()
        {
            SequencedDictionary <string, string> dic = new SequencedDictionary <string, string>();

            dic.Add("Key1", "Value1");
            dic.Add("Key2", "Value2");
            dic.Add("Key3", "Value3");
            dic.Remove("Key1");

            bool containsV2 = false;
            bool containsV3 = false;
            IEnumerator <KeyValuePair <string, string> > enumerator = dic.GetEnumerator();

            while (enumerator.MoveNext())
            {
                string s = enumerator.Current.Value;
                if ("Value2".Equals(s))
                {
                    containsV2 = true;
                }
                else if ("Value3".Equals(s))
                {
                    containsV3 = true;
                }
                else
                {
                    Assert.Fail();
                }
            }
            Assert.IsTrue(containsV2);
            Assert.IsTrue(containsV3);
        }