Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs =================================================================== diff -u -r396e74911bf83a7fe62c223b197ed0572889fd6d -r62d0870e6e0d9143fe085d443325af428c4ea143 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision 396e74911bf83a7fe62c223b197ed0572889fd6d) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision 62d0870e6e0d9143fe085d443325af428c4ea143) @@ -276,13 +276,8 @@ } } - private static string ValidateAllDataAvailableAndGetErrorMessage(IAssessmentSection assessmentSection, IFailureMechanism failureMechanism) + private static string ValidateAllDataAvailableAndGetErrorMessage(IAssessmentSection assessmentSection) { - if (failureMechanism.Contribution <= 0.0) - { - return RingtoetsCommonFormsResources.Contribution_of_failure_mechanism_zero; - } - return HydraulicBoundaryDatabaseConnectionValidator.Validate(assessmentSection.HydraulicBoundaryDatabase); } @@ -468,7 +463,7 @@ private static string ValidateAllDataAvailableAndGetErrorMessage(HeightStructuresFailureMechanismContext context) { - return ValidateAllDataAvailableAndGetErrorMessage(context.Parent, context.WrappedData); + return ValidateAllDataAvailableAndGetErrorMessage(context.Parent); } private static void ValidateAll(HeightStructuresFailureMechanismContext context) @@ -704,7 +699,7 @@ private static string ValidateAllDataAvailableAndGetErrorMessage(HeightStructuresCalculationGroupContext context) { - return ValidateAllDataAvailableAndGetErrorMessage(context.AssessmentSection, context.FailureMechanism); + return ValidateAllDataAvailableAndGetErrorMessage(context.AssessmentSection); } private static void ValidateAll(HeightStructuresCalculationGroupContext context) @@ -776,7 +771,7 @@ private static string ValidateAllDataAvailableAndGetErrorMessage(HeightStructuresCalculationContext context) { - return ValidateAllDataAvailableAndGetErrorMessage(context.AssessmentSection, context.FailureMechanism); + return ValidateAllDataAvailableAndGetErrorMessage(context.AssessmentSection); } private static void Validate(HeightStructuresCalculationContext context) Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -ra24a95cb642879d0760c43c44f16c65bc72523ae -r62d0870e6e0d9143fe085d443325af428c4ea143 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision a24a95cb642879d0760c43c44f16c65bc72523ae) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision 62d0870e6e0d9143fe085d443325af428c4ea143) @@ -148,7 +148,7 @@ { // Setup var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSection = mocks.Stub(); + var assessmentSection = new AssessmentSectionStub(); var parent = new CalculationGroup(); var calculation = new StructuresCalculation(); var nodeData = new HeightStructuresCalculationContext(calculation, parent, failureMechanism, assessmentSection); @@ -386,7 +386,7 @@ public void GivenCalculationWithoutOutputAndWithInputOutOfSync_WhenUpdateStructureClicked_ThenNoInquiryAndCalculationUpdatedAndInputObserverNotified() { // Given - var assessmentSection = mocks.Stub(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mocks); var structure = new TestHeightStructure(); var parent = new CalculationGroup(); var calculation = new StructuresCalculation @@ -435,7 +435,7 @@ public void GivenCalculationWithOutputAndInputOutOfSync_WhenUpdateStructureClickedAndCancelled_ThenInquiryAndCalculationNotUpdatedAndObserversNotNotified() { // Given - var assessmentSection = mocks.Stub(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mocks); var structure = new TestHeightStructure(); var parent = new CalculationGroup(); var calculation = new StructuresCalculation @@ -498,7 +498,7 @@ public void GivenCalculationWithOutputAndInputOutOfSync_WhenUpdateStructureClickedAndContinued_ThenInquiryAndCalculationUpdatedAndObserversNotified() { // Given - var assessmentSection = mocks.Stub(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mocks); var structure = new TestHeightStructure(); var parent = new CalculationGroup(); var calculation = new StructuresCalculation @@ -624,45 +624,6 @@ } [Test] - public void ContextMenuStrip_FailureMechanismContributionZero_ContextMenuItemPerformCalculationDisabledAndTooltipSet() - { - // Setup - string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); - var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSection = mocks.Stub(); - var parent = new CalculationGroup(); - var calculation = new StructuresCalculation(); - var nodeData = new HeightStructuresCalculationContext(calculation, parent, failureMechanism, assessmentSection); - - assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(new HydraulicBoundaryDatabase - { - FilePath = validFilePath, - Version = "1.0" - }); - - using (var treeViewControl = new TreeViewControl()) - { - var gui = mocks.Stub(); - gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); - gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - plugin.Gui = gui; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuCalculateIndex, - "Be&rekenen", - "De bijdrage van dit toetsspoor is nul.", - RingtoetsCommonFormsResources.CalculateIcon, - false); - } - } - } - - [Test] public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemPerformCalculationEnabled() { // Setup @@ -766,45 +727,6 @@ } [Test] - public void ContextMenuStrip_FailureMechanismContributionZero_ContextMenuItemValidateCalculationDisabledAndTooltipSet() - { - // Setup - string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); - var assessmentSection = mocks.Stub(); - var parent = new CalculationGroup(); - var calculation = new StructuresCalculation(); - var failureMechanism = new HeightStructuresFailureMechanism(); - var nodeData = new HeightStructuresCalculationContext(calculation, parent, failureMechanism, assessmentSection); - - assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(new HydraulicBoundaryDatabase - { - FilePath = validFilePath, - Version = "1.0" - }); - - using (var treeViewControl = new TreeViewControl()) - { - var gui = mocks.Stub(); - gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); - gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - plugin.Gui = gui; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuValidateIndex, - "&Valideren", - "De bijdrage van dit toetsspoor is nul.", - RingtoetsCommonFormsResources.ValidateIcon, - false); - } - } - } - - [Test] public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemValidateCalculationEnabled() { // Setup @@ -978,7 +900,7 @@ var calculationInputObserver = mocks.StrictMock(); calculationInputObserver.Expect(o => o.UpdateObserver()); - var assessmentSection = mocks.Stub(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mocks); var failureMechanism = new HeightStructuresFailureMechanism(); var foreshoreProfileInput = new TestForeshoreProfile(true); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r34b41b7c2a23389f88d686f26e6e8e90fbdd645a -r62d0870e6e0d9143fe085d443325af428c4ea143 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision 34b41b7c2a23389f88d686f26e6e8e90fbdd645a) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision 62d0870e6e0d9143fe085d443325af428c4ea143) @@ -550,57 +550,6 @@ } [Test] - public void ContextMenuStrip_FailureMechanismContributionZero_ContextMenuItemCalculateAllDisabledAndTooltipSet() - { - // Setup - var group = new CalculationGroup - { - Children = - { - new StructuresCalculation() - } - }; - - string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); - - var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); - - var assessmentSection = mocks.Stub(); - assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(new HydraulicBoundaryDatabase - { - FilePath = validFilePath, - Version = "1.0" - }); - - var nodeData = new HeightStructuresCalculationGroupContext(group, - null, - failureMechanism, - assessmentSection); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(g => g.ViewCommands).Return(mocks.Stub()); - gui.Stub(g => g.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - // Call - using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndexRootGroup, - "Alles be&rekenen", - "De bijdrage van dit toetsspoor is nul.", - RingtoetsCommonFormsResources.CalculateAllIcon, - false); - } - } - } - - [Test] public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemCalculateAllEnabled() { // Setup @@ -740,57 +689,6 @@ } [Test] - public void ContextMenuStrip_FailureMechanismContributionZero_ContextMenuItemValidateAllDisabledAndTooltipSet() - { - // Setup - var group = new CalculationGroup - { - Children = - { - new StructuresCalculation() - } - }; - - string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); - - var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); - - var assessmentSection = mocks.Stub(); - assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(new HydraulicBoundaryDatabase - { - FilePath = validFilePath, - Version = "1.0" - }); - - var nodeData = new HeightStructuresCalculationGroupContext(group, - null, - failureMechanism, - assessmentSection); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(g => g.ViewCommands).Return(mocks.Stub()); - gui.Stub(g => g.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - // Call - using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndexRootGroup, - "Alles &valideren", - "De bijdrage van dit toetsspoor is nul.", - RingtoetsCommonFormsResources.ValidateAllIcon, - false); - } - } - } - - [Test] public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemValidateAllEnabled() { // Setup @@ -1150,7 +1048,7 @@ var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var group = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSection = mocks.Stub(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mocks); var nodeData = new HeightStructuresCalculationGroupContext(group, null, failureMechanism, @@ -1235,7 +1133,7 @@ }; var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSection = mocks.Stub(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mocks); var nodeData = new HeightStructuresCalculationGroupContext(group, null, failureMechanism, @@ -1279,7 +1177,7 @@ }; var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSection = mocks.Stub(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mocks); var nodeData = new HeightStructuresCalculationGroupContext(group, null, failureMechanism, @@ -1324,7 +1222,7 @@ }; var failureMechanism = new HeightStructuresFailureMechanism(); - var assessmentSection = mocks.Stub(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mocks); var nodeData = new HeightStructuresCalculationGroupContext(group, null, failureMechanism, @@ -1354,7 +1252,7 @@ public void GivenCalculationWithoutOutputAndWithInputOutOfSync_WhenUpdateStructuresClicked_ThenNoInquiryAndCalculationUpdatedAndInputObserverNotified() { // Given - var assessmentSection = mocks.Stub(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mocks); var structure = new TestHeightStructure(); var calculation = new StructuresCalculation { @@ -1401,7 +1299,7 @@ public void GivenCalculationWithOutputAndInputOutOfSync_WhenUpdateStructuresClickedAndCancelled_ThenInquiryAndCalculationNotUpdatedAndObserversNotNotified() { // Given - var assessmentSection = mocks.Stub(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mocks); var structure = new TestHeightStructure(); var calculation = new StructuresCalculation { @@ -1462,7 +1360,7 @@ public void GivenCalculationWithOutputAndInputOutOfSync_WhenUpdateStructuresClickedAndContinued_ThenInquiryAndCalculationUpdatedAndObserversNotified() { // Given - var assessmentSection = mocks.Stub(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mocks); var structure = new TestHeightStructure(); var calculation = new StructuresCalculation { @@ -1526,7 +1424,7 @@ // Given using (var treeViewControl = new TreeViewControl()) { - var assessmentSection = mocks.Stub(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mocks); HeightStructure structure1 = new TestHeightStructure("Structure Id", "Structure 1"); @@ -1595,7 +1493,7 @@ // Given using (var treeViewControl = new TreeViewControl()) { - var assessmentSection = mocks.Stub(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mocks); var failureMechanism = new HeightStructuresFailureMechanism(); failureMechanism.HeightStructures.AddRange( @@ -1647,7 +1545,7 @@ // Given using (var treeViewControl = new TreeViewControl()) { - var assessmentSection = mocks.Stub(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mocks); const string existingCalculationName = "Height structure"; HeightStructure heightStructure = new TestHeightStructure("heightStructureId", existingCalculationName); @@ -1786,7 +1684,7 @@ { // Setup var observer = mocks.StrictMock(); - var assessmentSection = mocks.Stub(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mocks); var failureMechanism = new HeightStructuresFailureMechanism(); var group = new CalculationGroup(); var parentGroup = new CalculationGroup(); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -r34b41b7c2a23389f88d686f26e6e8e90fbdd645a -r62d0870e6e0d9143fe085d443325af428c4ea143 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs (.../HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs) (revision 34b41b7c2a23389f88d686f26e6e8e90fbdd645a) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs (.../HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs) (revision 62d0870e6e0d9143fe085d443325af428c4ea143) @@ -515,47 +515,6 @@ } [Test] - public void ContextMenuStrip_FailureMechanismContributionZero_ContextMenuItemCalculateAllDisabledAndTooltipSet() - { - // Setup - var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); - - string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); - - var assessmentSection = mocksRepository.Stub(); - assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(new HydraulicBoundaryDatabase - { - FilePath = validFilePath, - Version = "1.0" - }); - - var nodeData = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - var gui = mocksRepository.Stub(); - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - - mocksRepository.ReplayAll(); - - plugin.Gui = gui; - - // Call - using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndex, - "Alles be&rekenen", - "De bijdrage van dit toetsspoor is nul.", - RingtoetsCommonFormsResources.CalculateAllIcon, - false); - } - } - } - - [Test] public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemCalculateAllEnabled() { // Setup @@ -665,47 +624,6 @@ } [Test] - public void ContextMenuStrip_FailureMechanismContributionZero_ContextMenuItemValidateAllDisabledAndTooltipSet() - { - // Setup - var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); - - string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); - - var assessmentSection = mocksRepository.Stub(); - assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(new HydraulicBoundaryDatabase - { - FilePath = validFilePath, - Version = "1.0" - }); - - var nodeData = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - var gui = mocksRepository.Stub(); - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - - mocksRepository.ReplayAll(); - - plugin.Gui = gui; - - // Call - using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndex, - "Alles &valideren", - "De bijdrage van dit toetsspoor is nul.", - RingtoetsCommonFormsResources.ValidateAllIcon, - false); - } - } - } - - [Test] public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemValidateAllEnabled() { // Setup