/// <summary> /// Checks the context consistency, for code coverage purpose. /// </summary> public override void CheckConsistency() { base.CheckConsistency(); Debug.Assert(State != null); IWriteableIndexCollectionList InternalList = InternalIndexCollectionList as IWriteableIndexCollectionList; IWriteableIndexCollectionReadOnlyList PublicList = IndexCollectionList; for (int i = 0; i < InternalList.Count; i++) { IWriteableIndexCollection InternalItem = InternalList[i]; Debug.Assert(PublicList.Contains(InternalItem)); Debug.Assert(PublicList.IndexOf(InternalItem) >= 0); IWriteableIndexCollection PublicItem = PublicList[i]; Debug.Assert(InternalList.Contains(PublicItem)); Debug.Assert(InternalList.IndexOf(PublicItem) >= 0); if (i == 0) { Debug.Assert(!((ICollection <IWriteableIndexCollection>)InternalList).IsReadOnly); InternalList.Remove(InternalItem); InternalList.Insert(0, InternalItem); if (InternalList.GetType() == typeof(WriteableIndexCollectionList)) { InternalList.CopyTo((IReadOnlyIndexCollection[])(new IWriteableIndexCollection[InternalList.Count]), 0); } IEnumerable <IWriteableIndexCollection> AsEnumerable = InternalList; foreach (IWriteableIndexCollection Item in AsEnumerable) { Debug.Assert(Item == InternalItem); break; } IList <IReadOnlyIndexCollection> AsIList = InternalList; Debug.Assert(AsIList[0] == InternalItem); IReadOnlyList <IReadOnlyIndexCollection> AsIReadOnlyList = InternalList; Debug.Assert(AsIReadOnlyList[0] == InternalItem); } } }
public WriteableIndexCollectionReadOnlyList(IWriteableIndexCollectionList list) : base(list) { }