Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -rf718135c08ce7b90cc0eaf40bfb83c9af48a1776 -r2f4ab8ae59075bc9fe42f07604d2d72bb685531d --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsFailureMechanismContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision f718135c08ce7b90cc0eaf40bfb83c9af48a1776) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsFailureMechanismContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision 2f4ab8ae59075bc9fe42f07604d2d72bb685531d) @@ -199,8 +199,8 @@ Assert.AreSame(failureMechanism, foreshoreProfilesContext.ParentFailureMechanism); Assert.AreSame(assessmentSection, foreshoreProfilesContext.ParentAssessmentSection); - var commentContext = (CommentContext) inputsFolder.Contents[2]; - Assert.AreSame(failureMechanism, commentContext.WrappedData); + var inputCommentContext = (CommentContext)inputsFolder.Contents[2]; + Assert.AreSame(failureMechanism.InputComments, inputCommentContext.WrappedData); var hydraulicBoundariesGroupContext = (HydraulicBoundariesGroupContext) children[1]; Assert.AreSame(failureMechanism.HydraulicBoundaryLocations, hydraulicBoundariesGroupContext.WrappedData); @@ -210,16 +210,19 @@ var outputsFolder = (CategoryTreeFolder) children[2]; Assert.AreEqual("Oordeel", outputsFolder.Name); Assert.AreEqual(TreeFolderCategory.Output, outputsFolder.Category); - Assert.AreEqual(1, outputsFolder.Contents.Count); + Assert.AreEqual(2, outputsFolder.Contents.Count); var failureMechanismResultsContext = (FailureMechanismSectionResultContext) outputsFolder.Contents[0]; Assert.AreSame(failureMechanism, failureMechanismResultsContext.FailureMechanism); Assert.AreSame(failureMechanism.SectionResults, failureMechanismResultsContext.WrappedData); + + var outputCommentContext = (CommentContext)outputsFolder.Contents[1]; + Assert.AreSame(failureMechanism.OutputComments, outputCommentContext.WrappedData); } [Test] - public void ChildNodeObjects_FailureMechanismIsNotRelevant_ReturnChildDataNodes() + public void ChildNodeObjects_FailureMechanismIsNotRelevant_ReturnOnlyFailureMechanismNotRelevantComments() { // Setup var assessmentSection = mocks.Stub(); @@ -238,7 +241,7 @@ // Assert Assert.AreEqual(1, children.Length); var commentContext = (CommentContext) children[0]; - Assert.AreSame(failureMechanism, commentContext.WrappedData); + Assert.AreSame(failureMechanism.NotRelevantComments, commentContext.WrappedData); } [Test] @@ -317,18 +320,15 @@ } [Test] - public void ContextMenuStrip_FailureMechanismIsRelevantAndClickOnIsRelevantItem_MakeFailureMechanismNotRelevant() + public void ContextMenuStrip_FailureMechanismIsRelevantAndClickOnIsRelevantItem_MakeFailureMechanismNotRelevantAndRemovesAllViewsForItem() { // Setup using (var treeViewControl = new TreeViewControl()) { var failureMechanismObserver = mocks.Stub(); failureMechanismObserver.Expect(o => o.UpdateObserver()); - var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism - { - IsRelevant = true - }; + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); failureMechanism.Attach(failureMechanismObserver); var assessmentSection = mocks.Stub(); @@ -360,7 +360,7 @@ } [Test] - public void ContextMenuStrip_FailureMechanismIsNotRelevantAndClickOnIsRelevantItem_MakeFailureMechanismRelevant() + public void ContextMenuStrip_FailureMechanismIsNotRelevantAndClickOnIsRelevantItem_MakeFailureMechanismRelevantAndRemovesAllViewsForItem() { // Setup using (var treeViewControl = new TreeViewControl()) @@ -378,9 +378,13 @@ var failureMechanismContext = new GrassCoverErosionOutwardsFailureMechanismContext(failureMechanism, assessmentSection); + var viewCommands = mocks.StrictMock(); + viewCommands.Expect(vs => vs.RemoveAllViewsForItem(failureMechanismContext)); + var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var gui = mocks.StrictMock(); + gui.Stub(g => g.ViewCommands).Return(viewCommands); gui.Expect(g => g.Get(failureMechanismContext, treeViewControl)).Return(menuBuilder); mocks.ReplayAll();