Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightContext.cs =================================================================== diff -u -r1e096895772e9946fe12cd79003d895e094b5d4b -rf4dd417401193ac7ae205acb1b38ad6155b9134f --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightContext.cs (.../WaveHeightContext.cs) (revision 1e096895772e9946fe12cd79003d895e094b5d4b) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightContext.cs (.../WaveHeightContext.cs) (revision f4dd417401193ac7ae205acb1b38ad6155b9134f) @@ -30,11 +30,11 @@ /// public class WaveHeightContext : ObservableWrappedObjectContextBase { - /// + /// /// Creates a new instance of . /// /// The which the belongs to. /// Thrown when is null. - public WaveHeightContext(IAssessmentSection wrappedAssessmentSection) : base(wrappedAssessmentSection) { } + public WaveHeightContext(IAssessmentSection wrappedAssessmentSection) : base(wrappedAssessmentSection) {} } } \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -rec29001a9e148ed508108e4fd64c2bc751a6c026 -rf4dd417401193ac7ae205acb1b38ad6155b9134f --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision ec29001a9e148ed508108e4fd64c2bc751a6c026) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision f4dd417401193ac7ae205acb1b38ad6155b9134f) @@ -431,7 +431,6 @@ { Text = hydraulicBoundaryDatabase => RingtoetsFormsResources.HydraulicBoundaryDatabase_DisplayName, Image = hydraulicBoundaryDatabase => RingtoetsCommonFormsResources.GenericInputOutputIcon, - CanRename = (context, o) => false, ForeColor = context => context.WrappedData.HydraulicBoundaryDatabase == null ? Color.FromKnownColor(KnownColor.GrayText) : Color.FromKnownColor(KnownColor.ControlText), @@ -443,7 +442,6 @@ { Text = designWaterLevel => RingtoetsFormsResources.DesignWaterLevel_DisplayName, Image = designWaterLevel => RingtoetsCommonFormsResources.GenericInputOutputIcon, - CanRename = (context, o) => false, ForeColor = context => context.WrappedData.HydraulicBoundaryDatabase != null && context.WrappedData.HydraulicBoundaryDatabase.Locations.Any(l => !double.IsNaN(l.DesignWaterLevel)) ? Color.FromKnownColor(KnownColor.ControlText) : @@ -455,7 +453,6 @@ { Text = waveHeight => RingtoetsFormsResources.WaveHeightContext_DisplayName, Image = waveHeight => RingtoetsCommonFormsResources.GenericInputOutputIcon, - CanRename = (context, o) => false, ForeColor = context => context.WrappedData.HydraulicBoundaryDatabase != null && context.WrappedData.HydraulicBoundaryDatabase.Locations.Any(l => !double.IsNaN(l.WaveHeight)) ? Color.FromKnownColor(KnownColor.ControlText) : Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelContextTreeNodeInfoTest.cs =================================================================== diff -u -r7abe36a7f4949221955e0c974564f61c1350e81c -rf4dd417401193ac7ae205acb1b38ad6155b9134f --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelContextTreeNodeInfoTest.cs (.../DesignWaterLevelContextTreeNodeInfoTest.cs) (revision 7abe36a7f4949221955e0c974564f61c1350e81c) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelContextTreeNodeInfoTest.cs (.../DesignWaterLevelContextTreeNodeInfoTest.cs) (revision f4dd417401193ac7ae205acb1b38ad6155b9134f) @@ -22,7 +22,6 @@ using System; using System.Drawing; using System.Linq; -using Core.Common.Base; using Core.Common.Controls.TreeView; using Core.Common.Gui; using Core.Common.Gui.ContextMenu; @@ -55,8 +54,6 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Setup - mocks.ReplayAll(); - using (var plugin = new RingtoetsPlugin()) { var info = GetInfo(plugin); @@ -70,13 +67,19 @@ Assert.IsNull(info.CanDrop); Assert.IsNull(info.CanInsert); Assert.IsNull(info.OnDrop); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); } - mocks.VerifyAll(); } [Test] public void Text_Always_ReturnsSetName() { + // Setup using (var plugin = new RingtoetsPlugin()) { var info = GetInfo(plugin); @@ -92,6 +95,7 @@ [Test] public void Image_Always_ReturnsGenericIcon() { + // Setup using (var plugin = new RingtoetsPlugin()) { var info = GetInfo(plugin); @@ -105,21 +109,6 @@ } [Test] - public void CanRenameNode_Always_ReturnsFalse() - { - using (var plugin = new RingtoetsPlugin()) - { - var info = GetInfo(plugin); - - // Call - var renameAllowed = info.CanRename(null, null); - - // Assert - Assert.IsFalse(renameAllowed); - } - } - - [Test] public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() { // Setup Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs =================================================================== diff -u -r7abe36a7f4949221955e0c974564f61c1350e81c -rf4dd417401193ac7ae205acb1b38ad6155b9134f --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs) (revision 7abe36a7f4949221955e0c974564f61c1350e81c) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs) (revision f4dd417401193ac7ae205acb1b38ad6155b9134f) @@ -63,8 +63,6 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Setup - mocks.ReplayAll(); - using (var plugin = new RingtoetsPlugin()) { var info = GetInfo(plugin); @@ -78,17 +76,20 @@ Assert.IsNull(info.CanDrop); Assert.IsNull(info.CanInsert); Assert.IsNull(info.OnDrop); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRemoved); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); } - mocks.VerifyAll(); } [Test] public void Text_Always_ReturnsSetName() { // Setup - var name = "Hydraulische randvoorwaarden"; + const string name = "Hydraulische randvoorwaarden"; var assessmentSectionMock = mocks.StrictMock(); - mocks.ReplayAll(); var context = new HydraulicBoundaryDatabaseContext(assessmentSectionMock); @@ -110,8 +111,6 @@ public void Image_Always_ReturnsGenericIcon() { // Setup - mocks.ReplayAll(); - using (var plugin = new RingtoetsPlugin()) { var info = GetInfo(plugin); @@ -122,29 +121,9 @@ // Assert TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, image); } - mocks.VerifyAll(); } [Test] - public void CanRenameNode_Always_ReturnsFalse() - { - // Setup - mocks.ReplayAll(); - - using (var plugin = new RingtoetsPlugin()) - { - var info = GetInfo(plugin); - - // Call - var renameAllowed = info.CanRename(null, null); - - // Assert - Assert.IsFalse(renameAllowed); - } - mocks.VerifyAll(); - } - - [Test] public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() { // Setup @@ -229,6 +208,35 @@ } [Test] + public void ChildNodeObjects_Always_ReturnsChildrenOnData() + { + // Setup + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + mocks.ReplayAll(); + + var hydraulicBoundaryDatabaseContext = new HydraulicBoundaryDatabaseContext(assessmentSection); + + mocks.ReplayAll(); + + using (var plugin = new RingtoetsPlugin()) + { + var info = GetInfo(plugin); + // Call + var objects = info.ChildNodeObjects(hydraulicBoundaryDatabaseContext).ToArray(); + + // Assert + Assert.AreEqual(2, objects.Length); + var designWaterLevelContext = (DesignWaterLevelContext)objects[0]; + Assert.AreSame(assessmentSection, designWaterLevelContext.WrappedData); + + var waveHeightContext = (WaveHeightContext)objects[1]; + Assert.AreSame(assessmentSection, waveHeightContext.WrappedData); + } + mocks.VerifyAll(); + } + + [Test] [RequiresSTA] public void GivenNoFilePathIsSet_WhenOpeningValidFileFromContextMenu_ThenPathWillBeSetAndNotifiesObserverAndLogMessageAdded() { @@ -246,7 +254,7 @@ IGui gui = mocks.DynamicMock(); gui.Expect(cmp => cmp.Get(hydraulicBoundaryDatabaseContext, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); mocks.ReplayAll(); - + DialogBoxHandler = (name, wnd) => { OpenFileDialogTester tester = new OpenFileDialogTester(wnd); @@ -376,9 +384,7 @@ AssessmentSection assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); using (HydraulicBoundaryDatabaseImporter importer = new HydraulicBoundaryDatabaseImporter()) - { importer.Import(assessmentSection, validFile); - } assessmentSection.Attach(assessmentObserver); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/RingtoetsProjectTreeNodeInfoTest.cs =================================================================== diff -u -r14980c98236ec646b19933ace1f6d95fadb52a52 -rf4dd417401193ac7ae205acb1b38ad6155b9134f --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/RingtoetsProjectTreeNodeInfoTest.cs (.../RingtoetsProjectTreeNodeInfoTest.cs) (revision 14980c98236ec646b19933ace1f6d95fadb52a52) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/RingtoetsProjectTreeNodeInfoTest.cs (.../RingtoetsProjectTreeNodeInfoTest.cs) (revision f4dd417401193ac7ae205acb1b38ad6155b9134f) @@ -64,6 +64,11 @@ Assert.IsNull(info.CanDrop); Assert.IsNull(info.CanInsert); Assert.IsNull(info.OnDrop); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightContextTreeNodeInfoTest.cs =================================================================== diff -u -r7abe36a7f4949221955e0c974564f61c1350e81c -rf4dd417401193ac7ae205acb1b38ad6155b9134f --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightContextTreeNodeInfoTest.cs (.../WaveHeightContextTreeNodeInfoTest.cs) (revision 7abe36a7f4949221955e0c974564f61c1350e81c) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightContextTreeNodeInfoTest.cs (.../WaveHeightContextTreeNodeInfoTest.cs) (revision f4dd417401193ac7ae205acb1b38ad6155b9134f) @@ -53,8 +53,6 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Setup - mockRepository.ReplayAll(); - using (var plugin = new RingtoetsPlugin()) { var info = GetInfo(plugin); @@ -68,13 +66,19 @@ Assert.IsNull(info.CanDrop); Assert.IsNull(info.CanInsert); Assert.IsNull(info.OnDrop); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); } - mockRepository.VerifyAll(); } [Test] public void Text_Always_ReturnsSetName() { + // Setup using (var plugin = new RingtoetsPlugin()) { var info = GetInfo(plugin); @@ -91,6 +95,7 @@ [Test] public void Image_Always_ReturnsGenericIcon() { + // Setup using (var plugin = new RingtoetsPlugin()) { var info = GetInfo(plugin); @@ -104,21 +109,6 @@ } [Test] - public void CanRenameNode_Always_ReturnsFalse() - { - using (var plugin = new RingtoetsPlugin()) - { - var info = GetInfo(plugin); - - // Call - var renameAllowed = info.CanRename(null, null); - - // Assert - Assert.IsFalse(renameAllowed); - } - } - - [Test] public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() { // Setup @@ -365,7 +355,6 @@ mockRepository.VerifyAll(); } - private static TreeNodeInfo GetInfo(RingtoetsPlugin plugin) { return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(WaveHeightContext));