Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresCalculationContext.cs =================================================================== diff -u -r9214f74184b5923e0fb04b86d50c5bf8e5e57cdc -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresCalculationContext.cs (.../ClosingStructuresCalculationContext.cs) (revision 9214f74184b5923e0fb04b86d50c5bf8e5e57cdc) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresCalculationContext.cs (.../ClosingStructuresCalculationContext.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8) @@ -37,7 +37,7 @@ /// Creates a new instance of . /// /// The instance wrapped by this context object. - /// The failure mechanism which the context belongs to. + /// The failure mechanism which the calculation belongs to. /// The assessment section which the calculation belongs to. /// When any input argument is null. public ClosingStructuresCalculationContext(ClosingStructuresCalculation wrappedData, Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresCalculationGroupContext.cs =================================================================== diff -u -r438a524144f283209902ae89f058a134380c9538 -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresCalculationGroupContext.cs (.../ClosingStructuresCalculationGroupContext.cs) (revision 438a524144f283209902ae89f058a134380c9538) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresCalculationGroupContext.cs (.../ClosingStructuresCalculationGroupContext.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8) @@ -38,8 +38,8 @@ /// Creates a new instance of . /// /// The instance that is wrapped by this context object. - /// The failure mechanism of the instance. - /// The assessment section of the instance. + /// The failure mechanism which contains the calculation group. + /// The assessment section which containts the calculation group. /// Thrown when any of the input parameters are null. public ClosingStructuresCalculationGroupContext(CalculationGroup calculationGroup, ClosingStructuresFailureMechanism failureMechanism, Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresContextBase.cs =================================================================== diff -u -r438a524144f283209902ae89f058a134380c9538 -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresContextBase.cs (.../ClosingStructuresContextBase.cs) (revision 438a524144f283209902ae89f058a134380c9538) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresContextBase.cs (.../ClosingStructuresContextBase.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8) @@ -37,8 +37,8 @@ /// Initializes a new instance of . /// /// The concrete data instance wrapped by the context object. - /// The failure mechanism which the context belongs to. - /// The assessment section which the context belongs to. + /// The failure mechanism which the wrapped data belongs to. + /// The assessment section which the wrapped data belongs to. /// Thrown when any of the input parameters are null. protected ClosingStructuresContextBase(T wrappedData, ClosingStructuresFailureMechanism failureMechanism, Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresInputContext.cs =================================================================== diff -u -ree5ab18ca7554ffb2ce9546dd72b341da59f0345 -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresInputContext.cs (.../ClosingStructuresInputContext.cs) (revision ee5ab18ca7554ffb2ce9546dd72b341da59f0345) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresInputContext.cs (.../ClosingStructuresInputContext.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8) @@ -27,16 +27,16 @@ { /// /// Presentation object for all data required to configure an instance of - /// in order to be able to configure height structures calculations. + /// in order to be able to configure closing structures calculations. /// public class ClosingStructuresInputContext : ClosingStructuresContextBase { /// /// Creates a new instance of . /// - /// The height structures input instance wrapped by this context object. - /// The failure mechanism which the context belongs to. - /// The assessment section which the context belongs to. + /// The closing structures input instance wrapped by this context object. + /// The failure mechanism which the calculation belongs to. + /// The assessment section which the calculation belongs to. /// When any input argument is null. public ClosingStructuresInputContext(ClosingStructuresInput input, ClosingStructuresFailureMechanism failureMechanism, Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/TreeNodeInfos/ClosingStructureFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -rb6a9219d1e628e4430ccf880e8ea390cec04fc04 -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/TreeNodeInfos/ClosingStructureFailureMechanismContextTreeNodeInfoTest.cs (.../ClosingStructureFailureMechanismContextTreeNodeInfoTest.cs) (revision b6a9219d1e628e4430ccf880e8ea390cec04fc04) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/TreeNodeInfos/ClosingStructureFailureMechanismContextTreeNodeInfoTest.cs (.../ClosingStructureFailureMechanismContextTreeNodeInfoTest.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8) @@ -82,26 +82,26 @@ { // Setup mocksRepository.ReplayAll(); - - // Assert - Assert.AreEqual(typeof(ClosingStructuresFailureMechanismContext), info.TagType); - Assert.IsNotNull(info.Text); - Assert.IsNotNull(info.ForeColor); - Assert.IsNotNull(info.Image); - Assert.IsNotNull(info.ChildNodeObjects); - Assert.IsNotNull(info.ContextMenuStrip); - Assert.IsNull(info.EnsureVisibleOnCreate); - Assert.IsNull(info.CanRename); - Assert.IsNull(info.OnNodeRenamed); - Assert.IsNull(info.CanRemove); - Assert.IsNull(info.OnNodeRemoved); - Assert.IsNull(info.CanCheck); - Assert.IsNull(info.IsChecked); - Assert.IsNull(info.OnNodeChecked); - Assert.IsNull(info.CanDrag); - Assert.IsNull(info.CanDrop); - Assert.IsNull(info.CanInsert); - Assert.IsNull(info.OnDrop); + + // Assert + Assert.AreEqual(typeof(ClosingStructuresFailureMechanismContext), info.TagType); + Assert.IsNotNull(info.Text); + Assert.IsNotNull(info.ForeColor); + Assert.IsNotNull(info.Image); + Assert.IsNotNull(info.ChildNodeObjects); + Assert.IsNotNull(info.ContextMenuStrip); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); + Assert.IsNull(info.CanCheck); + Assert.IsNull(info.IsChecked); + Assert.IsNull(info.OnNodeChecked); + Assert.IsNull(info.CanDrag); + Assert.IsNull(info.CanDrop); + Assert.IsNull(info.CanInsert); + Assert.IsNull(info.OnDrop); } [Test] @@ -113,41 +113,41 @@ var failureMechanism = new ClosingStructuresFailureMechanism(); var failureMechanismContext = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); - - // Call - var children = info.ChildNodeObjects(failureMechanismContext).ToArray(); - // Assert - Assert.AreEqual(3, children.Length); + // Call + var children = info.ChildNodeObjects(failureMechanismContext).ToArray(); - var inputsFolder = (CategoryTreeFolder) children[0]; - Assert.AreEqual("Invoer", inputsFolder.Name); - Assert.AreEqual(TreeFolderCategory.Input, inputsFolder.Category); - Assert.AreEqual(3, inputsFolder.Contents.Count); - var failureMechanismSectionsContext = (FailureMechanismSectionsContext) inputsFolder.Contents[0]; - Assert.AreSame(failureMechanism, failureMechanismSectionsContext.WrappedData); - Assert.AreSame(assessmentSectionMock, failureMechanismSectionsContext.ParentAssessmentSection); + // Assert + Assert.AreEqual(3, children.Length); - var closingStructuresContext = (ClosingStructuresContext) inputsFolder.Contents[1]; - Assert.AreSame(failureMechanism.ClosingStructures, closingStructuresContext.WrappedData); - Assert.AreSame(assessmentSectionMock, closingStructuresContext.AssessmentSection); + var inputsFolder = (CategoryTreeFolder) children[0]; + Assert.AreEqual("Invoer", inputsFolder.Name); + Assert.AreEqual(TreeFolderCategory.Input, inputsFolder.Category); + Assert.AreEqual(3, inputsFolder.Contents.Count); + var failureMechanismSectionsContext = (FailureMechanismSectionsContext) inputsFolder.Contents[0]; + Assert.AreSame(failureMechanism, failureMechanismSectionsContext.WrappedData); + Assert.AreSame(assessmentSectionMock, failureMechanismSectionsContext.ParentAssessmentSection); - var commentContext = (CommentContext) inputsFolder.Contents[2]; - Assert.AreSame(failureMechanism, commentContext.WrappedData); + var closingStructuresContext = (ClosingStructuresContext) inputsFolder.Contents[1]; + Assert.AreSame(failureMechanism.ClosingStructures, closingStructuresContext.WrappedData); + Assert.AreSame(assessmentSectionMock, closingStructuresContext.AssessmentSection); - var calculationsFolder = (ClosingStructuresCalculationGroupContext) children[1]; - Assert.AreEqual("Berekeningen", calculationsFolder.WrappedData.Name); - Assert.AreEqual(failureMechanism.CalculationsGroup, calculationsFolder.WrappedData); - Assert.AreEqual(failureMechanism, calculationsFolder.FailureMechanism); + var commentContext = (CommentContext) inputsFolder.Contents[2]; + Assert.AreSame(failureMechanism, commentContext.WrappedData); - var outputsFolder = (CategoryTreeFolder) children[2]; - Assert.AreEqual("Oordeel", outputsFolder.Name); - Assert.AreEqual(TreeFolderCategory.Output, outputsFolder.Category); - Assert.AreEqual(1, outputsFolder.Contents.Count); + var calculationsFolder = (ClosingStructuresCalculationGroupContext) children[1]; + Assert.AreEqual("Berekeningen", calculationsFolder.WrappedData.Name); + Assert.AreEqual(failureMechanism.CalculationsGroup, calculationsFolder.WrappedData); + Assert.AreEqual(failureMechanism, calculationsFolder.FailureMechanism); - var failureMechanismResultsContext = (FailureMechanismSectionResultContext) outputsFolder.Contents[0]; - Assert.AreSame(failureMechanism, failureMechanismResultsContext.FailureMechanism); - Assert.AreSame(failureMechanism.SectionResults, failureMechanismResultsContext.WrappedData); + var outputsFolder = (CategoryTreeFolder) children[2]; + Assert.AreEqual("Oordeel", outputsFolder.Name); + Assert.AreEqual(TreeFolderCategory.Output, outputsFolder.Category); + Assert.AreEqual(1, outputsFolder.Contents.Count); + + var failureMechanismResultsContext = (FailureMechanismSectionResultContext) outputsFolder.Contents[0]; + Assert.AreSame(failureMechanism, failureMechanismResultsContext.FailureMechanism); + Assert.AreSame(failureMechanism.SectionResults, failureMechanismResultsContext.WrappedData); } [Test] @@ -163,14 +163,13 @@ }; var failureMechanismContext = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); + // Call + var children = info.ChildNodeObjects(failureMechanismContext).ToArray(); - // Call - var children = info.ChildNodeObjects(failureMechanismContext).ToArray(); - - // Assert - Assert.AreEqual(1, children.Length); - var commentContext = (CommentContext) children[0]; - Assert.AreSame(failureMechanism, commentContext.WrappedData); + // Assert + Assert.AreEqual(1, children.Length); + var commentContext = (CommentContext) children[0]; + Assert.AreSame(failureMechanism, commentContext.WrappedData); } [Test] @@ -270,24 +269,24 @@ Assert.AreEqual(7, menu.Items.Count); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuRelevancyIndexWhenRelevant, - RingtoetsCommonFormsResources.FailureMechanismContextMenuStrip_Is_relevant, - RingtoetsCommonFormsResources.FailureMechanismContextMenuStrip_Is_relevant_Tooltip, + "I&s relevant", + "Geeft aan of dit toetsspoor relevant is of niet.", RingtoetsCommonFormsResources.Checkbox_ticked); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndex, - RingtoetsCommonFormsResources.Validate_all, - RingtoetsCommonFormsResources.ValidateAll_No_calculations_to_validate, + "Alles &valideren", + "Er zijn geen berekeningen om te valideren.", RingtoetsCommonFormsResources.ValidateAllIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndex, - RingtoetsCommonFormsResources.Calculate_all, - RingtoetsCommonFormsResources.FailureMechanism_CreateCalculateAllItem_No_calculations_to_run, + "Alles be&rekenen", + "Er zijn geen berekeningen om uit te voeren.", RingtoetsCommonFormsResources.CalculateAllIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuClearAllIndex, - RingtoetsCommonFormsResources.Clear_all_output, - RingtoetsCommonFormsResources.CalculationGroup_ClearOutput_No_calculation_with_output_to_clear, + "&Wis alle uitvoer...", + "Er zijn geen berekeningen met uitvoer om te wissen.", RingtoetsCommonFormsResources.ClearIcon, false); } @@ -323,8 +322,8 @@ Assert.AreEqual(2, menu.Items.Count); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuRelevancyIndexWhenNotRelevant, - RingtoetsCommonFormsResources.FailureMechanismContextMenuStrip_Is_relevant, - RingtoetsCommonFormsResources.FailureMechanismContextMenuStrip_Is_relevant_Tooltip, + "I&s relevant", + "Geeft aan of dit toetsspoor relevant is of niet.", RingtoetsCommonFormsResources.Checkbox_empty); } } @@ -394,7 +393,7 @@ } [Test] - public void ContextMenuStrip_NoFailureMechanismSections_ContextMenuItemCalculateAllDisabledAndTooltipSet() + public void ContextMenuStrip_NoFailureMechanismSections_ContextMenuItemCalculateAllAndValidateAllDisabledAndTooltipSet() { // Setup var guiMock = mocksRepository.StrictMock(); @@ -419,174 +418,22 @@ { // Assert TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndex, - RingtoetsCommonFormsResources.Calculate_all, - RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_failure_mechanism_sections_imported, + "Alles be&rekenen", + "Er is geen vakindeling geïmporteerd.", RingtoetsCommonFormsResources.CalculateAllIcon, false); - } - } - } - [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetNoHydraulicBoundaryDatabase_ContextMenuItemCalculateAllDisabledAndTooltipSet() - { - // Setup - var guiMock = mocksRepository.StrictMock(); - var failureMechanism = new ClosingStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); - failureMechanism.CalculationsGroup.Children.Add(new ClosingStructuresCalculation()); - - var assessmentSectionMock = mocksRepository.Stub(); - - var nodeData = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - - mocksRepository.ReplayAll(); - - plugin.Gui = guiMock; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuCalculateAllIndex, - RingtoetsCommonFormsResources.Calculate_all, - RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_hydraulic_boundary_database_imported, - RingtoetsCommonFormsResources.CalculateAllIcon, - false); - } - } - } - - [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetHydraulicBoundaryDatabaseNotValid_ContextMenuItemCalculateAllDisabledAndTooltipSet() - { - // Setup - var guiMock = mocksRepository.StrictMock(); - var failureMechanism = new ClosingStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); - failureMechanism.CalculationsGroup.Children.Add(new ClosingStructuresCalculation()); - - var assessmentSectionMock = mocksRepository.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); - - var nodeData = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - - mocksRepository.ReplayAll(); - - plugin.Gui = guiMock; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - ToolStripItem contextMenuItem = contextMenu.Items[contextMenuCalculateAllIndex]; - - Assert.AreEqual(RingtoetsCommonFormsResources.Calculate_all, contextMenuItem.Text); - StringAssert.Contains(string.Format(RingtoetsCommonServicesResources.Hydraulic_boundary_database_connection_failed_0_, ""), contextMenuItem.ToolTipText); - TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.CalculateAllIcon, contextMenuItem.Image); - Assert.IsFalse(contextMenuItem.Enabled); - } - } - } - - [Test] - public void ContextMenuStrip_FailureMechanismSectionsAndHydraulicDatabaseSet_ContextMenuItemCalculateAllEnabled() - { - // Setup - var guiMock = mocksRepository.StrictMock(); - var failureMechanism = new ClosingStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); - failureMechanism.CalculationsGroup.Children.Add(new ClosingStructuresCalculation()); - - string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); - - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - { - FilePath = validFilePath, - Version = "1.0" - }; - - var assessmentSectionMock = mocksRepository.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - - var nodeData = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - - mocksRepository.ReplayAll(); - - plugin.Gui = guiMock; - - // Call - using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndex, - RingtoetsCommonFormsResources.Calculate_all, - RingtoetsCommonFormsResources.Calculate_all_ToolTip, - RingtoetsCommonFormsResources.CalculateAllIcon); - } - } - } - - [Test] - public void ContextMenuStrip_NoFailureMechanismSections_ContextMenuItemValidateAllDisabledAndTooltipSet() - { - // Setup - var guiMock = mocksRepository.StrictMock(); - var failureMechanism = new ClosingStructuresFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(new ClosingStructuresCalculation()); - var assessmentSectionMock = mocksRepository.StrictMock(); - - var nodeData = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - - mocksRepository.ReplayAll(); - - plugin.Gui = guiMock; - - // Call - using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndex, - RingtoetsCommonFormsResources.Validate_all, - RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_failure_mechanism_sections_imported, + "Alles &valideren", + "Er is geen vakindeling geïmporteerd.", RingtoetsCommonFormsResources.ValidateAllIcon, false); } } } [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetNoHydraulicBoundaryDatabase_ContextMenuItemValidateAllDisabledAndTooltipSet() + public void ContextMenuStrip_FailureMechanismSectionsSetNoHydraulicBoundaryDatabase_ContextMenuItemCalculateAllAndValidateAllDisabledAndTooltipSet() { // Setup var guiMock = mocksRepository.StrictMock(); @@ -614,17 +461,23 @@ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { // Assert + TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuCalculateAllIndex, + "Alles be&rekenen", + "Er is geen hydraulische randvoorwaardendatabase geïmporteerd.", + RingtoetsCommonFormsResources.CalculateAllIcon, + false); + TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuValidateAllIndex, - RingtoetsCommonFormsResources.Validate_all, - RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_hydraulic_boundary_database_imported, + "Alles &valideren", + "Er is geen hydraulische randvoorwaardendatabase geïmporteerd.", RingtoetsCommonFormsResources.ValidateAllIcon, false); } } } [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetHydraulicBoundaryDatabaseNotValid_ContextMenuItemValidateAllDisabledAndTooltipSet() + public void ContextMenuStrip_FailureMechanismSectionsSetHydraulicBoundaryDatabaseNotValid_ContextMenuItemCalculateAllAndValidateAllDisabledAndTooltipSet() { // Setup var guiMock = mocksRepository.StrictMock(); @@ -653,18 +506,25 @@ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { // Assert - ToolStripItem contextMenuItem = contextMenu.Items[contextMenuValidateAllIndex]; + ToolStripItem calculateAllContextMenuItem = contextMenu.Items[contextMenuCalculateAllIndex]; - Assert.AreEqual(RingtoetsCommonFormsResources.Validate_all, contextMenuItem.Text); - StringAssert.Contains(string.Format(RingtoetsCommonServicesResources.Hydraulic_boundary_database_connection_failed_0_, ""), contextMenuItem.ToolTipText); - TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.ValidateAllIcon, contextMenuItem.Image); - Assert.IsFalse(contextMenuItem.Enabled); + Assert.AreEqual("Alles be&rekenen", calculateAllContextMenuItem.Text); + StringAssert.Contains(string.Format("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. {0}", ""), calculateAllContextMenuItem.ToolTipText); + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.CalculateAllIcon, calculateAllContextMenuItem.Image); + Assert.IsFalse(calculateAllContextMenuItem.Enabled); + + ToolStripItem validateAllContextMenuItem = contextMenu.Items[contextMenuValidateAllIndex]; + + Assert.AreEqual("Alles &valideren", validateAllContextMenuItem.Text); + StringAssert.Contains(string.Format("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. {0}", ""), validateAllContextMenuItem.ToolTipText); + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.ValidateAllIcon, validateAllContextMenuItem.Image); + Assert.IsFalse(validateAllContextMenuItem.Enabled); } } } [Test] - public void ContextMenuStrip_FailureMechanismSectionsAndHydraulicDatabaseSet_ContextMenuItemValidateAllEnabled() + public void ContextMenuStrip_FailureMechanismSectionsAndHydraulicDatabaseSet_ContextMenuItemCalculateAllAndValidateAllEnabled() { // Setup var guiMock = mocksRepository.StrictMock(); @@ -701,10 +561,15 @@ using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { // Assert + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndex, + "Alles be&rekenen", + "Voer alle berekeningen binnen dit toetsspoor uit.", + RingtoetsCommonFormsResources.CalculateAllIcon); + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndex, - RingtoetsCommonFormsResources.Validate_all, - RingtoetsCommonFormsResources.FailureMechanism_Validate_all_ToolTip, - RingtoetsCommonFormsResources.ValidateAllIcon); + "Alles &valideren", + "Valideer alle berekeningen binnen dit toetsspoor.", + RingtoetsCommonFormsResources.ValidateAllIcon); } } } Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/TreeNodeInfos/ClosingStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rb6a9219d1e628e4430ccf880e8ea390cec04fc04 -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/TreeNodeInfos/ClosingStructuresCalculationContextTreeNodeInfoTest.cs (.../ClosingStructuresCalculationContextTreeNodeInfoTest.cs) (revision b6a9219d1e628e4430ccf880e8ea390cec04fc04) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/TreeNodeInfos/ClosingStructuresCalculationContextTreeNodeInfoTest.cs (.../ClosingStructuresCalculationContextTreeNodeInfoTest.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8) @@ -143,8 +143,7 @@ Assert.IsNotNull(closingStructuresInputContext); Assert.AreSame(calculationContext.WrappedData.InputParameters, closingStructuresInputContext.WrappedData); - var emptyOutput = children[2] as EmptyProbabilityAssessmentOutput; - Assert.IsNotNull(emptyOutput); + Assert.IsInstanceOf(children[2]); } [Test] @@ -175,8 +174,7 @@ Assert.IsNotNull(closingStructuresInputContext); Assert.AreSame(calculationContext.WrappedData.InputParameters, closingStructuresInputContext.WrappedData); - var output = children[2] as ProbabilityAssessmentOutput; - Assert.IsNotNull(output); + Assert.IsInstanceOf(children[2]); } [Test] @@ -242,36 +240,35 @@ Assert.AreEqual(6, menu.Items.Count); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateIndex, - RingtoetsCommonFormsResources.Validate, - RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_failure_mechanism_sections_imported, + "&Valideren", + "Er is geen vakindeling geïmporteerd.", RingtoetsCommonFormsResources.ValidateIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateIndex, - RingtoetsCommonFormsResources.Calculate, - RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_failure_mechanism_sections_imported, + "Be&rekenen", + "Er is geen vakindeling geïmporteerd.", RingtoetsCommonFormsResources.CalculateIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuClearIndex, - RingtoetsCommonFormsResources.Clear_output, - RingtoetsCommonFormsResources.ClearOutput_No_output_to_clear, + "&Wis uitvoer...", + "Deze berekening heeft geen uitvoer om te wissen.", RingtoetsCommonFormsResources.ClearIcon, false); } } } [Test] - public void ContextMenuStrip_NoFailureMechanismSections_ContextMenuItemPerformCalculationDisabledAndTooltipSet() + public void ContextMenuStrip_NoFailureMechanismSections_ContextMenuItemPerformCalculationAndValidationDisabledAndTooltipSet() { // Setup var failureMechanism = new ClosingStructuresFailureMechanism(); var assessmentSectionMock = mocks.Stub(); var calculation = new ClosingStructuresCalculation(); var nodeData = new ClosingStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); - var guiMock = mocks.StrictMock(); using (var treeViewControl = new TreeViewControl()) { @@ -286,16 +283,22 @@ { // Assert TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuCalculateIndex, - RingtoetsCommonFormsResources.Calculate, - RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_failure_mechanism_sections_imported, + "Be&rekenen", + "Er is geen vakindeling geïmporteerd.", RingtoetsCommonFormsResources.CalculateIcon, false); + + TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuValidateIndex, + "&Valideren", + "Er is geen vakindeling geïmporteerd.", + RingtoetsCommonFormsResources.ValidateIcon, + false); } } } [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetNoHydraulicBoundaryDatabase_ContextMenuItemPerformCalculationDisabledAndTooltipSet() + public void ContextMenuStrip_FailureMechanismSectionsSetNoHydraulicBoundaryDatabase_ContextMenuItemPerformCalculationAndValidationDisabledAndTooltipSet() { // Setup var failureMechanism = new ClosingStructuresFailureMechanism(); @@ -322,129 +325,22 @@ { // Assert TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuCalculateIndex, - RingtoetsCommonFormsResources.Calculate, - RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_hydraulic_boundary_database_imported, + "Be&rekenen", + "Er is geen hydraulische randvoorwaardendatabase geïmporteerd.", RingtoetsCommonFormsResources.CalculateIcon, false); - } - } - } - [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetHydraulicBoundaryDatabaseNotValid_ContextMenuItemPerformCalculationDisabledAndTooltipSet() - { - // Setup - var failureMechanism = new ClosingStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); - - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); - - var calculation = new ClosingStructuresCalculation(); - var nodeData = new ClosingStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); - - using (var treeViewControl = new TreeViewControl()) - { - guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); - - mocks.ReplayAll(); - - plugin.Gui = guiMock; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - ToolStripItem contextMenuItem = contextMenu.Items[contextMenuCalculateIndex]; - - Assert.AreEqual(RingtoetsCommonFormsResources.Calculate, contextMenuItem.Text); - StringAssert.Contains(string.Format(RingtoetsCommonServicesResources.Hydraulic_boundary_database_connection_failed_0_, ""), contextMenuItem.ToolTipText); - TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.CalculateIcon, contextMenuItem.Image); - Assert.IsFalse(contextMenuItem.Enabled); - } - } - } - - [Test] - public void ContextMenuStrip_FailureMechanismSectionsAndHydraulicBoundaryDatabaseSet_ContextMenuItemPerformCalculationEnabled() - { - // Setup - string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); - - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - { - FilePath = validFilePath, - Version = "1.0" - }; - - var failureMechanism = new ClosingStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); - - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - - var calculation = new ClosingStructuresCalculation(); - var nodeData = new ClosingStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); - - using (var treeViewControl = new TreeViewControl()) - { - guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); - - mocks.ReplayAll(); - - plugin.Gui = guiMock; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuCalculateIndex, - RingtoetsCommonFormsResources.Calculate, - RingtoetsCommonFormsResources.Calculate_ToolTip, - RingtoetsCommonFormsResources.CalculateIcon); - } - } - } - - [Test] - public void ContextMenuStrip_NoFailureMechanismSections_ContextMenuItemValidateCalculationDisabledAndTooltipSet() - { - // Setup - var failureMechanism = new ClosingStructuresFailureMechanism(); - var assessmentSectionMock = mocks.Stub(); - var calculation = new ClosingStructuresCalculation(); - - var nodeData = new ClosingStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); - - using (var treeViewControl = new TreeViewControl()) - { - guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); - - mocks.ReplayAll(); - - plugin.Gui = guiMock; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuValidateIndex, - RingtoetsCommonFormsResources.Validate, - RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_failure_mechanism_sections_imported, + "&Valideren", + "Er is geen hydraulische randvoorwaardendatabase geïmporteerd.", RingtoetsCommonFormsResources.ValidateIcon, false); } } } [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetNoHydraulicBoundaryDatabase_ContextMenuItemValidateCalculationDisabledAndTooltipSet() + public void ContextMenuStrip_FailureMechanismSectionsSetHydraulicBoundaryDatabaseNotValid_ContextMenuItemPerformCalculationAndValidationDisabledAndTooltipSet() { // Setup var failureMechanism = new ClosingStructuresFailureMechanism(); @@ -454,6 +350,7 @@ })); var assessmentSectionMock = mocks.Stub(); + assessmentSectionMock.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); var calculation = new ClosingStructuresCalculation(); var nodeData = new ClosingStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); @@ -470,55 +367,25 @@ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { // Assert - TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuValidateIndex, - RingtoetsCommonFormsResources.Validate, - RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_hydraulic_boundary_database_imported, - RingtoetsCommonFormsResources.ValidateIcon, - false); - } - } - } + ToolStripItem calculateContextMenuItem = contextMenu.Items[contextMenuCalculateIndex]; - [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetHydraulicBoundaryDatabaseNotValid_ContextMenuItemValidateCalculationDisabledAndTooltipSet() - { - // Setup - var failureMechanism = new ClosingStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); + Assert.AreEqual("Be&rekenen", calculateContextMenuItem.Text); + StringAssert.Contains(string.Format("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. {0}", ""), calculateContextMenuItem.ToolTipText); + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.CalculateIcon, calculateContextMenuItem.Image); + Assert.IsFalse(calculateContextMenuItem.Enabled); - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + ToolStripItem validateContextMenuItem = contextMenu.Items[contextMenuValidateIndex]; - var calculation = new ClosingStructuresCalculation(); - var nodeData = new ClosingStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); - - using (var treeViewControl = new TreeViewControl()) - { - guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); - - mocks.ReplayAll(); - - plugin.Gui = guiMock; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - ToolStripItem contextMenuItem = contextMenu.Items[contextMenuValidateIndex]; - - Assert.AreEqual(RingtoetsCommonFormsResources.Validate, contextMenuItem.Text); - StringAssert.Contains(string.Format(RingtoetsCommonServicesResources.Hydraulic_boundary_database_connection_failed_0_, ""), contextMenuItem.ToolTipText); - TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.ValidateIcon, contextMenuItem.Image); - Assert.IsFalse(contextMenuItem.Enabled); + Assert.AreEqual("&Valideren", validateContextMenuItem.Text); + StringAssert.Contains(string.Format("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. {0}", ""), validateContextMenuItem.ToolTipText); + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.ValidateIcon, validateContextMenuItem.Image); + Assert.IsFalse(validateContextMenuItem.Enabled); } } } [Test] - public void ContextMenuStrip_FailureMechanismSectionsAndHydraulicBoundaryDatabaseSet_ContextMenuItemValidateCalculationEnabled() + public void ContextMenuStrip_FailureMechanismSectionsAndHydraulicBoundaryDatabaseSet_ContextMenuItemPerformCalculationAndValidationEnabled() { // Setup string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); @@ -553,9 +420,14 @@ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { // Assert + TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuCalculateIndex, + "Be&rekenen", + "Voer deze berekening uit.", + RingtoetsCommonFormsResources.CalculateIcon); + TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuValidateIndex, - RingtoetsCommonFormsResources.Validate, - RingtoetsCommonFormsResources.Validate_ToolTip, + "&Valideren", + "Valideer de invoer voor deze berekening.", RingtoetsCommonFormsResources.ValidateIcon); } } Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/TreeNodeInfos/ClosingStructuresCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -rb6a9219d1e628e4430ccf880e8ea390cec04fc04 -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/TreeNodeInfos/ClosingStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../ClosingStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision b6a9219d1e628e4430ccf880e8ea390cec04fc04) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/TreeNodeInfos/ClosingStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../ClosingStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8) @@ -239,32 +239,32 @@ Assert.AreEqual(10, menu.Items.Count); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationGroupIndexRootGroup, - RingtoetsCommonFormsResources.CalculationGroup_Add_CalculationGroup, - RingtoetsCommonFormsResources.CalculationGroup_Add_CalculationGroup_Tooltip, + "&Map toevoegen", + "Voeg een nieuwe berekeningsmap toe aan deze berekeningsmap.", RingtoetsCommonFormsResources.AddFolderIcon); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationIndexRootGroup, - RingtoetsCommonFormsResources.CalculationGroup_Add_Calculation, - RingtoetsCommonFormsResources.CalculationGroup_Add_Calculation_Tooltip, + "Berekening &toevoegen", + "Voeg een nieuwe berekening toe aan deze berekeningsmap.", RingtoetsCommonFormsResources.FailureMechanismIcon); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuRemoveAllChildrenRootGroupIndex, - RingtoetsCommonFormsResources.CalculationGroup_RemoveAllChildrenFromGroup_Remove_all, - RingtoetsCommonFormsResources.CalculationGroup_RemoveAllChildrenFromGroup_No_Calculation_or_Group_to_remove, + "Map &leegmaken...", + "Er zijn geen berekeningen of mappen om te verwijderen.", RingtoetsCommonFormsResources.RemoveAllIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndexRootGroup, - RingtoetsCommonFormsResources.Validate_all, - RingtoetsCommonFormsResources.ValidateAll_No_calculations_to_validate, + "Alles &valideren", + "Er zijn geen berekeningen om te valideren.", RingtoetsCommonFormsResources.ValidateAllIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndexRootGroup, - RingtoetsCommonFormsResources.Calculate_all, - RingtoetsCommonFormsResources.CalculationGroup_CalculateAll_No_calculations_to_run, + "Alles be&rekenen", + "Er zijn geen berekeningen om uit te voeren.", RingtoetsCommonFormsResources.CalculateAllIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuClearAllIndexRootGroup, - RingtoetsCommonFormsResources.Clear_all_output, - RingtoetsCommonFormsResources.CalculationGroup_ClearOutput_No_calculation_with_output_to_clear, + "&Wis alle uitvoer...", + "Er zijn geen berekeningen met uitvoer om te wissen.", RingtoetsCommonFormsResources.ClearIcon, false); } @@ -344,35 +344,35 @@ Assert.AreEqual(9, menu.Items.Count); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationGroupIndexNestedGroup, - RingtoetsCommonFormsResources.CalculationGroup_Add_CalculationGroup, - RingtoetsCommonFormsResources.CalculationGroup_Add_CalculationGroup_Tooltip, + "&Map toevoegen", + "Voeg een nieuwe berekeningsmap toe aan deze berekeningsmap.", RingtoetsCommonFormsResources.AddFolderIcon); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationIndexNestedGroup, - RingtoetsCommonFormsResources.CalculationGroup_Add_Calculation, - RingtoetsCommonFormsResources.CalculationGroup_Add_Calculation_Tooltip, + "Berekening &toevoegen", + "Voeg een nieuwe berekening toe aan deze berekeningsmap.", RingtoetsCommonFormsResources.FailureMechanismIcon); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndexNestedGroup, - RingtoetsCommonFormsResources.Validate_all, - RingtoetsCommonFormsResources.ValidateAll_No_calculations_to_validate, + "Alles &valideren", + "Er zijn geen berekeningen om te valideren.", RingtoetsCommonFormsResources.ValidateAllIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndexNestedGroup, - RingtoetsCommonFormsResources.Calculate_all, - RingtoetsCommonFormsResources.CalculationGroup_CalculateAll_No_calculations_to_run, + "Alles be&rekenen", + "Er zijn geen berekeningen om uit te voeren.", RingtoetsCommonFormsResources.CalculateAllIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuClearAllIndexNestedGroup, - RingtoetsCommonFormsResources.Clear_all_output, - RingtoetsCommonFormsResources.CalculationGroup_ClearOutput_No_calculation_with_output_to_clear, + "&Wis alle uitvoer...", + "Er zijn geen berekeningen met uitvoer om te wissen.", RingtoetsCommonFormsResources.ClearIcon, false); } } } [Test] - public void ContextMenuStrip_NoFailureMechanismSections_ContextMenuItemCalculateAllDisabledAndTooltipSet() + public void ContextMenuStrip_NoFailureMechanismSections_ContextMenuItemCalculateAllAndValidateAllDisabledAndTooltipSet() { // Setup var failureMechanism = new ClosingStructuresFailureMechanism(); @@ -404,16 +404,22 @@ { // Assert TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndexRootGroup, - RingtoetsCommonFormsResources.Calculate_all, - RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_failure_mechanism_sections_imported, + "Alles be&rekenen", + "Er is geen vakindeling geïmporteerd.", RingtoetsCommonFormsResources.CalculateAllIcon, false); + + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndexRootGroup, + "Alles &valideren", + "Er is geen vakindeling geïmporteerd.", + RingtoetsCommonFormsResources.ValidateAllIcon, + false); } } } [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetNoHydraulicBoundaryDatabase_ContextMenuItemCalculateAllDisabledAndTooltipSet() + public void ContextMenuStrip_FailureMechanismSectionsSetNoHydraulicBoundaryDatabase_ContextMenuItemCalculateAllAndValidateAllDisabledAndTooltipSet() { // Setup var group = new CalculationGroup @@ -452,208 +458,22 @@ { // Assert TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuCalculateAllIndexRootGroup, - RingtoetsCommonFormsResources.Calculate_all, - RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_hydraulic_boundary_database_imported, + "Alles be&rekenen", + "Er is geen hydraulische randvoorwaardendatabase geïmporteerd.", RingtoetsCommonFormsResources.CalculateAllIcon, false); - } - } - } - [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetHydraulicBoundaryDatabaseNotValid_ContextMenuItemCalculateAllDisabledAndTooltipSet() - { - // Setup - var group = new CalculationGroup - { - Children = - { - new ClosingStructuresCalculation() - } - }; - - var failureMechanism = new ClosingStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); - failureMechanism.CalculationsGroup.Children.Add(new ClosingStructuresCalculation()); - - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); - - var nodeData = new ClosingStructuresCalculationGroupContext(group, - failureMechanism, - assessmentSectionMock); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); - - mocks.ReplayAll(); - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - ToolStripItem contextMenuItem = contextMenu.Items[contextMenuCalculateAllIndexRootGroup]; - - Assert.AreEqual(RingtoetsCommonFormsResources.Calculate_all, contextMenuItem.Text); - StringAssert.Contains(string.Format(RingtoetsCommonServiceResources.Hydraulic_boundary_database_connection_failed_0_, ""), contextMenuItem.ToolTipText); - TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.CalculateAllIcon, contextMenuItem.Image); - Assert.IsFalse(contextMenuItem.Enabled); - } - } - } - - [Test] - public void ContextMenuStrip_FailureMechanismSectionsAndHydraulicDatabaseSet_ContextMenuItemCalculateAllEnabled() - { - // Setup - var group = new CalculationGroup - { - Children = - { - new ClosingStructuresCalculation() - } - }; - - string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); - - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - { - FilePath = validFilePath, - Version = "1.0" - }; - - var failureMechanism = new ClosingStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); - failureMechanism.CalculationsGroup.Children.Add(new ClosingStructuresCalculation()); - - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - - var nodeData = new ClosingStructuresCalculationGroupContext(group, - failureMechanism, - assessmentSectionMock); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); - - mocks.ReplayAll(); - - // Call - using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndexRootGroup, - RingtoetsCommonFormsResources.Calculate_all, - RingtoetsCommonFormsResources.CalculationGroup_CalculateAll_ToolTip, - RingtoetsCommonFormsResources.CalculateAllIcon); - } - } - } - - [Test] - public void ContextMenuStrip_NoFailureMechanismSections_ContextMenuItemValidateAllDisabledAndTooltipSet() - { - // Setup - var failureMechanism = new ClosingStructuresFailureMechanism(); - var assessmentSectionMock = mocks.Stub(); - - var group = new CalculationGroup - { - Children = - { - new ClosingStructuresCalculation() - } - }; - - var nodeData = new ClosingStructuresCalculationGroupContext(group, - failureMechanism, - assessmentSectionMock); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); - - mocks.ReplayAll(); - - // Call - using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndexRootGroup, - RingtoetsCommonFormsResources.Validate_all, - RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_failure_mechanism_sections_imported, - RingtoetsCommonFormsResources.ValidateAllIcon, - false); - } - } - } - - [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetNoHydraulicBoundaryDatabase_ContextMenuItemValidateAllDisabledAndTooltipSet() - { - // Setup - var group = new CalculationGroup - { - Children = - { - new ClosingStructuresCalculation() - } - }; - - var failureMechanism = new ClosingStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); - failureMechanism.CalculationsGroup.Children.Add(new ClosingStructuresCalculation()); - - var assessmentSectionMock = mocks.Stub(); - - var nodeData = new ClosingStructuresCalculationGroupContext(group, - failureMechanism, - assessmentSectionMock); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); - - mocks.ReplayAll(); - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuValidateAllIndexRootGroup, - RingtoetsCommonFormsResources.Validate_all, - RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_hydraulic_boundary_database_imported, + "Alles &valideren", + "Er is geen hydraulische randvoorwaardendatabase geïmporteerd.", RingtoetsCommonFormsResources.ValidateAllIcon, false); } } } [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetHydraulicBoundaryDatabaseNotValid_ContextMenuItemValidateAllDisabledAndTooltipSet() + public void ContextMenuStrip_FailureMechanismSectionsSetHydraulicBoundaryDatabaseNotValid_ContextMenuItemCalculateAllAndValidateAllDisabledAndTooltipSet() { // Setup var group = new CalculationGroup @@ -691,18 +511,25 @@ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { // Assert - ToolStripItem contextMenuItem = contextMenu.Items[contextMenuValidateAllIndexRootGroup]; + ToolStripItem calculatAllContextMenuItem = contextMenu.Items[contextMenuCalculateAllIndexRootGroup]; - Assert.AreEqual(RingtoetsCommonFormsResources.Validate_all, contextMenuItem.Text); - StringAssert.Contains(string.Format(RingtoetsCommonServiceResources.Hydraulic_boundary_database_connection_failed_0_, ""), contextMenuItem.ToolTipText); - TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.ValidateAllIcon, contextMenuItem.Image); - Assert.IsFalse(contextMenuItem.Enabled); + Assert.AreEqual("Alles be&rekenen", calculatAllContextMenuItem.Text); + StringAssert.Contains(string.Format("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. {0}", ""), calculatAllContextMenuItem.ToolTipText); + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.CalculateAllIcon, calculatAllContextMenuItem.Image); + Assert.IsFalse(calculatAllContextMenuItem.Enabled); + + ToolStripItem validateAllContextMenuItem = contextMenu.Items[contextMenuValidateAllIndexRootGroup]; + + Assert.AreEqual("Alles &valideren", validateAllContextMenuItem.Text); + StringAssert.Contains(string.Format("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. {0}", ""), validateAllContextMenuItem.ToolTipText); + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.ValidateAllIcon, validateAllContextMenuItem.Image); + Assert.IsFalse(validateAllContextMenuItem.Enabled); } } } [Test] - public void ContextMenuStrip_FailureMechanismSectionsAndHydraulicDatabaseSet_ContextMenuItemValidateAllEnabled() + public void ContextMenuStrip_FailureMechanismSectionsAndHydraulicDatabaseSet_ContextMenuItemCalculateAllAndValidateAllEnabled() { // Setup var group = new CalculationGroup @@ -748,9 +575,14 @@ using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { // Assert + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndexRootGroup, + "Alles be&rekenen", + "Voer alle berekeningen binnen deze berekeningsmap uit.", + RingtoetsCommonFormsResources.CalculateAllIcon); + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndexRootGroup, - RingtoetsCommonFormsResources.Validate_all, - RingtoetsCommonFormsResources.CalculationGroup_Validate_all_ToolTip, + "Alles &valideren", + "Valideer alle berekeningen binnen deze berekeningsmap.", RingtoetsCommonFormsResources.ValidateAllIcon); } } Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/TreeNodeInfos/ClosingStructuresInputContextTreeNodeInfoTest.cs =================================================================== diff -u -r98929f84fbf311bd19d8e61cc8499cdb40b22ea0 -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/TreeNodeInfos/ClosingStructuresInputContextTreeNodeInfoTest.cs (.../ClosingStructuresInputContextTreeNodeInfoTest.cs) (revision 98929f84fbf311bd19d8e61cc8499cdb40b22ea0) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/TreeNodeInfos/ClosingStructuresInputContextTreeNodeInfoTest.cs (.../ClosingStructuresInputContextTreeNodeInfoTest.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8) @@ -87,17 +87,8 @@ [Test] public void Text_Always_ReturnsTextFromResource() { - // Setup - var assessmentSectionMock = mocks.Stub(); - mocks.ReplayAll(); - - var context = new ClosingStructuresInputContext( - new ClosingStructuresInput(), - new ClosingStructuresFailureMechanism(), - assessmentSectionMock); - // Call - var text = info.Text(context); + var text = info.Text(null); // Assert Assert.AreEqual("Invoer", text); @@ -106,17 +97,8 @@ [Test] public void Image_Always_ReturnsSetImage() { - // Setup - var assessmentSectionMock = mocks.Stub(); - mocks.ReplayAll(); - - var context = new ClosingStructuresInputContext( - new ClosingStructuresInput(), - new ClosingStructuresFailureMechanism(), - assessmentSectionMock); - // Call - var image = info.Image(context); + var image = info.Image(null); // Assert TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, image); Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsContextTest.cs =================================================================== diff -u -r438a524144f283209902ae89f058a134380c9538 -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsContextTest.cs (.../GrassCoverErosionInwardsContextTest.cs) (revision 438a524144f283209902ae89f058a134380c9538) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsContextTest.cs (.../GrassCoverErosionInwardsContextTest.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8) @@ -40,19 +40,19 @@ { // Setup var mockRepository = new MockRepository(); - var assessmentSectionMock = mockRepository.Stub(); + var assessmentSectionStub = mockRepository.Stub(); mockRepository.ReplayAll(); var target = new ObservableObject(); var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); // Call - var context = new SimpleGrassCoverErosionInwardsContext(target, failureMechanism, assessmentSectionMock); + var context = new SimpleGrassCoverErosionInwardsContext(target, failureMechanism, assessmentSectionStub); // Assert Assert.IsInstanceOf>(context); Assert.AreSame(target, context.WrappedData); - Assert.AreSame(assessmentSectionMock, context.AssessmentSection); + Assert.AreSame(assessmentSectionStub, context.AssessmentSection); Assert.AreSame(failureMechanism, context.FailureMechanism); CollectionAssert.IsEmpty(context.AvailableHydraulicBoundaryLocations); mockRepository.VerifyAll(); @@ -63,13 +63,13 @@ { // Setup var mockRepository = new MockRepository(); - var assessmentSectionMock = mockRepository.Stub(); + var assessmentSectionStub = mockRepository.Stub(); mockRepository.ReplayAll(); var observableObject = new ObservableObject(); // Call - TestDelegate call = () => new SimpleGrassCoverErosionInwardsContext(observableObject, null, assessmentSectionMock); + TestDelegate call = () => new SimpleGrassCoverErosionInwardsContext(observableObject, null, assessmentSectionStub); // Assert var exception = Assert.Throws(call); @@ -100,13 +100,14 @@ hydraulicBoundaryDatabase.Locations.Add(new HydraulicBoundaryLocation(1, "name", 1.1, 2.2)); var mockRepository = new MockRepository(); - var assessmentSectionMock = mockRepository.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + var assessmentSectionStub = mockRepository.Stub(); mockRepository.ReplayAll(); + assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); var target = new ObservableObject(); - var context = new SimpleGrassCoverErosionInwardsContext(target, failureMechanism, assessmentSectionMock); + var context = new SimpleGrassCoverErosionInwardsContext(target, failureMechanism, assessmentSectionStub); // Call var availableHydraulicBoundaryLocations = context.AvailableHydraulicBoundaryLocations; Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsInputContextTest.cs =================================================================== diff -u -r438a524144f283209902ae89f058a134380c9538 -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsInputContextTest.cs (.../GrassCoverErosionInwardsInputContextTest.cs) (revision 438a524144f283209902ae89f058a134380c9538) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsInputContextTest.cs (.../GrassCoverErosionInwardsInputContextTest.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8) @@ -44,37 +44,37 @@ public void ConstructorWithData_Always_ExpectedPropertiesSet() { // Setup - var assessmentSectionMock = mocksRepository.Stub(); + var assessmentSectionStub = mocksRepository.Stub(); mocksRepository.ReplayAll(); var input = new GrassCoverErosionInwardsInput(); var calculation = new GrassCoverErosionInwardsCalculation(); var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); // Call - var context = new GrassCoverErosionInwardsInputContext(input, calculation, failureMechanism, assessmentSectionMock); + var context = new GrassCoverErosionInwardsInputContext(input, calculation, failureMechanism, assessmentSectionStub); // Assert Assert.IsInstanceOf>(context); Assert.AreSame(input, context.WrappedData); Assert.AreSame(calculation, context.Calculation); Assert.AreSame(failureMechanism, context.FailureMechanism); - Assert.AreSame(assessmentSectionMock, context.AssessmentSection); + Assert.AreSame(assessmentSectionStub, context.AssessmentSection); mocksRepository.VerifyAll(); } [Test] public void Constructor_NullCalculation_ThrowsArgumentNullException() { // Setup - var assessmentSectionMock = mocksRepository.Stub(); + var assessmentSectionStub = mocksRepository.Stub(); mocksRepository.ReplayAll(); var input = new GrassCoverErosionInwardsInput(); var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); // Call - TestDelegate test = () => new GrassCoverErosionInwardsInputContext(input, null, failureMechanism, assessmentSectionMock); + TestDelegate test = () => new GrassCoverErosionInwardsInputContext(input, null, failureMechanism, assessmentSectionStub); // Assert var exception = Assert.Throws(test); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresContextBaseTest.cs =================================================================== diff -u -r438a524144f283209902ae89f058a134380c9538 -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresContextBaseTest.cs (.../HeightStructuresContextBaseTest.cs) (revision 438a524144f283209902ae89f058a134380c9538) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresContextBaseTest.cs (.../HeightStructuresContextBaseTest.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8) @@ -40,19 +40,19 @@ { // Setup var mockRepository = new MockRepository(); - var assessmentSectionMock = mockRepository.Stub(); + var assessmentSectionStub = mockRepository.Stub(); mockRepository.ReplayAll(); var target = new ObservableObject(); var failureMechanism = new HeightStructuresFailureMechanism(); // Call - var context = new SimpleHeightStructuresContext(target, failureMechanism, assessmentSectionMock); + var context = new SimpleHeightStructuresContext(target, failureMechanism, assessmentSectionStub); // Assert Assert.IsInstanceOf>(context); Assert.AreSame(target, context.WrappedData); - Assert.AreSame(assessmentSectionMock, context.AssessmentSection); + Assert.AreSame(assessmentSectionStub, context.AssessmentSection); Assert.AreSame(failureMechanism, context.FailureMechanism); mockRepository.VerifyAll(); } @@ -62,13 +62,13 @@ { // Setup var mockRepository = new MockRepository(); - var assessmentSectionMock = mockRepository.Stub(); + var assessmentSectionStub = mockRepository.Stub(); mockRepository.ReplayAll(); var observableObject = new ObservableObject(); // Call - TestDelegate call = () => new SimpleHeightStructuresContext(observableObject, null, assessmentSectionMock); + TestDelegate call = () => new SimpleHeightStructuresContext(observableObject, null, assessmentSectionStub); // Assert var exception = Assert.Throws(call); @@ -99,10 +99,11 @@ hydraulicBoundaryDatabase.Locations.Add(new HydraulicBoundaryLocation(1, "name", 1.1, 2.2)); var mockRepository = new MockRepository(); - var assessmentSectionStub = mockRepository.Stub(); - assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + var assessmentSectionStub = mockRepository.Stub(); mockRepository.ReplayAll(); + assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + var target = new ObservableObject(); var failureMechanism = new HeightStructuresFailureMechanism(); var context = new SimpleHeightStructuresContext(target, failureMechanism, assessmentSectionStub); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rb2f617ad0d8d6457422a569685763b9718740560 -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision b2f617ad0d8d6457422a569685763b9718740560) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8) @@ -114,12 +114,12 @@ [Test] public void ChildNodeObjects_CalculationWithoutOutput_ReturnCollectionWithEmptyOutputObject() { - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); mocks.ReplayAll(); var failureMechanism = new HeightStructuresFailureMechanism(); var calculation = new HeightStructuresCalculation(); - var calculationContext = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); + var calculationContext = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); // Call var children = info.ChildNodeObjects(calculationContext).ToArray(); @@ -142,7 +142,7 @@ [Test] public void ChildNodeObjects_CalculationWithOutput_ReturnCollectionWithOutputObject() { - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); mocks.ReplayAll(); var failureMechanism = new HeightStructuresFailureMechanism(); @@ -151,7 +151,7 @@ Output = new TestHeightStructuresOutput() }; - var calculationContext = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); + var calculationContext = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); // Call var children = info.ChildNodeObjects(calculationContext).ToArray(); @@ -177,9 +177,9 @@ // Setup var guiMock = mocks.StrictMock(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var calculation = new HeightStructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); + var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); var menuBuilderMock = mocks.StrictMock(); menuBuilderMock.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilderMock); @@ -216,9 +216,9 @@ // Setup var guiMock = mocks.StrictMock(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var calculation = new HeightStructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); + var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) @@ -230,7 +230,7 @@ plugin.Gui = guiMock; // Call - using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, assessmentSectionMock, treeViewControl)) + using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, assessmentSectionStub, treeViewControl)) { // Assert Assert.AreEqual(6, menu.Items.Count); @@ -261,10 +261,10 @@ { // Setup var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var calculation = new HeightStructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); + var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); var guiMock = mocks.StrictMock(); using (var treeViewControl = new TreeViewControl()) @@ -300,10 +300,10 @@ new Point2D(0, 0) })); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var calculation = new HeightStructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); + var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); using (var treeViewControl = new TreeViewControl()) { @@ -338,18 +338,19 @@ new Point2D(0, 0) })); - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + var assessmentSectionStub = mocks.Stub(); var calculation = new HeightStructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); + var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); mocks.ReplayAll(); + assessmentSectionStub.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + plugin.Gui = guiMock; // Call @@ -386,18 +387,19 @@ new Point2D(0, 0) })); - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + var assessmentSectionStub = mocks.Stub(); var calculation = new HeightStructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); + var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); mocks.ReplayAll(); + assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + plugin.Gui = guiMock; // Call @@ -417,10 +419,10 @@ { // Setup var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var calculation = new HeightStructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); + var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); var guiMock = mocks.StrictMock(); using (var treeViewControl = new TreeViewControl()) @@ -456,10 +458,10 @@ new Point2D(0, 0) })); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var calculation = new HeightStructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); + var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); using (var treeViewControl = new TreeViewControl()) { @@ -494,18 +496,19 @@ new Point2D(0, 0) })); - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + var assessmentSectionStub = mocks.Stub(); var calculation = new HeightStructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); + var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); mocks.ReplayAll(); + assessmentSectionStub.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + plugin.Gui = guiMock; // Call @@ -542,18 +545,19 @@ new Point2D(0, 0) })); - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + var assessmentSectionStub = mocks.Stub(); var calculation = new HeightStructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); + var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); mocks.ReplayAll(); + assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + plugin.Gui = guiMock; // Call @@ -596,8 +600,7 @@ }; hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + var assessmentSectionStub = mocks.Stub(); var calculation = new HeightStructuresCalculation { @@ -609,7 +612,7 @@ } }; - var calculationContext = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); + var calculationContext = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); using (var treeViewControl = new TreeViewControl()) { @@ -618,6 +621,8 @@ mocks.ReplayAll(); + assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + plugin.Gui = gui; calculation.Attach(observerMock); @@ -677,8 +682,7 @@ }; hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + var assessmentSectionStub = mocks.Stub(); var calculation = new HeightStructuresCalculation { @@ -688,14 +692,16 @@ } }; - var calculationContext = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); + var calculationContext = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); using (var treeViewControl = new TreeViewControl()) { gui.Expect(g => g.Get(calculationContext, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); mocks.ReplayAll(); + assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + plugin.Gui = gui; calculation.Attach(observerMock); @@ -725,13 +731,13 @@ var failureMechanism = new HeightStructuresFailureMechanism(); var elementToBeRemoved = new HeightStructuresCalculation(); var observerMock = mocks.StrictMock(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var calculationContext = new HeightStructuresCalculationContext(elementToBeRemoved, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var groupContext = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); observerMock.Expect(o => o.UpdateObserver()); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -rb2f617ad0d8d6457422a569685763b9718740560 -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision b2f617ad0d8d6457422a569685763b9718740560) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8) @@ -67,7 +67,7 @@ private const int contextMenuClearAllIndexNestedGroup = 5; private readonly string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.IO, "HydraulicBoundaryLocationReader"); - private IGui guiMock; + private IGui guiStub; private TreeNodeInfo info; private MockRepository mocks; private HeightStructuresPlugin plugin; @@ -76,10 +76,10 @@ public void SetUp() { mocks = new MockRepository(); - guiMock = mocks.Stub(); + guiStub = mocks.Stub(); plugin = new HeightStructuresPlugin { - Gui = guiMock + Gui = guiStub }; info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(HeightStructuresCalculationGroupContext)); @@ -118,12 +118,12 @@ // Setup var group = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); mocks.ReplayAll(); var groupContext = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); // Call var children = info.ChildNodeObjects(groupContext); @@ -136,7 +136,7 @@ public void ChildNodeObjects_GroupWithMixedContents_ReturnChildren() { // Setup - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var calculationItemMock = mocks.Stub(); mocks.ReplayAll(); @@ -151,7 +151,7 @@ var groupContext = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); // Call var children = info.ChildNodeObjects(groupContext).ToArray(); @@ -161,11 +161,11 @@ var calculationGroupContext = (HeightStructuresCalculationGroupContext) children[0]; Assert.AreSame(childGroup, calculationGroupContext.WrappedData); Assert.AreSame(failureMechanism, calculationGroupContext.FailureMechanism); - Assert.AreSame(assessmentSectionMock, calculationGroupContext.AssessmentSection); + Assert.AreSame(assessmentSectionStub, calculationGroupContext.AssessmentSection); Assert.AreSame(calculationItemMock, children[1]); var calculationContext = (HeightStructuresCalculationContext) children[2]; Assert.AreSame(childCalculation, calculationContext.WrappedData); - Assert.AreSame(assessmentSectionMock, calculationContext.AssessmentSection); + Assert.AreSame(assessmentSectionStub, calculationContext.AssessmentSection); } [Test] @@ -174,10 +174,10 @@ // Setup var group = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var groupContext = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var menuBuilderMock = mocks.StrictMock(); menuBuilderMock.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilderMock); @@ -199,8 +199,8 @@ using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(cmp => cmp.Get(groupContext, treeViewControl)).Return(menuBuilderMock); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); + guiStub.Expect(cmp => cmp.Get(groupContext, treeViewControl)).Return(menuBuilderMock); + guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -217,16 +217,16 @@ // Setup var group = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var groupContext = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(g => g.Get(groupContext, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); + guiStub.Expect(g => g.Get(groupContext, treeViewControl)).Return(menuBuilder); + guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -281,17 +281,17 @@ var group = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); failureMechanism.HeightStructures.Add(new TestHeightStructure()); - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + var assessmentSectionStub = mocks.Stub(); + assessmentSectionStub.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); var groupContext = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(g => g.Get(groupContext, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); + guiStub.Expect(g => g.Get(groupContext, treeViewControl)).Return(menuBuilder); + guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -316,13 +316,13 @@ var group = new CalculationGroup(); var parentGroup = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var groupContext = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var parentGroupContext = new HeightStructuresCalculationGroupContext(parentGroup, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var menuBuilderMock = mocks.StrictMock(); menuBuilderMock.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilderMock); @@ -343,7 +343,7 @@ using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(cmp => cmp.Get(groupContext, treeViewControl)).Return(menuBuilderMock); + guiStub.Expect(cmp => cmp.Get(groupContext, treeViewControl)).Return(menuBuilderMock); mocks.ReplayAll(); @@ -361,20 +361,20 @@ var group = new CalculationGroup(); var parentGroup = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var groupContext = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var parentGroupContext = new HeightStructuresCalculationGroupContext(parentGroup, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); mocks.ReplayAll(); using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(g => g.Get(groupContext, treeViewControl)).Return(menuBuilder); + guiStub.Expect(g => g.Get(groupContext, treeViewControl)).Return(menuBuilder); // Call using (ContextMenuStrip menu = info.ContextMenuStrip(groupContext, parentGroupContext, treeViewControl)) @@ -415,7 +415,7 @@ { // Setup var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var group = new CalculationGroup { @@ -427,14 +427,14 @@ var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); + guiStub.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -470,19 +470,18 @@ })); failureMechanism.CalculationsGroup.Children.Add(new HeightStructuresCalculation()); - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = null; + var assessmentSectionStub = mocks.Stub(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); + guiStub.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -518,22 +517,22 @@ })); failureMechanism.CalculationsGroup.Children.Add(new HeightStructuresCalculation()); - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); - + var assessmentSectionStub = mocks.Stub(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); + guiStub.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); + assessmentSectionStub.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + // Call using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { @@ -575,22 +574,22 @@ })); failureMechanism.CalculationsGroup.Children.Add(new HeightStructuresCalculation()); - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - + var assessmentSectionStub = mocks.Stub(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); + guiStub.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); + assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + // Call using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { @@ -608,7 +607,7 @@ { // Setup var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var group = new CalculationGroup { @@ -620,14 +619,14 @@ var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); + guiStub.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -663,18 +662,18 @@ })); failureMechanism.CalculationsGroup.Children.Add(new HeightStructuresCalculation()); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); + guiStub.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -710,22 +709,22 @@ })); failureMechanism.CalculationsGroup.Children.Add(new HeightStructuresCalculation()); - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); - + var assessmentSectionStub = mocks.Stub(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); + guiStub.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); + assessmentSectionStub.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + // Call using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { @@ -767,22 +766,22 @@ })); failureMechanism.CalculationsGroup.Children.Add(new HeightStructuresCalculation()); - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - + var assessmentSectionStub = mocks.Stub(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); + guiStub.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); + assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + // Call using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { @@ -835,23 +834,23 @@ var hydraulicBoundaryDatabaseStub = mocks.Stub(); hydraulicBoundaryDatabaseStub.FilePath = validFilePath; - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = hydraulicBoundaryDatabaseStub; - + var assessmentSectionStub = mocks.Stub(); var groupContext = new HeightStructuresCalculationGroupContext(failureMechanism.CalculationsGroup, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(g => g.Get(groupContext, treeViewControl)).Return(menuBuilder); - guiMock.Expect(g => g.MainWindow).Return(mainWindowStub); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); + guiStub.Expect(g => g.Get(groupContext, treeViewControl)).Return(menuBuilder); + guiStub.Expect(g => g.MainWindow).Return(mainWindowStub); + guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); - plugin.Gui = guiMock; + assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabaseStub; + plugin.Gui = guiStub; + DialogBoxHandler = (name, wnd) => { // Expect an activity dialog which is automatically closed @@ -921,22 +920,22 @@ var hydraulicBoundaryDatabaseStub = mocks.Stub(); hydraulicBoundaryDatabaseStub.FilePath = validFilePath; - var assessmentSectionMock = mocks.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = hydraulicBoundaryDatabaseStub; - + var assessmentSectionStub = mocks.Stub(); var groupContext = new HeightStructuresCalculationGroupContext(failureMechanism.CalculationsGroup, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(g => g.Get(groupContext, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); + guiStub.Expect(g => g.Get(groupContext, treeViewControl)).Return(menuBuilder); + guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); - plugin.Gui = guiMock; + assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabaseStub; + plugin.Gui = guiStub; + using (ContextMenuStrip contextMenu = info.ContextMenuStrip(groupContext, null, treeViewControl)) { // Call @@ -962,10 +961,10 @@ var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var group = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var calculationGroup = new CalculationGroup { Name = "Nieuwe map" @@ -976,8 +975,8 @@ using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); + guiStub.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -1009,10 +1008,10 @@ var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var group = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var calculation = new HeightStructuresCalculation { Name = "Nieuwe berekening" @@ -1022,8 +1021,8 @@ using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); + guiStub.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -1055,10 +1054,10 @@ var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var group = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var calculation = new HeightStructuresCalculation { Name = "Nieuwe berekening" @@ -1071,15 +1070,15 @@ using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); - guiMock.Stub(cmp => cmp.ViewCommands).Return(viewCommandsMock); + guiStub.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiStub.Stub(cmp => cmp.ViewCommands).Return(viewCommandsMock); mocks.ReplayAll(); group.Children.Add(calculation); nodeData.Attach(observerMock); - plugin.Gui = guiMock; + plugin.Gui = guiStub; DialogBoxHandler = (name, wnd) => { @@ -1104,15 +1103,15 @@ // Setup var observerMock = mocks.StrictMock(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var group = new CalculationGroup(); var parentGroup = new CalculationGroup(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var parentNodeData = new HeightStructuresCalculationGroupContext(parentGroup, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); observerMock.Expect(o => o.UpdateObserver()); @@ -1136,16 +1135,16 @@ { // Setup var observerMock = mocks.StrictMock(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSectionStub = mocks.Stub(); var failureMechanism = new HeightStructuresFailureMechanism(); var group = new CalculationGroup(); var parentGroup = new CalculationGroup(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var parentNodeData = new HeightStructuresCalculationGroupContext(parentGroup, failureMechanism, - assessmentSectionMock); + assessmentSectionStub); var calculation = new HeightStructuresCalculation(); observerMock.Expect(o => o.UpdateObserver()); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresInputContextTreeNodeInfoTest.cs =================================================================== diff -u -r98929f84fbf311bd19d8e61cc8499cdb40b22ea0 -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresInputContextTreeNodeInfoTest.cs (.../HeightStructuresInputContextTreeNodeInfoTest.cs) (revision 98929f84fbf311bd19d8e61cc8499cdb40b22ea0) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresInputContextTreeNodeInfoTest.cs (.../HeightStructuresInputContextTreeNodeInfoTest.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8) @@ -88,13 +88,13 @@ public void Text_Always_ReturnsTextFromResource() { // Setup - var assessmentSectionMock = mocksRepository.Stub(); + var assessmentSectionStub = mocksRepository.Stub(); mocksRepository.ReplayAll(); var heightStructuresInputContext = new HeightStructuresInputContext( new HeightStructuresInput(), new HeightStructuresFailureMechanism(), - assessmentSectionMock); + assessmentSectionStub); // Call var text = info.Text(heightStructuresInputContext); @@ -107,13 +107,13 @@ public void Image_Always_ReturnsSetImage() { // Setup - var assessmentSectionMock = mocksRepository.Stub(); + var assessmentSectionStub = mocksRepository.Stub(); mocksRepository.ReplayAll(); var heightStructuresInputContext = new HeightStructuresInputContext( new HeightStructuresInput(), new HeightStructuresFailureMechanism(), - assessmentSectionMock); + assessmentSectionStub); // Call var image = info.Image(heightStructuresInputContext); Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -r6b9fda141298524c0910937dd090d82be420c52b -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 6b9fda141298524c0910937dd090d82be420c52b) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8) @@ -612,7 +612,9 @@ }; yield return RingtoetsTreeNodeInfoFactory.CreateEmptyProbabilityAssessmentOutputTreeNodeInfo( - EmptyProbabilityAssessmentOutputContextMenuStrip); + (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddPropertiesItem() + .Build()); yield return CreateFailureMechanismSectionResultTreeNodeInfo(); yield return CreateFailureMechanismSectionResultTreeNodeInfo(); @@ -1335,16 +1337,5 @@ } #endregion - - #region EmptyProbabilityAssessmentOutput TreeNodeInfo - - private ContextMenuStrip EmptyProbabilityAssessmentOutputContextMenuStrip(EmptyProbabilityAssessmentOutput output, object parentData, TreeViewControl treeViewControl) - { - var builder = new RingtoetsContextMenuBuilder(Gui.Get(output, treeViewControl)); - return builder.AddPropertiesItem() - .Build(); - } - - #endregion } } \ No newline at end of file Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/PresentationObjects/StabilityPointStructuresCalculationContext.cs =================================================================== diff -u -r438a524144f283209902ae89f058a134380c9538 -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/PresentationObjects/StabilityPointStructuresCalculationContext.cs (.../StabilityPointStructuresCalculationContext.cs) (revision 438a524144f283209902ae89f058a134380c9538) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/PresentationObjects/StabilityPointStructuresCalculationContext.cs (.../StabilityPointStructuresCalculationContext.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8) @@ -31,7 +31,8 @@ /// in order to prepare it for performing a calculation. /// public class StabilityPointStructuresCalculationContext : StabilityPointStructuresContextBase, - ICalculationContext + ICalculationContext { /// /// Creates a new instance of . Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/PresentationObjects/StabilityPointStructuresCalculationGroupContext.cs =================================================================== diff -u -r438a524144f283209902ae89f058a134380c9538 -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/PresentationObjects/StabilityPointStructuresCalculationGroupContext.cs (.../StabilityPointStructuresCalculationGroupContext.cs) (revision 438a524144f283209902ae89f058a134380c9538) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/PresentationObjects/StabilityPointStructuresCalculationGroupContext.cs (.../StabilityPointStructuresCalculationGroupContext.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8) @@ -32,7 +32,8 @@ /// in order be able to create configurable stability point structures calculations. /// public class StabilityPointStructuresCalculationGroupContext : StabilityPointStructuresContextBase, - ICalculationContext + ICalculationContext { /// /// Creates a new instance of .