Esempio n. 1
0
        public void EnumerationEmptyTest()
        {
            dictionary = new SplayDictionary <int, string>();
            IEnumerator <KeyValuePair <int, string> > e = dictionary.GetEnumerator();

            Assert.IsFalse(e.MoveNext());
        }
Esempio n. 2
0
        public void EnumerationTest()
        {
            var array = new[] { new KeyValuePair <int, string>(64, "sixty-four"),
                                new KeyValuePair <int, string>(3, "three"),
                                new KeyValuePair <int, string>(16, "sixteen"),
                                new KeyValuePair <int, string>(73, "seventy-three"),
                                new KeyValuePair <int, string>(67, "sixty-seven") };

            dictionary = new SplayDictionary <int, string>(array);
            IEnumerator <KeyValuePair <int, string> > e = dictionary.GetEnumerator();

            Assert.IsTrue(e.MoveNext());
            Assert.AreEqual(new KeyValuePair <int, string>(3, "three"), e.Current);
            Assert.IsTrue(e.MoveNext());
            Assert.AreEqual(new KeyValuePair <int, string>(16, "sixteen"), e.Current);
            Assert.IsTrue(e.MoveNext());
            Assert.AreEqual(new KeyValuePair <int, string>(64, "sixty-four"), e.Current);
            Assert.IsTrue(e.MoveNext());
            Assert.AreEqual(new KeyValuePair <int, string>(67, "sixty-seven"), e.Current);
            Assert.IsTrue(e.MoveNext());
            Assert.AreEqual(new KeyValuePair <int, string>(73, "seventy-three"), e.Current);
            Assert.IsFalse(e.MoveNext());
        }