public void SortedList_AsSorted_EnumeratesIdenticalSequence() { SortedList <int, string> source = new SortedList <int, string>(); source.Add(0, "a"); source.Add(1, "c"); source.Add(2, "b"); ISortedEnumerable <KeyValuePair <int, string> > result = source.AsSorted(); Assert.IsTrue(result.SequenceEqual(new[] { new KeyValuePair <int, string>(0, "a"), new KeyValuePair <int, string>(1, "c"), new KeyValuePair <int, string>(2, "b") }), "AsSorted should not change the sequence."); Assert.AreEqual(0, result.IndexOf(new KeyValuePair <int, string>(0, "a")), "Could not find item in sorted list."); }