Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs =================================================================== diff -u -r0b85daf67145cfa567ef273790729e1e76a3467d -r6952c1fa40cd233e974abf1a31867bcd49b5795e --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision 0b85daf67145cfa567ef273790729e1e76a3467d) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision 6952c1fa40cd233e974abf1a31867bcd49b5795e) @@ -100,7 +100,10 @@ ForeColor = context => context.WrappedData.Any() ? Color.FromKnownColor(KnownColor.ControlText) : Color.FromKnownColor(KnownColor.GrayText), - ChildNodeObjects = context => context.WrappedData.Cast().ToArray(), + ChildNodeObjects = context => context.WrappedData + .Select(dp => new DikeProfileContext(dp, context.WrappedData)) + .Cast() + .ToArray(), ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) .AddImportItem() .AddSeparator() Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/DikeProfilesContextTreeNodeInfoTest.cs =================================================================== diff -u -r0b85daf67145cfa567ef273790729e1e76a3467d -r6952c1fa40cd233e974abf1a31867bcd49b5795e --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/DikeProfilesContextTreeNodeInfoTest.cs (.../DikeProfilesContextTreeNodeInfoTest.cs) (revision 0b85daf67145cfa567ef273790729e1e76a3467d) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/DikeProfilesContextTreeNodeInfoTest.cs (.../DikeProfilesContextTreeNodeInfoTest.cs) (revision 6952c1fa40cd233e974abf1a31867bcd49b5795e) @@ -58,8 +58,8 @@ Assert.IsNotNull(info.Text); Assert.IsNotNull(info.Image); Assert.IsNotNull(info.ForeColor); + Assert.IsNotNull(info.ChildNodeObjects); Assert.IsNotNull(info.ContextMenuStrip); - Assert.IsNull(info.ChildNodeObjects); Assert.IsNull(info.EnsureVisibleOnCreate); Assert.IsNull(info.CanRename); Assert.IsNull(info.OnNodeRenamed); @@ -165,7 +165,7 @@ } [Test] - public void ChildNodeObjects_Always_ReturnDikeProfiles() + public void ChildNodeObjects_Always_ReturnDikeProfileContexts() { // Setup var mocks = new MockRepository(); @@ -186,12 +186,18 @@ var children = info.ChildNodeObjects(dikeProfilesContext); // Assert - var expectedChildren = new[] - { - dikeProfile1, - dikeProfile2 - }; - CollectionAssert.AreEqual(expectedChildren, children); + Assert.AreEqual(2, children.Length); + + var dikeProfileContext = children.ElementAt(0) as DikeProfileContext; + Assert.IsNotNull(dikeProfileContext); + Assert.AreSame(dikeProfile1, dikeProfileContext.WrappedData); + Assert.AreSame(dikeProfiles, dikeProfileContext.DikeProfilesList); + + dikeProfileContext = children.ElementAt(1) as DikeProfileContext; + Assert.IsNotNull(dikeProfileContext); + Assert.AreSame(dikeProfile2, dikeProfileContext.WrappedData); + Assert.AreSame(dikeProfiles, dikeProfileContext.DikeProfilesList); + mocks.ReplayAll(); }