示例#1
0
        public static void MembersForwardedToUnderlyingIList()
        {
            var expectedApiCalls =
                IListApi.Count |
                IListApi.IndexerGet |
                IListApi.Contains |
                IListApi.CopyTo |
                IListApi.GetEnumeratorGeneric |
                IListApi.IndexOf |
                IListApi.GetEnumerator;

            var list       = new CallTrackingIList <int>(expectedApiCalls);
            var collection = new ReadOnlyList <int>(list);

            int  count    = collection.Count;
            bool readOnly = ((IList)collection).IsReadOnly;
            int  x        = collection[0];

            collection.Contains(x);
            collection.CopyTo(s_intArray, 0);
            collection.GetEnumerator();
            collection.IndexOf(x);
            ((IEnumerable)collection).GetEnumerator();

            list.AssertAllMembersCalled();
        }
示例#2
0
 public virtual System.Collections.IEnumerator GetEnumerator <T>(ReadOnlyList <T> list)
 {
     return(list.GetEnumerator());
 }