/// <inheritdoc/> public virtual bool IsEqual(CompareEqual comparer, IEqualComparable other) { Contract.RequireNotNull(other, out IEqualComparable Other); if (!comparer.IsSameType(Other, out FrameCellViewList AsOtherList)) { return(comparer.Failed()); } if (!comparer.IsSameCount(Count, AsOtherList.Count)) { return(comparer.Failed()); } for (int i = 0; i < Count; i++) { if (!comparer.VerifyEqual(this[i], AsOtherList[i])) { return(comparer.Failed()); } } return(true); }
/// <summary> /// Compares two <see cref="IWriteablePlaceholderNodeStateReadOnlyList"/> objects. /// </summary> /// <param name="comparer">The comparison support object.</param> /// <param name="other">The other object.</param> public virtual bool IsEqual(CompareEqual comparer, IEqualComparable other) { Debug.Assert(other != null); if (!comparer.IsSameType(other, out WriteablePlaceholderNodeStateReadOnlyList AsPlaceholderNodeStateReadOnlyList)) { return(comparer.Failed()); } if (!comparer.IsSameCount(Count, AsPlaceholderNodeStateReadOnlyList.Count)) { return(comparer.Failed()); } for (int i = 0; i < Count; i++) { if (!comparer.VerifyEqual(this[i], AsPlaceholderNodeStateReadOnlyList[i])) { return(comparer.Failed()); } } return(true); }
/// <summary> /// Compares two <see cref="IFrameCellViewList"/> objects. /// </summary> /// <param name="comparer">The comparison support object.</param> /// <param name="other">The other object.</param> public virtual bool IsEqual(CompareEqual comparer, IEqualComparable other) { Debug.Assert(other != null); if (!comparer.IsSameType(other, out FrameCellViewList AsCellViewList)) { return(comparer.Failed()); } if (!comparer.IsSameCount(Count, AsCellViewList.Count)) { return(comparer.Failed()); } for (int i = 0; i < Count; i++) { if (!comparer.VerifyEqual(this[i], AsCellViewList[i])) { return(comparer.Failed()); } } return(true); }
public static void TestStateView(int index, Node rootNode) { ControllerTools.ResetExpectedName(); IReadOnlyRootNodeIndex RootIndex = new ReadOnlyRootNodeIndex(rootNode); ReadOnlyController Controller = ReadOnlyController.Create(RootIndex); ReadOnlyControllerView ControllerView = ReadOnlyControllerView.Create(Controller); Assert.That(ControllerView.StateViewTable.ContainsKey(Controller.RootState), $"Views #0"); Assert.That(ControllerView.StateViewTable.Count == Controller.Stats.NodeCount, $"Views #1"); foreach (KeyValuePair <IReadOnlyNodeState, IReadOnlyNodeStateView> Entry in ControllerView.StateViewTable) { IReadOnlyNodeState State = Entry.Key; Assert.That(ControllerView.StateViewTable.ContainsKey(Controller.RootState), $"Views #2, state={State}"); IReadOnlyNodeStateView View = Entry.Value; Assert.That(View.State == State, $"Views #3"); } ReadOnlyControllerView ControllerView2 = ReadOnlyControllerView.Create(Controller); Assert.That(ControllerView2.IsEqual(CompareEqual.New(), ControllerView), $"Views #4"); }
/// <summary> /// Compares two <see cref="IReadOnlyIndex"/> objects. /// </summary> /// <param name="comparer">The comparison support object.</param> /// <param name="other">The other object.</param> public virtual bool IsEqual(CompareEqual comparer, IEqualComparable other) { Debug.Assert(other != null); if (!comparer.IsSameType(other, out ReadOnlyBrowsingExistingBlockNodeIndex AsExistingBlockNodeIndex)) { return(comparer.Failed()); } if (!comparer.IsSameReference(ParentNode, AsExistingBlockNodeIndex.ParentNode)) { return(comparer.Failed()); } if (!comparer.IsSameString(PropertyName, AsExistingBlockNodeIndex.PropertyName)) { return(comparer.Failed()); } if (!comparer.IsSameInteger(BlockIndex, AsExistingBlockNodeIndex.BlockIndex)) { return(comparer.Failed()); } if (!comparer.IsSameInteger(Index, AsExistingBlockNodeIndex.Index)) { return(comparer.Failed()); } if (!comparer.IsSameReference(Node, AsExistingBlockNodeIndex.Node)) { return(comparer.Failed()); } return(true); }
/// <inheritdoc/> public override bool IsEqual(CompareEqual comparer, IEqualComparable other) { Contract.RequireNotNull(other, out IEqualComparable Other); if (!comparer.IsSameType(Other, out LayoutPlaceholderNodeStateReadOnlyList AsOtherReadOnlyList)) { return(comparer.Failed()); } if (!comparer.IsSameCount(Count, AsOtherReadOnlyList.Count)) { return(comparer.Failed()); } for (int i = 0; i < Count; i++) { if (!comparer.VerifyEqual(this[i], AsOtherReadOnlyList[i])) { return(comparer.Failed()); } } return(true); }
/// <inheritdoc/> public override bool IsEqual(CompareEqual comparer, IEqualComparable other) { if (!comparer.IsSameType(other, out ReadOnlySourceState <IInner> AsSourceState)) { return(comparer.Failed()); } if (!base.IsEqual(comparer, AsSourceState)) { return(comparer.Failed()); } if (!comparer.IsSameReference(Node, AsSourceState.Node)) { return(comparer.Failed()); } if (!comparer.VerifyEqual(ParentBlockState, AsSourceState.ParentBlockState)) { return(comparer.Failed()); } return(true); }
/// <summary> /// Compares two <see cref="FrameVisibleCellView"/> objects. /// </summary> /// <param name="comparer">The comparison support object.</param> /// <param name="other">The other object.</param> public override bool IsEqual(CompareEqual comparer, IEqualComparable other) { if (!comparer.IsSameType(other, out FrameVisibleCellView AsVisibleCellView)) { return(comparer.Failed()); } if (!base.IsEqual(comparer, AsVisibleCellView)) { return(comparer.Failed()); } if (!comparer.IsSameInteger(LineNumber, AsVisibleCellView.LineNumber)) { return(comparer.Failed()); } if (!comparer.IsSameInteger(ColumnNumber, AsVisibleCellView.ColumnNumber)) { return(comparer.Failed()); } return(true); }
/// <inheritdoc/> public override bool IsEqual(CompareEqual comparer, IEqualComparable other) { if (!comparer.IsSameType(other, out ReadOnlyEmptyNodeState <IInner> AsEmptyNodeState)) { return(comparer.Failed()); } if (!base.IsEqual(comparer, AsEmptyNodeState)) { return(comparer.Failed()); } if (!comparer.IsSameReference(Node, AsEmptyNodeState.Node)) { return(comparer.Failed()); } if (!IsChildrenEqual(comparer, AsEmptyNodeState)) { return(comparer.Failed()); } return(true); }
private bool IsEqualFields(CompareEqual comparer, ReadOnlyController other) { if (!comparer.VerifyEqual(RootIndex, other.RootIndex)) { return(comparer.Failed()); } if (!comparer.VerifyEqual(RootState, other.RootState)) { return(comparer.Failed()); } if (!comparer.VerifyEqual(Stats, other.Stats)) { return(comparer.Failed()); } if (!comparer.IsSameCount(StateTable.Count, other.StateTable.Count)) { return(comparer.Failed()); } return(true); }
/// <summary> /// Compares two <see cref="FrameContainerCellView"/> objects. /// </summary> /// <param name="comparer">The comparison support object.</param> /// <param name="other">The other object.</param> public override bool IsEqual(CompareEqual comparer, IEqualComparable other) { if (!comparer.IsSameType(other, out FrameContainerCellView AsContainerCellView)) { return(comparer.Failed()); } if (!base.IsEqual(comparer, AsContainerCellView)) { return(comparer.Failed()); } if (!comparer.VerifyEqual(ParentCellView, AsContainerCellView.ParentCellView)) { return(comparer.Failed()); } if (!comparer.VerifyEqual(ChildStateView, AsContainerCellView.ChildStateView)) { return(comparer.Failed()); } return(true); }
/// <summary> /// Compares two <see cref="FocusCellViewCollection"/> objects. /// </summary> /// <param name="comparer">The comparison support object.</param> /// <param name="other">The other object.</param> public abstract override bool IsEqual(CompareEqual comparer, IEqualComparable other);
/// <summary> /// Checks that a frame is correctly constructed. /// </summary> /// <param name="nodeType">Type of the node this frame can describe.</param> /// <param name="nodeTemplateTable">Table of templates with all frames.</param> /// <param name="commentFrameCount">Number of comment frames found so far.</param> public override bool IsValid(Type nodeType, FrameTemplateReadOnlyDictionary nodeTemplateTable, ref int commentFrameCount) { bool IsValid = true; IsValid &= base.IsValid(nodeType, nodeTemplateTable, ref commentFrameCount); IsValid &= Items.Count > 0; IsValid &= IsParentRoot; List <string> NameList = new List <string>(); int SelectionCommentFrameCount = -1; List <Dictionary <string, FocusFrameSelectorList> > SelectorTableList = new List <Dictionary <string, FocusFrameSelectorList> >(); Dictionary <string, FocusFrameSelectorList> SelectorTable; foreach (IFocusSelectableFrame Item in Items) { int SelectableCommentFrameCount = 0; IsValid &= Item.IsValid(nodeType, nodeTemplateTable, ref SelectableCommentFrameCount); IsValid &= !NameList.Contains(Item.Name); // Use the count for the first frame as base count. if (SelectionCommentFrameCount < 0) { SelectionCommentFrameCount = SelectableCommentFrameCount; } // All selectable frames must have the same count. IsValid &= SelectionCommentFrameCount == SelectableCommentFrameCount; NameList.Add(Item.Name); SelectorTable = new Dictionary <string, FocusFrameSelectorList>(); Item.CollectSelectors(SelectorTable); SelectorTableList.Add(SelectorTable); } // Use the common count of all selectable frames as the count of the selection frame. commentFrameCount += SelectionCommentFrameCount; // Check that all selectable have the same nested selectors. See FrameSelectorForProperty(). SelectorTable = new Dictionary <string, FocusFrameSelectorList>(); CollectSelectors(SelectorTable); Debug.Assert(SelectorTable.Count == 0); List <string> PropertyNameList = new List <string>(); foreach (Dictionary <string, FocusFrameSelectorList> Table in SelectorTableList) { foreach (KeyValuePair <string, FocusFrameSelectorList> Entry in Table) { if (!PropertyNameList.Contains(Entry.Key)) { PropertyNameList.Add(Entry.Key); } } } foreach (string PropertyName in PropertyNameList) { List <FocusFrameSelectorList> TableWithPropertyList = new List <FocusFrameSelectorList>(); foreach (Dictionary <string, FocusFrameSelectorList> Table in SelectorTableList) { if (Table.ContainsKey(PropertyName)) { TableWithPropertyList.Add(Table[PropertyName]); } } Debug.Assert(TableWithPropertyList.Count > 0); FocusFrameSelectorList FirstItem = TableWithPropertyList[0]; CompareEqual Comparer = CompareEqual.New(canReturnFalse: true); for (int i = 1; i < TableWithPropertyList.Count; i++) { IsValid &= FirstItem.IsEqual(Comparer, TableWithPropertyList[i]); } } if (!IsValid) { } Debug.Assert(IsValid); return(IsValid); }
public static void ReadOnlyProperties() { ControllerTools.ResetExpectedName(); Main RootNode; IReadOnlyRootNodeIndex RootIndex0; IReadOnlyRootNodeIndex RootIndex1; RootNode = CreateRoot(ValueGuid0, Imperfections.None); Assert.That(BaseNodeHelper.NodeTreeDiagnostic.IsValid(RootNode)); RootIndex0 = new ReadOnlyRootNodeIndex(RootNode); Assert.That(RootIndex0.Node == RootNode); Assert.That(RootIndex0.IsEqual(CompareEqual.New(), RootIndex0)); RootIndex1 = new ReadOnlyRootNodeIndex(RootNode); Assert.That(RootIndex1.Node == RootNode); Assert.That(CompareEqual.CoverIsEqual(RootIndex0, RootIndex1)); ReadOnlyController Controller0 = ReadOnlyController.Create(RootIndex0); Assert.That(Controller0.RootIndex == RootIndex0); Stats Stats = Controller0.Stats; Assert.That(Stats.NodeCount >= 0); Assert.That(Stats.PlaceholderNodeCount >= 0); Assert.That(Stats.OptionalNodeCount >= 0); Assert.That(Stats.AssignedOptionalNodeCount >= 0); Assert.That(Stats.ListCount >= 0); Assert.That(Stats.BlockListCount >= 0); Assert.That(Stats.BlockCount >= 0); IReadOnlyPlaceholderNodeState RootState = Controller0.RootState; Assert.That(RootState.ParentIndex == RootIndex0); Assert.That(Controller0.Contains(RootIndex0)); Assert.That(Controller0.IndexToState(RootIndex0) == RootState); Assert.That(RootState.InnerTable.Count == 8); Assert.That(RootState.InnerTable.ContainsKey(nameof(Main.PlaceholderTree))); Assert.That(RootState.InnerTable.ContainsKey(nameof(Main.PlaceholderLeaf))); Assert.That(RootState.InnerTable.ContainsKey(nameof(Main.UnassignedOptionalLeaf))); Assert.That(RootState.InnerTable.ContainsKey(nameof(Main.EmptyOptionalLeaf))); Assert.That(RootState.InnerTable.ContainsKey(nameof(Main.AssignedOptionalTree))); Assert.That(RootState.InnerTable.ContainsKey(nameof(Main.AssignedOptionalLeaf))); Assert.That(RootState.InnerTable.ContainsKey(nameof(Main.LeafBlocks))); Assert.That(RootState.InnerTable.ContainsKey(nameof(Main.LeafPath))); IReadOnlyPlaceholderInner MainPlaceholderTreeInner = (IReadOnlyPlaceholderInner)RootState.PropertyToInner(nameof(Main.PlaceholderTree)); Assert.That(MainPlaceholderTreeInner != null); if (MainPlaceholderTreeInner != null) { Assert.That(MainPlaceholderTreeInner.InterfaceType.IsTypeof <Tree>()); Assert.That(MainPlaceholderTreeInner.ChildState != null); Assert.That(MainPlaceholderTreeInner.ChildState?.ParentInner == MainPlaceholderTreeInner); } IReadOnlyPlaceholderInner MainPlaceholderLeafInner = (IReadOnlyPlaceholderInner)RootState.PropertyToInner(nameof(Main.PlaceholderLeaf)); Assert.That(MainPlaceholderLeafInner != null); if (MainPlaceholderLeafInner != null) { Assert.That(MainPlaceholderLeafInner.InterfaceType.IsTypeof <Leaf>()); Assert.That(MainPlaceholderLeafInner.ChildState != null); Assert.That(MainPlaceholderLeafInner.ChildState?.ParentInner == MainPlaceholderLeafInner); } IReadOnlyOptionalInner MainUnassignedOptionalInner = (IReadOnlyOptionalInner)RootState.PropertyToInner(nameof(Main.UnassignedOptionalLeaf)); Assert.That(MainUnassignedOptionalInner != null); if (MainUnassignedOptionalInner != null) { Assert.That(MainUnassignedOptionalInner.InterfaceType.IsTypeof <Leaf>()); Assert.That(!MainUnassignedOptionalInner.IsAssigned); Assert.That(MainUnassignedOptionalInner.ChildState != null); Assert.That(MainUnassignedOptionalInner.ChildState?.ParentInner == MainUnassignedOptionalInner); } IReadOnlyOptionalInner MainAssignedOptionalTreeInner = (IReadOnlyOptionalInner)RootState.PropertyToInner(nameof(Main.AssignedOptionalTree)); Assert.That(MainAssignedOptionalTreeInner != null); if (MainAssignedOptionalTreeInner != null) { Assert.That(MainAssignedOptionalTreeInner.InterfaceType.IsTypeof <Tree>()); Assert.That(MainAssignedOptionalTreeInner.IsAssigned); } IReadOnlyNodeState AssignedOptionalTreeState = MainAssignedOptionalTreeInner.ChildState; Assert.That(AssignedOptionalTreeState != null); if (AssignedOptionalTreeState != null) { Assert.That(AssignedOptionalTreeState.ParentInner == MainAssignedOptionalTreeInner); Assert.That(AssignedOptionalTreeState.ParentState == RootState); } ReadOnlyNodeStateReadOnlyList AssignedOptionalTreeAllChildren = AssignedOptionalTreeState.GetAllChildren(); Assert.That(AssignedOptionalTreeAllChildren.Count == 2, $"New count: {AssignedOptionalTreeAllChildren.Count}"); IReadOnlyOptionalInner MainAssignedOptionalLeafInner = (IReadOnlyOptionalInner)RootState.PropertyToInner(nameof(Main.AssignedOptionalLeaf)); Assert.That(MainAssignedOptionalLeafInner != null); if (MainAssignedOptionalLeafInner != null) { Assert.That(MainAssignedOptionalLeafInner.InterfaceType.IsTypeof <Leaf>()); Assert.That(MainAssignedOptionalLeafInner.IsAssigned); Assert.That(MainAssignedOptionalLeafInner.ChildState != null); Assert.That(MainAssignedOptionalLeafInner.ChildState.ParentInner == MainAssignedOptionalLeafInner); } IReadOnlyBlockListInner MainLeafBlocksInner = (IReadOnlyBlockListInner)RootState.PropertyToInner(nameof(Main.LeafBlocks)); Assert.That(MainLeafBlocksInner != null); if (MainLeafBlocksInner != null) { Assert.That(!MainLeafBlocksInner.IsNeverEmpty); Assert.That(!MainLeafBlocksInner.IsEmpty); Assert.That(!MainLeafBlocksInner.IsSingle); Assert.That(MainLeafBlocksInner.InterfaceType.IsTypeof <Leaf>()); Assert.That(MainLeafBlocksInner.BlockType.IsTypeof <BaseNode.IBlock <Leaf> >()); Assert.That(MainLeafBlocksInner.ItemType.IsTypeof <Leaf>()); Assert.That(MainLeafBlocksInner.Count == 4); Assert.That(MainLeafBlocksInner.BlockStateList != null); Assert.That(MainLeafBlocksInner.BlockStateList.Count == 3); Assert.That(MainLeafBlocksInner.AllIndexes().Count == MainLeafBlocksInner.Count); } IReadOnlyBlockState LeafBlock = MainLeafBlocksInner.BlockStateList[0]; Assert.That(LeafBlock != null); if (LeafBlock != null) { Assert.That(LeafBlock.StateList != null); Assert.That(LeafBlock.StateList.Count == 1); Assert.That(MainLeafBlocksInner.FirstNodeState == LeafBlock.StateList[0]); Assert.That(MainLeafBlocksInner.IndexAt(0, 0) == MainLeafBlocksInner.FirstNodeState.ParentIndex); Assert.That(LeafBlock.Comment == ""); } IReadOnlyPlaceholderInner PatternInner = (IReadOnlyPlaceholderInner)LeafBlock.PropertyToInner(nameof(BaseNode.IBlock.ReplicationPattern)); Assert.That(PatternInner != null); IReadOnlyPlaceholderInner SourceInner = (IReadOnlyPlaceholderInner)LeafBlock.PropertyToInner(nameof(BaseNode.IBlock.SourceIdentifier)); Assert.That(SourceInner != null); IReadOnlyPatternState PatternState = LeafBlock.PatternState; Assert.That(PatternState != null); if (PatternState != null) { Assert.That(PatternState.ParentInner == PatternInner); Assert.That(PatternState.ParentIndex == LeafBlock.PatternIndex); } IReadOnlySourceState SourceState = LeafBlock.SourceState; Assert.That(SourceState != null); if (SourceState != null) { Assert.That(SourceState.ParentInner == SourceInner); Assert.That(SourceState.ParentIndex == LeafBlock.SourceIndex); } Assert.That(MainLeafBlocksInner.FirstNodeState == LeafBlock.StateList[0]); IReadOnlyListInner MainLeafPathInner = (IReadOnlyListInner)RootState.PropertyToInner(nameof(Main.LeafPath)); Assert.That(MainLeafPathInner != null); if (MainLeafPathInner != null) { Assert.That(!MainLeafPathInner.IsNeverEmpty); Assert.That(MainLeafPathInner.InterfaceType.IsTypeof <Leaf>()); Assert.That(MainLeafPathInner.Count == 2); Assert.That(MainLeafPathInner.StateList != null); Assert.That(MainLeafPathInner.StateList?.Count == 2); Assert.That(MainLeafPathInner.FirstNodeState == MainLeafPathInner.StateList[0]); Assert.That(MainLeafPathInner.IndexAt(0) == MainLeafPathInner.FirstNodeState.ParentIndex); Assert.That(MainLeafPathInner.AllIndexes().Count == MainLeafPathInner.Count); } ReadOnlyNodeStateReadOnlyList AllChildren = RootState.GetAllChildren(); Assert.That(AllChildren.Count == 19, $"New count: {AllChildren.Count}"); IReadOnlyPlaceholderInner PlaceholderInner = (IReadOnlyPlaceholderInner)RootState.InnerTable[nameof(Main.PlaceholderLeaf)]; Assert.That(PlaceholderInner != null); IReadOnlyBrowsingPlaceholderNodeIndex PlaceholderNodeIndex = (IReadOnlyBrowsingPlaceholderNodeIndex)PlaceholderInner.ChildState.ParentIndex; Assert.That(PlaceholderNodeIndex != null); Assert.That(Controller0.Contains(PlaceholderNodeIndex)); IReadOnlyOptionalInner UnassignedOptionalInner = (IReadOnlyOptionalInner)RootState.InnerTable[nameof(Main.UnassignedOptionalLeaf)]; Assert.That(UnassignedOptionalInner != null); IReadOnlyBrowsingOptionalNodeIndex UnassignedOptionalNodeIndex = UnassignedOptionalInner.ChildState.ParentIndex; Assert.That(UnassignedOptionalNodeIndex != null); Assert.That(Controller0.Contains(UnassignedOptionalNodeIndex)); Assert.That(Controller0.IsAssigned(UnassignedOptionalNodeIndex) == false); IReadOnlyOptionalInner AssignedOptionalInner = (IReadOnlyOptionalInner)RootState.InnerTable[nameof(Main.AssignedOptionalLeaf)]; Assert.That(AssignedOptionalInner != null); IReadOnlyBrowsingOptionalNodeIndex AssignedOptionalNodeIndex = AssignedOptionalInner.ChildState.ParentIndex; Assert.That(AssignedOptionalNodeIndex != null); Assert.That(Controller0.Contains(AssignedOptionalNodeIndex)); Assert.That(Controller0.IsAssigned(AssignedOptionalNodeIndex) == true); int Min, Max; object ReadValue; RootState.PropertyToValue(nameof(Main.ValueBoolean), out ReadValue, out Min, out Max); bool ReadAsBoolean = ((int)ReadValue) != 0; Assert.That(ReadAsBoolean == true); Assert.That(Controller0.GetDiscreteValue(RootIndex0, nameof(Main.ValueBoolean), out Min, out Max) == (ReadAsBoolean ? 1 : 0)); Assert.That(Min == 0); Assert.That(Max == 1); RootState.PropertyToValue(nameof(Main.ValueEnum), out ReadValue, out Min, out Max); BaseNode.CopySemantic ReadAsEnum = (BaseNode.CopySemantic)(int) ReadValue; Assert.That(ReadAsEnum == BaseNode.CopySemantic.Value); Assert.That(Controller0.GetDiscreteValue(RootIndex0, nameof(Main.ValueEnum), out Min, out Max) == (int)ReadAsEnum); Assert.That(Min == 0); Assert.That(Max == 2); RootState.PropertyToValue(nameof(Main.ValueString), out ReadValue, out Min, out Max); string ReadAsString = ReadValue as string; Assert.That(ReadAsString == "s"); Assert.That(Controller0.GetStringValue(RootIndex0, nameof(Main.ValueString)) == ReadAsString); RootState.PropertyToValue(nameof(Main.ValueGuid), out ReadValue, out Min, out Max); Guid ReadAsGuid = (Guid)ReadValue; Assert.That(ReadAsGuid == ValueGuid0); Assert.That(Controller0.GetGuidValue(RootIndex0, nameof(Main.ValueGuid)) == ReadAsGuid); ReadOnlyController Controller1 = ReadOnlyController.Create(RootIndex0); Assert.That(Controller0.IsEqual(CompareEqual.New(), Controller0)); Assert.That(CompareEqual.CoverIsEqual(Controller0, Controller1)); }
public static void ReadOnlyViews() { ControllerTools.ResetExpectedName(); Main RootNode; IReadOnlyRootNodeIndex RootIndex; RootNode = CreateRoot(ValueGuid0, Imperfections.None); RootIndex = new ReadOnlyRootNodeIndex(RootNode); ReadOnlyController Controller = ReadOnlyController.Create(RootIndex); using (ReadOnlyControllerView ControllerView0 = ReadOnlyControllerView.Create(Controller)) { Assert.That(ControllerView0.Controller == Controller); Assert.That(ControllerView0.RootStateView == ControllerView0.StateViewTable[Controller.RootState]); using (ReadOnlyControllerView ControllerView1 = ReadOnlyControllerView.Create(Controller)) { Assert.That(ControllerView0.IsEqual(CompareEqual.New(), ControllerView0)); Assert.That(CompareEqual.CoverIsEqual(ControllerView0, ControllerView1)); } foreach (KeyValuePair <IReadOnlyBlockState, ReadOnlyBlockStateView> Entry in ControllerView0.BlockStateViewTable) { IReadOnlyBlockState BlockState = Entry.Key; Assert.That(BlockState != null); ReadOnlyBlockStateView BlockStateView = Entry.Value; Assert.That(BlockStateView != null); Assert.That(BlockStateView.ControllerView == ControllerView0); } foreach (KeyValuePair <IReadOnlyNodeState, IReadOnlyNodeStateView> Entry in ControllerView0.StateViewTable) { IReadOnlyNodeState State = Entry.Key; Assert.That(State != null); Assert.That(State.Comment != null); IReadOnlyNodeStateView StateView = Entry.Value; Assert.That(StateView != null); Assert.That(StateView.State == State); IReadOnlyIndex ParentIndex = State.ParentIndex; Assert.That(ParentIndex != null); Assert.That(Controller.Contains(ParentIndex)); Assert.That(StateView.ControllerView == ControllerView0); switch (StateView) { case ReadOnlyPatternStateView AsPatternStateView: Assert.That(AsPatternStateView.State == State); break; case ReadOnlySourceStateView AsSourceStateView: Assert.That(AsSourceStateView.State == State); break; case ReadOnlyPlaceholderNodeStateView AsPlaceholderNodeStateView: Assert.That(AsPlaceholderNodeStateView.State == State); break; case ReadOnlyOptionalNodeStateView AsOptionalNodeStateView: Assert.That(AsOptionalNodeStateView.State == State); break; } } } }