コード例 #1
0
        /// <summary>
        /// Checks the context consistency, for code coverage purpose.
        /// </summary>
        public override void CheckConsistency()
        {
            base.CheckConsistency();

            Debug.Assert(State != null);

            IFocusIndexCollectionList         InternalList = InternalIndexCollectionList as IFocusIndexCollectionList;
            IFocusIndexCollectionReadOnlyList PublicList   = IndexCollectionList;

            for (int i = 0; i < InternalList.Count; i++)
            {
                IFocusIndexCollection InternalItem = InternalList[i];
                Debug.Assert(PublicList.Contains(InternalItem));
                Debug.Assert(PublicList.IndexOf(InternalItem) >= 0);

                IFocusIndexCollection PublicItem = PublicList[i];
                Debug.Assert(InternalList.Contains(PublicItem));
                Debug.Assert(InternalList.IndexOf(PublicItem) >= 0);

                if (i == 0)
                {
                    Debug.Assert(!((ICollection <IFocusIndexCollection>)InternalList).IsReadOnly);

                    InternalList.Remove(InternalItem);
                    InternalList.Insert(0, InternalItem);

                    if (InternalList.GetType() == typeof(FocusIndexCollectionList))
                    {
                        InternalList.CopyTo((IReadOnlyIndexCollection[])(new IFocusIndexCollection[InternalList.Count]), 0);
                        InternalList.CopyTo((IWriteableIndexCollection[])(new IFocusIndexCollection[InternalList.Count]), 0);
                        InternalList.CopyTo((IFrameIndexCollection[])(new IFocusIndexCollection[InternalList.Count]), 0);
                    }

                    IEnumerable <IFocusIndexCollection> AsFocusEnumerable = InternalList;
                    foreach (IFocusIndexCollection Item in AsFocusEnumerable)
                    {
                        Debug.Assert(Item == InternalItem);
                        break;
                    }

                    IEnumerable <IWriteableIndexCollection> AsWriteableEnumerable = PublicList;
                    foreach (IFocusIndexCollection Item in AsWriteableEnumerable)
                    {
                        Debug.Assert(Item == InternalItem);
                        break;
                    }

                    IEnumerable <IFrameIndexCollection> AsFrameEnumerable = PublicList;
                    foreach (IFocusIndexCollection Item in AsFrameEnumerable)
                    {
                        Debug.Assert(Item == InternalItem);
                        break;
                    }

                    IList <IFrameIndexCollection> AsIList = InternalList;
                    Debug.Assert(AsIList[0] == InternalItem);

                    IReadOnlyList <IFrameIndexCollection> AsIReadOnlyList;

                    AsIReadOnlyList = InternalList;
                    Debug.Assert(AsIReadOnlyList[0] == InternalItem);

                    AsIReadOnlyList = PublicList;
                    Debug.Assert(AsIReadOnlyList[0] == InternalItem);

                    ICollection <IFrameIndexCollection> AsICollection = InternalList;
                    AsICollection.Remove(InternalItem);
                    AsICollection.Add(InternalItem);
                    AsICollection.Remove(InternalItem);
                    InternalList.Insert(0, InternalItem);

                    IEnumerator <IFrameIndexCollection> InternalListEnumerator = ((IFrameIndexCollectionList)InternalList).GetEnumerator();
                    InternalListEnumerator.MoveNext();
                    Debug.Assert(InternalListEnumerator.Current == InternalItem);

                    IEnumerator <IFrameIndexCollection> PublicListEnumerator = ((IFrameIndexCollectionReadOnlyList)PublicList).GetEnumerator();
                    PublicListEnumerator.MoveNext();
                    Debug.Assert(PublicListEnumerator.Current == InternalItem);
                }
            }
        }
コード例 #2
0
 bool IFocusIndexCollectionReadOnlyList.Contains(IFocusIndexCollection value)
 {
     return(Contains((ILayoutIndexCollection)value));
 }
コード例 #3
0
 int IFocusIndexCollectionReadOnlyList.IndexOf(IFocusIndexCollection value)
 {
     return(IndexOf((ILayoutIndexCollection)value));
 }
コード例 #4
0
 bool ICollection <IFocusIndexCollection> .Remove(IFocusIndexCollection item)
 {
     return(Remove((ILayoutIndexCollection)item));
 }
コード例 #5
0
 bool ICollection <IFocusIndexCollection> .Contains(IFocusIndexCollection value)
 {
     return(Contains((ILayoutIndexCollection)value));
 }
コード例 #6
0
 void ICollection <IFocusIndexCollection> .Add(IFocusIndexCollection item)
 {
     Add((ILayoutIndexCollection)item);
 }
コード例 #7
0
 void IList <IFocusIndexCollection> .Insert(int index, IFocusIndexCollection item)
 {
     Insert(index, (ILayoutIndexCollection)item);
 }
コード例 #8
0
 int IList <IFocusIndexCollection> .IndexOf(IFocusIndexCollection value)
 {
     return(IndexOf((ILayoutIndexCollection)value));
 }