Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs =================================================================== diff -u -r54fd939cf2a3d8f718dad28faa24373334d4cc2e -rf452f75d3148465074688d37194bcd3d3ae46346 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision 54fd939cf2a3d8f718dad28faa24373334d4cc2e) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision f452f75d3148465074688d37194bcd3d3ae46346) @@ -47,7 +47,6 @@ using Ringtoets.HeightStructures.Service; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; -using RingtoetsCommonServiceResources = Ringtoets.Common.Service.Properties.Resources; using RingtoetsCommonIOResources = Ringtoets.Common.IO.Properties.Resources; namespace Ringtoets.HeightStructures.Plugin @@ -214,14 +213,8 @@ } } - private static string ValidateAllDataAvailableAndGetErrorMessage(IAssessmentSection assessmentSection, - HeightStructuresFailureMechanism failureMechanism) + private static string ValidateAllDataAvailableAndGetErrorMessage(IAssessmentSection assessmentSection) { - if (!failureMechanism.Sections.Any()) - { - return RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_failure_mechanism_sections_imported; - } - return HydraulicBoundaryDatabaseConnectionValidator.Validate(assessmentSection.HydraulicBoundaryDatabase); } @@ -403,7 +396,7 @@ private static string ValidateAllDataAvailableAndGetErrorMessageForCalculationsInFailureMechanism(HeightStructuresFailureMechanismContext context) { - return ValidateAllDataAvailableAndGetErrorMessage(context.Parent, context.WrappedData); + return ValidateAllDataAvailableAndGetErrorMessage(context.Parent); } private static void ValidateAll(HeightStructuresFailureMechanismContext context) @@ -574,7 +567,7 @@ private static string ValidateAllDataAvailableAndGetErrorMessageForCalculationsInGroup(HeightStructuresCalculationGroupContext context) { - return ValidateAllDataAvailableAndGetErrorMessage(context.AssessmentSection, context.FailureMechanism); + return ValidateAllDataAvailableAndGetErrorMessage(context.AssessmentSection); } private static void ValidateAll(HeightStructuresCalculationGroupContext context) @@ -639,7 +632,7 @@ private static string ValidateAllDataAvailableAndGetErrorMessageForCalculation(HeightStructuresCalculationContext context) { - return ValidateAllDataAvailableAndGetErrorMessage(context.AssessmentSection, context.FailureMechanism); + return ValidateAllDataAvailableAndGetErrorMessage(context.AssessmentSection); } private static void Validate(HeightStructuresCalculationContext context) Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -rf452f75d3148465074688d37194bcd3d3ae46346 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision f452f75d3148465074688d37194bcd3d3ae46346) @@ -215,9 +215,9 @@ // Setup var guiMock = mocks.StrictMock(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); var calculation = new StructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); + var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) @@ -229,80 +229,42 @@ plugin.Gui = guiMock; // Call - using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, assessmentSectionStub, treeViewControl)) + using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, assessmentSection, treeViewControl)) { // Assert Assert.AreEqual(11, menu.Items.Count); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateIndex, - RingtoetsCommonFormsResources.Validate, - RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_failure_mechanism_sections_imported, + "&Valideren", + "Er is geen hydraulische randvoorwaardendatabase geïmporteerd.", RingtoetsCommonFormsResources.ValidateIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateIndex, - RingtoetsCommonFormsResources.Calculate, - RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_failure_mechanism_sections_imported, + "Be&rekenen", + "Er is geen hydraulische randvoorwaardendatabase 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_NoHydraulicBoundaryDatabase_ContextMenuItemPerformCalculationDisabledAndTooltipSet() { // Setup - var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionStub = mocks.Stub(); - var calculation = new StructuresCalculation(); - - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); var guiMock = mocks.StrictMock(); - 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.Plugin_AllDataAvailable_No_failure_mechanism_sections_imported, - RingtoetsCommonFormsResources.CalculateIcon, - false); - } - } - } - - [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetNoHydraulicBoundaryDatabase_ContextMenuItemPerformCalculationDisabledAndTooltipSet() - { - // Setup - var guiMock = mocks.StrictMock(); - + var assessmentSection = mocks.Stub(); var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); - - var assessmentSectionStub = mocks.Stub(); - var calculation = new StructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); + var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSection); using (var treeViewControl = new TreeViewControl()) { @@ -326,29 +288,23 @@ } [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetHydraulicBoundaryDatabaseNotValid_ContextMenuItemPerformCalculationDisabledAndTooltipSet() + public void ContextMenuStrip_HydraulicBoundaryDatabaseNotValid_ContextMenuItemPerformCalculationDisabledAndTooltipSet() { // Setup var guiMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); - - var assessmentSectionStub = mocks.Stub(); - var calculation = new StructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); + var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSection); using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); mocks.ReplayAll(); - assessmentSectionStub.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); plugin.Gui = guiMock; @@ -358,8 +314,8 @@ // 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); + Assert.AreEqual("Be&rekenen", contextMenuItem.Text); + StringAssert.Contains("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt.", contextMenuItem.ToolTipText); TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.CalculateIcon, contextMenuItem.Image); Assert.IsFalse(contextMenuItem.Enabled); } @@ -380,87 +336,43 @@ Version = "1.0" }; - var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - var assessmentSectionStub = mocks.Stub(); - + var failureMechanism = new HeightStructuresFailureMechanism(); var calculation = new StructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); + var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSection); using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); mocks.ReplayAll(); - assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - plugin.Gui = guiMock; // Call using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { // Assert TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuCalculateIndex, - RingtoetsCommonFormsResources.Calculate, - RingtoetsCommonFormsResources.Calculate_ToolTip, + "Be&rekenen", + "Voer deze berekening uit.", RingtoetsCommonFormsResources.CalculateIcon); } } } [Test] - public void ContextMenuStrip_NoFailureMechanismSections_ContextMenuItemValidateCalculationDisabledAndTooltipSet() + public void ContextMenuStrip_NoHydraulicBoundaryDatabase_ContextMenuItemValidateCalculationDisabledAndTooltipSet() { // Setup - var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionStub = mocks.Stub(); - var calculation = new StructuresCalculation(); - - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); var guiMock = mocks.StrictMock(); - 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, - RingtoetsCommonFormsResources.ValidateIcon, - false); - } - } - } - - [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetNoHydraulicBoundaryDatabase_ContextMenuItemValidateCalculationDisabledAndTooltipSet() - { - // Setup - var guiMock = mocks.StrictMock(); - + var assessmentSection = mocks.Stub(); var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); - - var assessmentSectionStub = mocks.Stub(); - var calculation = new StructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); + var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSection); using (var treeViewControl = new TreeViewControl()) { @@ -484,30 +396,24 @@ } [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetHydraulicBoundaryDatabaseNotValid_ContextMenuItemValidateCalculationDisabledAndTooltipSet() + public void ContextMenuStrip_HydraulicBoundaryDatabaseNotValid_ContextMenuItemValidateCalculationDisabledAndTooltipSet() { // Setup var guiMock = mocks.StrictMock(); - var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); - var assessmentSectionStub = mocks.Stub(); - + var failureMechanism = new HeightStructuresFailureMechanism(); var calculation = new StructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); + var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSection); 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 @@ -516,16 +422,16 @@ // 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); + Assert.AreEqual("&Valideren", contextMenuItem.Text); + StringAssert.Contains("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt.", contextMenuItem.ToolTipText); TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.ValidateIcon, contextMenuItem.Image); Assert.IsFalse(contextMenuItem.Enabled); } } } [Test] - public void ContextMenuStrip_FailureMechanismSectionsAndHydraulicBoundaryDatabaseSet_ContextMenuItemValidateCalculationEnabled() + public void ContextMenuStrip_HydraulicBoundaryDatabaseSet_ContextMenuItemValidateCalculationEnabled() { // Setup var guiMock = mocks.StrictMock(); @@ -538,34 +444,28 @@ Version = "1.0" }; - var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - var assessmentSectionStub = mocks.Stub(); - var calculation = new StructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); + var failureMechanism = new HeightStructuresFailureMechanism(); + var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSection); using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); mocks.ReplayAll(); - assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - plugin.Gui = guiMock; // Call using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { // Assert TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuValidateIndex, - RingtoetsCommonFormsResources.Validate, - RingtoetsCommonFormsResources.Validate_ToolTip, + "&Valideren", + "Valideer de invoer voor deze berekening.", RingtoetsCommonFormsResources.ValidateIcon); } } @@ -577,17 +477,10 @@ // Given var gui = mocks.DynamicMock(); var mainWindow = mocks.DynamicMock(); - var observerMock = mocks.StrictMock(); - observerMock.Expect(o => o.UpdateObserver()); + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); - var section = new FailureMechanismSection("A", new[] - { - new Point2D(1, 2), - new Point2D(3, 4) - }); - var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(section); string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); @@ -599,9 +492,10 @@ }; hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); - var assessmentSectionStub = mocks.Stub(); - assessmentSectionStub.Stub(a => a.Id).Return(string.Empty); - assessmentSectionStub.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(Enumerable.Empty(), 1, 1)); + var assessmentSection = mocks.Stub(); + assessmentSection.Stub(a => a.Id).Return(string.Empty); + assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(Enumerable.Empty(), 1, 1)); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; var initialOutput = new ProbabilityAssessmentOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN); var calculation = new TestHeightStructuresCalculation @@ -612,8 +506,9 @@ HydraulicBoundaryLocation = hydraulicBoundaryLocation } }; + calculation.Attach(observer); - var calculationContext = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); + var calculationContext = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSection); using (var treeViewControl = new TreeViewControl()) { @@ -622,12 +517,8 @@ mocks.ReplayAll(); - assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - plugin.Gui = gui; - - calculation.Attach(observerMock); - + DialogBoxHandler = (name, wnd) => { // Expect an activity dialog which is automatically closed @@ -662,19 +553,9 @@ { // Given var gui = mocks.DynamicMock(); - var observerMock = mocks.StrictMock(); + var observer = mocks.StrictMock(); - var section = new FailureMechanismSection("A", new[] - { - new Point2D(1, 2), - new Point2D(3, 4) - }); - - var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(section); - string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); - var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, string.Empty, 0.0, 1.1); var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase { @@ -683,7 +564,8 @@ }; hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; var calculation = new TestHeightStructuresCalculation { @@ -692,21 +574,19 @@ HydraulicBoundaryLocation = hydraulicBoundaryLocation } }; + calculation.Attach(observer); - var calculationContext = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); + var failureMechanism = new HeightStructuresFailureMechanism(); + var calculationContext = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSection); 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); - using (ContextMenuStrip contextMenuStrip = info.ContextMenuStrip(calculationContext, null, treeViewControl)) { // When @@ -731,22 +611,22 @@ var group = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); var elementToBeRemoved = new StructuresCalculation(); - var observerMock = mocks.StrictMock(); - var assessmentSectionStub = mocks.Stub(); + var observer = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); var calculationContext = new HeightStructuresCalculationContext(elementToBeRemoved, failureMechanism, - assessmentSectionStub); + assessmentSection); var groupContext = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); - observerMock.Expect(o => o.UpdateObserver()); + observer.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); group.Children.Add(elementToBeRemoved); group.Children.Add(new StructuresCalculation()); - group.Attach(observerMock); + group.Attach(observer); // Precondition Assert.IsTrue(info.CanRemove(calculationContext, groupContext)); @@ -767,13 +647,13 @@ var group = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); var elementToBeRemoved = new StructuresCalculation(); - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); var calculationContext = new HeightStructuresCalculationContext(elementToBeRemoved, failureMechanism, - assessmentSectionStub); + assessmentSection); var groupContext = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); mocks.ReplayAll(); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -rf452f75d3148465074688d37194bcd3d3ae46346 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision f452f75d3148465074688d37194bcd3d3ae46346) @@ -120,12 +120,12 @@ // Setup var group = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); mocks.ReplayAll(); var groupContext = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); // Call var children = info.ChildNodeObjects(groupContext); @@ -138,8 +138,8 @@ public void ChildNodeObjects_GroupWithMixedContents_ReturnChildren() { // Setup - var assessmentSectionStub = mocks.Stub(); - var calculationItemMock = mocks.Stub(); + var assessmentSection = mocks.Stub(); + var calculationItem = mocks.Stub(); mocks.ReplayAll(); var failureMechanism = new HeightStructuresFailureMechanism(); @@ -148,12 +148,12 @@ var childCalculation = new StructuresCalculation(); group.Children.Add(childGroup); - group.Children.Add(calculationItemMock); + group.Children.Add(calculationItem); group.Children.Add(childCalculation); var groupContext = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); // Call var children = info.ChildNodeObjects(groupContext).ToArray(); @@ -163,11 +163,11 @@ var calculationGroupContext = (HeightStructuresCalculationGroupContext) children[0]; Assert.AreSame(childGroup, calculationGroupContext.WrappedData); Assert.AreSame(failureMechanism, calculationGroupContext.FailureMechanism); - Assert.AreSame(assessmentSectionStub, calculationGroupContext.AssessmentSection); - Assert.AreSame(calculationItemMock, children[1]); + Assert.AreSame(assessmentSection, calculationGroupContext.AssessmentSection); + Assert.AreSame(calculationItem, children[1]); var calculationContext = (HeightStructuresCalculationContext) children[2]; Assert.AreSame(childCalculation, calculationContext.WrappedData); - Assert.AreSame(assessmentSectionStub, calculationContext.AssessmentSection); + Assert.AreSame(assessmentSection, calculationContext.AssessmentSection); } [Test] @@ -176,10 +176,10 @@ // Setup var group = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); var groupContext = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); var menuBuilderMock = mocks.StrictMock(); menuBuilderMock.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilderMock); @@ -219,10 +219,10 @@ // Setup var group = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); var groupContext = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) @@ -278,11 +278,11 @@ var group = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); failureMechanism.HeightStructures.Add(new TestHeightStructure()); - var assessmentSectionStub = mocks.Stub(); - assessmentSectionStub.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); var groupContext = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) @@ -313,13 +313,13 @@ var group = new CalculationGroup(); var parentGroup = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); var groupContext = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); var parentGroupContext = new HeightStructuresCalculationGroupContext(parentGroup, failureMechanism, - assessmentSectionStub); + assessmentSection); var menuBuilderMock = mocks.StrictMock(); menuBuilderMock.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilderMock); @@ -358,13 +358,13 @@ var group = new CalculationGroup(); var parentGroup = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); var groupContext = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); var parentGroupContext = new HeightStructuresCalculationGroupContext(parentGroup, failureMechanism, - assessmentSectionStub); + assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); mocks.ReplayAll(); @@ -408,12 +408,9 @@ } [Test] - public void ContextMenuStrip_NoFailureMechanismSections_ContextMenuItemCalculateAllDisabledAndTooltipSet() + public void ContextMenuStrip_NoHydraulicBoundaryDatabase_ContextMenuItemCalculateAllDisabledAndTooltipSet() { // Setup - var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionStub = mocks.Stub(); - var group = new CalculationGroup { Children = @@ -422,56 +419,13 @@ } }; - var nodeData = new HeightStructuresCalculationGroupContext(group, - failureMechanism, - assessmentSectionStub); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - guiStub.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); - - mocks.ReplayAll(); - - // Call - using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndexRootGroup, - "Alles be&rekenen", - "Er is geen vakindeling geïmporteerd.", - RingtoetsCommonFormsResources.CalculateAllIcon, - false); - } - } - } - - [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetNoHydraulicBoundaryDatabase_ContextMenuItemCalculateAllDisabledAndTooltipSet() - { - // Setup - var group = new CalculationGroup - { - Children = - { - new StructuresCalculation() - } - }; - var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); - var assessmentSectionStub = mocks.Stub(); - + var assessmentSection = mocks.Stub(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); @@ -496,7 +450,7 @@ } [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetHydraulicBoundaryDatabaseNotValid_ContextMenuItemCalculateAllDisabledAndTooltipSet() + public void ContextMenuStrip_HydraulicBoundaryDatabaseNotValid_ContextMenuItemCalculateAllDisabledAndTooltipSet() { // Setup var group = new CalculationGroup @@ -508,16 +462,12 @@ }; var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); @@ -528,7 +478,7 @@ mocks.ReplayAll(); - assessmentSectionStub.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); // Call using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) @@ -545,7 +495,7 @@ } [Test] - public void ContextMenuStrip_FailureMechanismSectionsAndHydraulicDatabaseSet_ContextMenuItemCalculateAllEnabled() + public void ContextMenuStrip_HydraulicDatabaseSet_ContextMenuItemCalculateAllEnabled() { // Setup var group = new CalculationGroup @@ -565,16 +515,12 @@ }; var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); @@ -585,7 +531,7 @@ mocks.ReplayAll(); - assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; // Call using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) @@ -600,12 +546,9 @@ } [Test] - public void ContextMenuStrip_NoFailureMechanismSections_ContextMenuItemValidateAllDisabledAndTooltipSet() + public void ContextMenuStrip_NoHydraulicBoundaryDatabase_ContextMenuItemValidateAllDisabledAndTooltipSet() { // Setup - var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionStub = mocks.Stub(); - var group = new CalculationGroup { Children = @@ -614,56 +557,14 @@ } }; - var nodeData = new HeightStructuresCalculationGroupContext(group, - failureMechanism, - assessmentSectionStub); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - guiStub.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); - - mocks.ReplayAll(); - - // Call - using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndexRootGroup, - "Alles &valideren", - "Er is geen vakindeling geïmporteerd.", - RingtoetsCommonFormsResources.ValidateAllIcon, - false); - } - } - } - - [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetNoHydraulicBoundaryDatabase_ContextMenuItemValidateAllDisabledAndTooltipSet() - { - // Setup - var group = new CalculationGroup - { - Children = - { - new StructuresCalculation() - } - }; - var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); @@ -688,7 +589,7 @@ } [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetHydraulicBoundaryDatabaseNotValid_ContextMenuItemValidateAllDisabledAndTooltipSet() + public void ContextMenuStrip_HydraulicBoundaryDatabaseNotValid_ContextMenuItemValidateAllDisabledAndTooltipSet() { // Setup var group = new CalculationGroup @@ -700,16 +601,13 @@ }; var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); @@ -720,8 +618,7 @@ mocks.ReplayAll(); - assessmentSectionStub.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); - + // Call using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { @@ -737,7 +634,7 @@ } [Test] - public void ContextMenuStrip_FailureMechanismSectionsAndHydraulicDatabaseSet_ContextMenuItemValidateAllEnabled() + public void ContextMenuStrip_HydraulicDatabaseSet_ContextMenuItemValidateAllEnabled() { // Setup var group = new CalculationGroup @@ -757,16 +654,14 @@ }; var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); @@ -777,8 +672,7 @@ mocks.ReplayAll(); - assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - + // Call using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { @@ -799,13 +693,6 @@ var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var failureMechanism = new HeightStructuresFailureMechanism(); - - failureMechanism.AddSection(new FailureMechanismSection("A", new[] - { - new Point2D(0, 0), - new Point2D(2, 2) - })); - failureMechanism.CalculationsGroup.Children.Add(new TestHeightStructuresCalculation { Name = "A", @@ -826,16 +713,17 @@ string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); - var hydraulicBoundaryDatabaseStub = mocks.Stub(); - hydraulicBoundaryDatabaseStub.FilePath = validFilePath; + var hydraulicBoundaryDatabase = mocks.Stub(); + hydraulicBoundaryDatabase.FilePath = validFilePath; - var assessmentSectionStub = mocks.Stub(); - assessmentSectionStub.Stub(a => a.Id).Return(string.Empty); - assessmentSectionStub.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(Enumerable.Empty(), 1, 1)); + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + assessmentSection.Stub(a => a.Id).Return(string.Empty); + assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(Enumerable.Empty(), 1, 1)); var groupContext = new HeightStructuresCalculationGroupContext(failureMechanism.CalculationsGroup, failureMechanism, - assessmentSectionStub); + assessmentSection); using (var treeViewControl = new TreeViewControl()) { @@ -845,8 +733,6 @@ mocks.ReplayAll(); - assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabaseStub; - plugin.Gui = guiStub; DialogBoxHandler = (name, wnd) => @@ -888,12 +774,6 @@ var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var failureMechanism = new HeightStructuresFailureMechanism(); - - failureMechanism.AddSection(new FailureMechanismSection("A", new[] - { - new Point2D(0, 0) - })); - failureMechanism.CalculationsGroup.Children.Add(new TestHeightStructuresCalculation { Name = "A", @@ -914,13 +794,15 @@ string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); - var hydraulicBoundaryDatabaseStub = mocks.Stub(); - hydraulicBoundaryDatabaseStub.FilePath = validFilePath; + var hydraulicBoundaryDatabase = mocks.Stub(); + hydraulicBoundaryDatabase.FilePath = validFilePath; - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + var groupContext = new HeightStructuresCalculationGroupContext(failureMechanism.CalculationsGroup, failureMechanism, - assessmentSectionStub); + assessmentSection); using (var treeViewControl = new TreeViewControl()) { @@ -929,8 +811,6 @@ mocks.ReplayAll(); - assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabaseStub; - plugin.Gui = guiStub; using (ContextMenuStrip contextMenu = info.ContextMenuStrip(groupContext, null, treeViewControl)) @@ -958,17 +838,17 @@ var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var group = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); var calculationGroup = new CalculationGroup { Name = "Nieuwe map" }; - var observerMock = mocks.StrictMock(); - observerMock.Expect(o => o.UpdateObserver()); + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); using (var treeViewControl = new TreeViewControl()) { @@ -978,7 +858,7 @@ mocks.ReplayAll(); group.Children.Add(calculationGroup); - nodeData.Attach(observerMock); + nodeData.Attach(observer); using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { @@ -1005,16 +885,16 @@ var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var group = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); var calculation = new StructuresCalculation { Name = "Nieuwe berekening" }; - var observerMock = mocks.StrictMock(); - observerMock.Expect(o => o.UpdateObserver()); + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); using (var treeViewControl = new TreeViewControl()) { @@ -1024,7 +904,7 @@ mocks.ReplayAll(); group.Children.Add(calculation); - nodeData.Attach(observerMock); + nodeData.Attach(observer); using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { @@ -1050,7 +930,7 @@ // Given using (var treeViewControl = new TreeViewControl()) { - var assessmentSectionMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); HeightStructure structure1 = new TestHeightStructure("Structure 1"); HeightStructure structure2 = new TestHeightStructure("Structure 2"); @@ -1066,7 +946,7 @@ var nodeData = new HeightStructuresCalculationGroupContext(failureMechanism.CalculationsGroup, failureMechanism, - assessmentSectionMock); + assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var mainWindow = mocks.Stub(); @@ -1108,7 +988,7 @@ // Given using (var treeViewControl = new TreeViewControl()) { - var assessmentSectionMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); HeightStructure structure1 = new TestHeightStructure("Structure 1"); HeightStructure structure2 = new TestHeightStructure("Structure 2"); @@ -1124,7 +1004,7 @@ var nodeData = new HeightStructuresCalculationGroupContext(failureMechanism.CalculationsGroup, failureMechanism, - assessmentSectionMock); + assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var mainWindow = mocks.Stub(); @@ -1164,7 +1044,7 @@ // Given using (var treeViewControl = new TreeViewControl()) { - var assessmentSectionMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); var existingCalculationName = "Height structure"; HeightStructure heightStructure = new TestHeightStructure(existingCalculationName); @@ -1189,7 +1069,7 @@ var nodeData = new HeightStructuresCalculationGroupContext(failureMechanism.CalculationsGroup, failureMechanism, - assessmentSectionMock); + assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var mainWindow = mocks.Stub(); @@ -1231,24 +1111,24 @@ public void OnNodeRemoved_NestedCalculationGroup_RemoveGroupAndNotifyObservers() { // Setup - var observerMock = mocks.StrictMock(); + var observer = mocks.StrictMock(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); var group = new CalculationGroup(); var parentGroup = new CalculationGroup(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); var parentNodeData = new HeightStructuresCalculationGroupContext(parentGroup, failureMechanism, - assessmentSectionStub); + assessmentSection); - observerMock.Expect(o => o.UpdateObserver()); + observer.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); parentGroup.Children.Add(group); - parentNodeData.Attach(observerMock); + parentNodeData.Attach(observer); // Precondition Assert.IsTrue(info.CanRemove(nodeData, parentNodeData)); @@ -1265,25 +1145,25 @@ { // Setup var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionStub = mocks.Stub(); + failureMechanism.AddSection(new FailureMechanismSection("section", new[] + { + new Point2D(0, 0) + })); + + var assessmentSection = mocks.Stub(); var group = new CalculationGroup(); var parentGroup = new CalculationGroup(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); var parentNodeData = new HeightStructuresCalculationGroupContext(parentGroup, failureMechanism, - assessmentSectionStub); + assessmentSection); mocks.ReplayAll(); parentGroup.Children.Add(group); - failureMechanism.AddSection(new FailureMechanismSection("section", new[] - { - new Point2D(0, 0) - })); - var calculation = new StructuresCalculation(); group.Children.Add(calculation); @@ -1301,26 +1181,26 @@ public void OnNodeRemoved_NestedCalculationGroupContainingCalculations_RemoveGroupAndCalculationsAndNotifyObservers() { // Setup - var observerMock = mocks.StrictMock(); - var assessmentSectionStub = mocks.Stub(); + var observer = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); var failureMechanism = new HeightStructuresFailureMechanism(); var group = new CalculationGroup(); var parentGroup = new CalculationGroup(); var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, - assessmentSectionStub); + assessmentSection); var parentNodeData = new HeightStructuresCalculationGroupContext(parentGroup, failureMechanism, - assessmentSectionStub); + assessmentSection); var calculation = new StructuresCalculation(); - observerMock.Expect(o => o.UpdateObserver()); + observer.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); group.Children.Add(calculation); parentGroup.Children.Add(group); - parentNodeData.Attach(observerMock); + parentNodeData.Attach(observer); // Precondition Assert.IsTrue(info.CanRemove(nodeData, parentNodeData)); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -rf452f75d3148465074688d37194bcd3d3ae46346 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs (.../HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs (.../HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs) (revision f452f75d3148465074688d37194bcd3d3ae46346) @@ -107,11 +107,11 @@ public void ChildNodeObjects_FailureMechanismIsRelevant_ReturnChildDataNodes() { // Setup - var assessmentSectionStub = mocksRepository.Stub(); + var assessmentSection = mocksRepository.Stub(); mocksRepository.ReplayAll(); var failureMechanism = new HeightStructuresFailureMechanism(); - var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionStub); + var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); // Call var children = info.ChildNodeObjects(failureMechanismContext).ToArray(); @@ -126,17 +126,17 @@ Assert.AreEqual(4, inputsFolder.Contents.Count); var failureMechanismSectionsContext = (FailureMechanismSectionsContext) inputsFolder.Contents[0]; Assert.AreSame(failureMechanism, failureMechanismSectionsContext.WrappedData); - Assert.AreSame(assessmentSectionStub, failureMechanismSectionsContext.ParentAssessmentSection); + Assert.AreSame(assessmentSection, failureMechanismSectionsContext.ParentAssessmentSection); var profilesContext = (ForeshoreProfilesContext) inputsFolder.Contents[1]; Assert.AreSame(failureMechanism.ForeshoreProfiles, profilesContext.WrappedData); Assert.AreSame(failureMechanism, profilesContext.ParentFailureMechanism); - Assert.AreSame(assessmentSectionStub, profilesContext.ParentAssessmentSection); + Assert.AreSame(assessmentSection, profilesContext.ParentAssessmentSection); var heightStructuresContext = (HeightStructuresContext) inputsFolder.Contents[2]; Assert.AreSame(failureMechanism.HeightStructures, heightStructuresContext.WrappedData); Assert.AreSame(failureMechanism, heightStructuresContext.FailureMechanism); - Assert.AreSame(assessmentSectionStub, heightStructuresContext.AssessmentSection); + Assert.AreSame(assessmentSection, heightStructuresContext.AssessmentSection); var inputComment = (Comment) inputsFolder.Contents[3]; Assert.AreSame(failureMechanism.InputComments, inputComment); @@ -167,14 +167,14 @@ public void ChildNodeObjects_FailureMechanismIsNotRelevant_ReturnOnlyFailureMechanismNotRelevantComments() { // Setup - var assessmentSectionMock = mocksRepository.StrictMock(); + var assessmentSection = mocksRepository.Stub(); mocksRepository.ReplayAll(); var failureMechanism = new HeightStructuresFailureMechanism { IsRelevant = false }; - var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); + var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); // Call var children = info.ChildNodeObjects(failureMechanismContext).ToArray(); @@ -190,8 +190,8 @@ { // Setup var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionMock = mocksRepository.StrictMock(); - var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); + var assessmentSection = mocksRepository.StrictMock(); + var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); var guiMock = mocksRepository.StrictMock(); var menuBuilderMock = mocksRepository.StrictMock(); @@ -232,8 +232,8 @@ { IsRelevant = false }; - var assessmentSectionMock = mocksRepository.StrictMock(); - var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); + var assessmentSection = mocksRepository.Stub(); + var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); var guiMock = mocksRepository.StrictMock(); var menuBuilderMock = mocksRepository.StrictMock(); @@ -264,9 +264,9 @@ // Setup using (var treeView = new TreeViewControl()) { - var assessmentSectionMock = mocksRepository.StrictMock(); + var assessmentSection = mocksRepository.Stub(); var failureMechanism = new HeightStructuresFailureMechanism(); - var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); + var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var guiMock = mocksRepository.StrictMock(); @@ -279,30 +279,30 @@ plugin.Gui = guiMock; // Call - using (ContextMenuStrip menu = info.ContextMenuStrip(failureMechanismContext, assessmentSectionMock, treeView)) + using (ContextMenuStrip menu = info.ContextMenuStrip(failureMechanismContext, assessmentSection, treeView)) { // Assert Assert.AreEqual(12, 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); } @@ -315,12 +315,12 @@ // Setup using (var treeView = new TreeViewControl()) { - var assessmentSectionMock = mocksRepository.StrictMock(); + var assessmentSection = mocksRepository.StrictMock(); var failureMechanism = new HeightStructuresFailureMechanism { IsRelevant = false }; - var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); + var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var guiMock = mocksRepository.StrictMock(); @@ -333,14 +333,14 @@ plugin.Gui = guiMock; // Call - using (ContextMenuStrip menu = info.ContextMenuStrip(failureMechanismContext, assessmentSectionMock, treeView)) + using (ContextMenuStrip menu = info.ContextMenuStrip(failureMechanismContext, assessmentSection, treeView)) { // Assert Assert.AreEqual(4, 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); } } @@ -351,14 +351,14 @@ { // Setup var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSectionStub = mocksRepository.Stub(); - var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionStub); - var viewCommandsMock = mocksRepository.StrictMock(); + var assessmentSection = mocksRepository.Stub(); + var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); + var viewCommands = mocksRepository.StrictMock(); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var guiMock = mocksRepository.StrictMock(); - viewCommandsMock.Expect(vs => vs.RemoveAllViewsForItem(failureMechanismContext)); - guiMock.Stub(g => g.ViewCommands).Return(viewCommandsMock); + viewCommands.Expect(vs => vs.RemoveAllViewsForItem(failureMechanismContext)); + guiMock.Stub(g => g.ViewCommands).Return(viewCommands); using (var treeViewControl = new TreeViewControl()) { @@ -387,14 +387,14 @@ { IsRelevant = false }; - var assessmentSectionStub = mocksRepository.Stub(); - var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionStub); - var viewCommandsMock = mocksRepository.StrictMock(); + var assessmentSection = mocksRepository.Stub(); + var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); + var viewCommands = mocksRepository.StrictMock(); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var guiMock = mocksRepository.StrictMock(); - viewCommandsMock.Expect(vs => vs.RemoveAllViewsForItem(failureMechanismContext)); - guiMock.Stub(g => g.ViewCommands).Return(viewCommandsMock); + viewCommands.Expect(vs => vs.RemoveAllViewsForItem(failureMechanismContext)); + guiMock.Stub(g => g.ViewCommands).Return(viewCommands); using (var treeViewControl = new TreeViewControl()) { @@ -416,54 +416,17 @@ } [Test] - public void ContextMenuStrip_NoFailureMechanismSections_ContextMenuItemCalculateAllDisabledAndTooltipSet() + public void ContextMenuStrip_NoHydraulicBoundaryDatabase_ContextMenuItemCalculateAllDisabledAndTooltipSet() { // Setup var guiMock = mocksRepository.StrictMock(); var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); - var assessmentSectionMock = mocksRepository.StrictMock(); - var nodeData = new HeightStructuresFailureMechanismContext(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.Plugin_AllDataAvailable_No_failure_mechanism_sections_imported, - RingtoetsCommonFormsResources.CalculateAllIcon, - false); - } - } - } - - [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetNoHydraulicBoundaryDatabase_ContextMenuItemCalculateAllDisabledAndTooltipSet() - { - // Setup - var guiMock = mocksRepository.StrictMock(); - var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); - var assessmentSectionMock = mocksRepository.Stub(); + var assessmentSection = mocksRepository.Stub(); - var nodeData = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); + var nodeData = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) @@ -488,21 +451,17 @@ } [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetHydraulicBoundaryDatabaseNotValid_ContextMenuItemCalculateAllDisabledAndTooltipSet() + public void ContextMenuStrip_HydraulicBoundaryDatabaseNotValid_ContextMenuItemCalculateAllDisabledAndTooltipSet() { // Setup var guiMock = mocksRepository.StrictMock(); var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); - var assessmentSectionMock = mocksRepository.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + var assessmentSection = mocksRepository.Stub(); + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); - var nodeData = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); + var nodeData = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) @@ -519,8 +478,8 @@ // 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); + Assert.AreEqual("Alles be&rekenen", contextMenuItem.Text); + StringAssert.Contains("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt.", contextMenuItem.ToolTipText); TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.CalculateAllIcon, contextMenuItem.Image); Assert.IsFalse(contextMenuItem.Enabled); } @@ -547,10 +506,10 @@ Version = "1.0" }; - var assessmentSectionMock = mocksRepository.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + var assessmentSection = mocksRepository.Stub(); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - var nodeData = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); + var nodeData = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) @@ -566,24 +525,24 @@ { // Assert TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndex, - RingtoetsCommonFormsResources.Calculate_all, - RingtoetsCommonFormsResources.Calculate_all_ToolTip, + "Alles be&rekenen", + "Voer alle berekeningen binnen dit toetsspoor uit.", RingtoetsCommonFormsResources.CalculateAllIcon); } } } [Test] - public void ContextMenuStrip_NoFailureMechanismSections_ContextMenuItemValidateAllDisabledAndTooltipSet() + public void ContextMenuStrip_NoHydraulicBoundaryDatabase_ContextMenuItemValidateAllDisabledAndTooltipSet() { // Setup var guiMock = mocksRepository.StrictMock(); var failureMechanism = new HeightStructuresFailureMechanism(); failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); - var assessmentSectionMock = mocksRepository.StrictMock(); - var nodeData = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); + var assessmentSection = mocksRepository.Stub(); + var nodeData = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) @@ -595,44 +554,6 @@ 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, - RingtoetsCommonFormsResources.ValidateAllIcon, - false); - } - } - } - - [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetNoHydraulicBoundaryDatabase_ContextMenuItemValidateAllDisabledAndTooltipSet() - { - // Setup - var guiMock = mocksRepository.StrictMock(); - var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); - failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); - - var assessmentSectionMock = mocksRepository.Stub(); - - var nodeData = new HeightStructuresFailureMechanismContext(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 @@ -646,21 +567,17 @@ } [Test] - public void ContextMenuStrip_FailureMechanismSectionsSetHydraulicBoundaryDatabaseNotValid_ContextMenuItemValidateAllDisabledAndTooltipSet() + public void ContextMenuStrip_HydraulicBoundaryDatabaseNotValid_ContextMenuItemValidateAllDisabledAndTooltipSet() { // Setup var guiMock = mocksRepository.StrictMock(); var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test", new[] - { - new Point2D(0, 0) - })); failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); - var assessmentSectionMock = mocksRepository.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + var assessmentSection = mocksRepository.Stub(); + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); - var nodeData = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); + var nodeData = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) @@ -677,8 +594,8 @@ // Assert ToolStripItem contextMenuItem = contextMenu.Items[contextMenuValidateAllIndex]; - Assert.AreEqual(RingtoetsCommonFormsResources.Validate_all, contextMenuItem.Text); - StringAssert.Contains(string.Format(RingtoetsCommonServicesResources.Hydraulic_boundary_database_connection_failed_0_, ""), contextMenuItem.ToolTipText); + Assert.AreEqual("Alles &valideren", contextMenuItem.Text); + StringAssert.Contains("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt.", contextMenuItem.ToolTipText); TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.ValidateAllIcon, contextMenuItem.Image); Assert.IsFalse(contextMenuItem.Enabled); } @@ -705,10 +622,10 @@ Version = "1.0" }; - var assessmentSectionMock = mocksRepository.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + var assessmentSection = mocksRepository.Stub(); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - var nodeData = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); + var nodeData = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) @@ -724,8 +641,8 @@ { // Assert TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndex, - RingtoetsCommonFormsResources.Validate_all, - RingtoetsCommonFormsResources.FailureMechanism_Validate_all_ToolTip, + "Alles &valideren", + "Valideer alle berekeningen binnen dit toetsspoor.", RingtoetsCommonFormsResources.ValidateAllIcon); } } @@ -736,18 +653,10 @@ { // Setup var guiMock = mocksRepository.StrictMock(); - var mainWindowStub = mocksRepository.Stub(); + var mainWindow = mocksRepository.Stub(); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var failureMechanism = new HeightStructuresFailureMechanism(); - - var section = new FailureMechanismSection("A", new[] - { - new Point2D(0, 0), - new Point2D(2, 2) - }); - failureMechanism.AddSection(section); - failureMechanism.CalculationsGroup.Children.Add(new TestHeightStructuresCalculation { Name = "A", @@ -767,20 +676,20 @@ string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); - var hydraulicBoundaryDatabaseStub = mocksRepository.Stub(); - hydraulicBoundaryDatabaseStub.FilePath = validFilePath; + var hydraulicBoundaryDatabase = mocksRepository.Stub(); + hydraulicBoundaryDatabase.FilePath = validFilePath; - var assessmentSectionStub = mocksRepository.Stub(); - assessmentSectionStub.Stub(a => a.Id).Return(string.Empty); - assessmentSectionStub.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(Enumerable.Empty(), 1, 1)); - assessmentSectionStub.HydraulicBoundaryDatabase = hydraulicBoundaryDatabaseStub; + var assessmentSection = mocksRepository.Stub(); + assessmentSection.Stub(a => a.Id).Return(string.Empty); + assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(Enumerable.Empty(), 1, 1)); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionStub); + var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(g => g.Get(failureMechanismContext, treeViewControl)).Return(menuBuilder); - guiMock.Expect(g => g.MainWindow).Return(mainWindowStub); + guiMock.Expect(g => g.MainWindow).Return(mainWindow); mocksRepository.ReplayAll(); @@ -823,11 +732,6 @@ { // Setup var failureMechanism = new HeightStructuresFailureMechanism(); - var section = new FailureMechanismSection("A", new[] - { - new Point2D(0, 0) - }); - failureMechanism.AddSection(section); failureMechanism.CalculationsGroup.Children.Add(new TestHeightStructuresCalculation { Name = "A", @@ -847,13 +751,13 @@ string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); - var hydraulicBoundaryDatabaseStub = mocksRepository.Stub(); - hydraulicBoundaryDatabaseStub.FilePath = validFilePath; + var hydraulicBoundaryDatabase = mocksRepository.Stub(); + hydraulicBoundaryDatabase.FilePath = validFilePath; - var assessmentSectionMock = mocksRepository.Stub(); - assessmentSectionMock.HydraulicBoundaryDatabase = hydraulicBoundaryDatabaseStub; + var assessmentSection = mocksRepository.Stub(); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); + var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); using (var treeViewControl = new TreeViewControl()) {