예제 #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 ReadOnlyCollection <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();
        }
        public static void MembersForwardedToUnderlyingIList()
        {
            var expectedApiCalls =
                IListApi.Count |
                IListApi.Contains |
                IListApi.CopyTo |
                IListApi.GetEnumeratorGeneric |
                IListApi.GetEnumerator;

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

            int  count    = collection.Count;
            bool readOnly = ((ICollection <int>)collection).IsReadOnly;

            collection.Contains(default);