Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsCalculationActivityIntegrationTest.cs =================================================================== diff -u -r54ed6c0d1b17e218d89fb5b1a4be658162e11609 -rcf6b7de309605856639a567a82c48dc9cd2cbeb4 --- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsCalculationActivityIntegrationTest.cs (.../GrassCoverErosionInwardsCalculationActivityIntegrationTest.cs) (revision 54ed6c0d1b17e218d89fb5b1a4be658162e11609) +++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsCalculationActivityIntegrationTest.cs (.../GrassCoverErosionInwardsCalculationActivityIntegrationTest.cs) (revision cf6b7de309605856639a567a82c48dc9cd2cbeb4) @@ -87,7 +87,7 @@ Assert.AreEqual(4, msgs.Length); Assert.AreEqual($"Uitvoeren van berekening '{calculation.Name}' is gestart.", msgs[0]); CalculationServiceTestHelper.AssertValidationStartMessage(msgs[1]); - StringAssert.StartsWith("Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt. Fout bij het lezen van bestand", msgs[2]); + Assert.AreEqual("Er is geen hydraulische belastingenlocatie geselecteerd.", msgs[2]); CalculationServiceTestHelper.AssertValidationEndMessage(msgs[3]); }); Assert.AreEqual(ActivityState.Failed, activity.State); Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/CalculationsState/GrassCoverErosionInwardsFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -r04450458c9a8b3855b3890b35d123e0fb0f03b11 -rcf6b7de309605856639a567a82c48dc9cd2cbeb4 --- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/CalculationsState/GrassCoverErosionInwardsFailureMechanismContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision 04450458c9a8b3855b3890b35d123e0fb0f03b11) +++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/CalculationsState/GrassCoverErosionInwardsFailureMechanismContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision cf6b7de309605856639a567a82c48dc9cd2cbeb4) @@ -256,74 +256,6 @@ } [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseNotLinked_ContextMenuItemCalculateAllDisabledAndTooltipSet() - { - // Setup - var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(new GrassCoverErosionInwardsCalculation()); - - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocksRepository); - var nodeData = new GrassCoverErosionInwardsFailureMechanismContext(failureMechanism, assessmentSection); - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - var gui = mocksRepository.Stub(); - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub()); - mocksRepository.ReplayAll(); - - plugin.Gui = gui; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuCalculateAllIndex, - "Alles be&rekenen", - "Er is geen hydraulische belastingendatabase geïmporteerd.", - RiskeerCommonFormsResources.CalculateAllIcon, - false); - } - } - } - - [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseLinkedToInvalidFile_ContextMenuItemCalculateAllDisabledAndTooltipSet() - { - // Setup - var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(new GrassCoverErosionInwardsCalculation()); - - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocksRepository, "invalidFilePath"); - - var nodeData = new GrassCoverErosionInwardsFailureMechanismContext(failureMechanism, assessmentSection); - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - var gui = mocksRepository.Stub(); - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub()); - mocksRepository.ReplayAll(); - - plugin.Gui = gui; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - ToolStripItem contextMenuItem = contextMenu.Items[contextMenuCalculateAllIndex]; - - Assert.AreEqual("Alles be&rekenen", contextMenuItem.Text); - StringAssert.Contains("Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt.", contextMenuItem.ToolTipText); - TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.CalculateAllIcon, contextMenuItem.Image); - Assert.IsFalse(contextMenuItem.Enabled); - } - } - } - - [Test] public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemCalculateAllEnabled() { // Setup @@ -368,75 +300,6 @@ } [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseNotLinked_ContextMenuItemValidateAllDisabledAndTooltipSet() - { - // Setup - var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(new GrassCoverErosionInwardsCalculation()); - - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocksRepository); - - var nodeData = new GrassCoverErosionInwardsFailureMechanismContext(failureMechanism, assessmentSection); - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - var gui = mocksRepository.Stub(); - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub()); - mocksRepository.ReplayAll(); - - plugin.Gui = gui; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuValidateAllIndex, - "Alles &valideren", - "Er is geen hydraulische belastingendatabase geïmporteerd.", - RiskeerCommonFormsResources.ValidateAllIcon, - false); - } - } - } - - [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseLinkedToInvalidFile_ContextMenuItemValidateAllDisabledAndTooltipSet() - { - // Setup - var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(new GrassCoverErosionInwardsCalculation()); - - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocksRepository, "invalidFilePath"); - - var nodeData = new GrassCoverErosionInwardsFailureMechanismContext(failureMechanism, assessmentSection); - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - using (var treeViewControl = new TreeViewControl()) - { - var gui = mocksRepository.Stub(); - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub()); - mocksRepository.ReplayAll(); - - plugin.Gui = gui; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - ToolStripItem contextMenuItem = contextMenu.Items[contextMenuValidateAllIndex]; - - Assert.AreEqual("Alles &valideren", contextMenuItem.Text); - StringAssert.Contains("Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt.", contextMenuItem.ToolTipText); - TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.ValidateAllIcon, contextMenuItem.Image); - Assert.IsFalse(contextMenuItem.Enabled); - } - } - } - - [Test] public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemValidateAllEnabled() { // Setup @@ -488,9 +351,9 @@ var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); - + failureMechanism.CalculationsGroup.Children.Add(new GrassCoverErosionInwardsCalculation { Name = "A", Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -r04450458c9a8b3855b3890b35d123e0fb0f03b11 -rcf6b7de309605856639a567a82c48dc9cd2cbeb4 --- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs) (revision 04450458c9a8b3855b3890b35d123e0fb0f03b11) +++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs) (revision cf6b7de309605856639a567a82c48dc9cd2cbeb4) @@ -571,71 +571,6 @@ } [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseNotLinked_ContextMenuItemPerformCalculationDisabledAndTooltipSet() - { - // Setup - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocks); - var parent = new CalculationGroup(); - var calculation = new GrassCoverErosionInwardsCalculationScenario(); - var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - var nodeData = new GrassCoverErosionInwardsCalculationScenarioContext(calculation, parent, failureMechanism, assessmentSection); - - 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", - "Er is geen hydraulische belastingendatabase geïmporteerd.", - RiskeerCommonFormsResources.CalculateIcon, - false); - } - } - } - - [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseLinkedToInvalidFile_ContextMenuItemPerformCalculationDisabledAndTooltipSet() - { - // Setup - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocks, "invalidFilePath"); - var parent = new CalculationGroup(); - var calculation = new GrassCoverErosionInwardsCalculationScenario(); - var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - var nodeData = new GrassCoverErosionInwardsCalculationScenarioContext(calculation, parent, failureMechanism, assessmentSection); - - 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 - ToolStripItem contextMenuItem = contextMenu.Items[contextMenuCalculateIndex]; - - Assert.AreEqual("Be&rekenen", contextMenuItem.Text); - StringAssert.Contains("Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt.", contextMenuItem.ToolTipText); - TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.CalculateIcon, contextMenuItem.Image); - Assert.IsFalse(contextMenuItem.Enabled); - } - } - } - - [Test] public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemPerformCalculationEnabled() { // Setup @@ -679,71 +614,6 @@ } [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseNotLinked_ContextMenuItemValidateCalculationDisabledAndTooltipSet() - { - // Setup - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocks); - var parent = new CalculationGroup(); - var calculation = new GrassCoverErosionInwardsCalculationScenario(); - var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - var nodeData = new GrassCoverErosionInwardsCalculationScenarioContext(calculation, parent, failureMechanism, assessmentSection); - - 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", - "Er is geen hydraulische belastingendatabase geïmporteerd.", - RiskeerCommonFormsResources.ValidateIcon, - false); - } - } - } - - [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseLinkedToInvalidFile_ContextMenuItemValidateCalculationDisabledAndTooltipSet() - { - // Setup - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocks, "invalidFilePath"); - var parent = new CalculationGroup(); - var calculation = new GrassCoverErosionInwardsCalculationScenario(); - var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - var nodeData = new GrassCoverErosionInwardsCalculationScenarioContext(calculation, parent, failureMechanism, assessmentSection); - - 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 - ToolStripItem contextMenuItem = contextMenu.Items[contextMenuValidateIndex]; - - Assert.AreEqual("&Valideren", contextMenuItem.Text); - StringAssert.Contains("Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt.", contextMenuItem.ToolTipText); - TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.ValidateIcon, contextMenuItem.Image); - Assert.IsFalse(contextMenuItem.Enabled); - } - } - } - - [Test] public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemValidateCalculationEnabled() { // Setup Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r04450458c9a8b3855b3890b35d123e0fb0f03b11 -rcf6b7de309605856639a567a82c48dc9cd2cbeb4 --- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs) (revision 04450458c9a8b3855b3890b35d123e0fb0f03b11) +++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs) (revision cf6b7de309605856639a567a82c48dc9cd2cbeb4) @@ -33,7 +33,6 @@ using Core.Gui.Commands; using Core.Gui.ContextMenu; using Core.Gui.Forms.Main; -using Core.Gui.Plugin; using Core.Gui.TestUtil; using Core.Gui.TestUtil.ContextMenu; using NUnit.Extensions.Forms; @@ -429,61 +428,6 @@ } [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseNotLinked_ContextMenuItemCalculateAllDisabledAndTooltipSet() - { - // Setup - var group = new CalculationGroup - { - Children = - { - new GrassCoverErosionInwardsCalculation() - } - }; - - var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(new GrassCoverErosionInwardsCalculation()); - - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocks); - var nodeData = new GrassCoverErosionInwardsCalculationGroupContext(group, - null, - failureMechanism, - assessmentSection); - - var applicationFeatureCommandHandler = mocks.Stub(); - var importHandler = mocks.Stub(); - importHandler.Stub(ih => ih.GetSupportedImportInfos(nodeData)).Return(Array.Empty()); - var exportHandler = mocks.Stub(); - var updateHandler = mocks.Stub(); - var viewCommandsHandler = mocks.Stub(); - - using (var treeViewControl = new TreeViewControl()) - { - var menuBuilder = new ContextMenuBuilder(applicationFeatureCommandHandler, - importHandler, - exportHandler, - updateHandler, - viewCommandsHandler, - nodeData, - treeViewControl); - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); - gui.Stub(g => g.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuCalculateAllIndexRootGroup, - "Alles be&rekenen", - "Er is geen hydraulische belastingendatabase geïmporteerd.", - RiskeerCommonFormsResources.CalculateAllIcon, - false); - } - } - } - - [Test] public void ContextMenuStrip_FailureMechanismWithoutCalculations_ContextMenuItemUpdateDikeProfileAllDisabledAndToolTipSet() { // Setup @@ -938,62 +882,6 @@ } [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseLinkedToInvalidFile_ContextMenuItemCalculateAllDisabledAndTooltipSet() - { - // Setup - var group = new CalculationGroup - { - Children = - { - new GrassCoverErosionInwardsCalculation() - } - }; - - var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(new GrassCoverErosionInwardsCalculation()); - - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocks, "invalidFilePath"); - - var nodeData = new GrassCoverErosionInwardsCalculationGroupContext(group, - null, - failureMechanism, - assessmentSection); - - var applicationFeatureCommandHandler = mocks.Stub(); - var importHandler = mocks.Stub(); - importHandler.Stub(ih => ih.GetSupportedImportInfos(nodeData)).Return(Array.Empty()); - var exportHandler = mocks.Stub(); - var updateHandler = mocks.Stub(); - var viewCommandsHandler = mocks.Stub(); - - using (var treeViewControl = new TreeViewControl()) - { - var menuBuilder = new ContextMenuBuilder(applicationFeatureCommandHandler, - importHandler, - exportHandler, - updateHandler, - viewCommandsHandler, - nodeData, - treeViewControl); - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); - gui.Stub(g => g.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - ToolStripItem calculateContextMenuItem = contextMenu.Items[contextMenuCalculateAllIndexRootGroup]; - Assert.AreEqual("Alles be&rekenen", calculateContextMenuItem.Text); - StringAssert.Contains("Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt", calculateContextMenuItem.ToolTipText); - TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.CalculateAllIcon, calculateContextMenuItem.Image); - Assert.IsFalse(calculateContextMenuItem.Enabled); - } - } - } - - [Test] public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemCalculateAllEnabled() { // Setup @@ -1047,118 +935,6 @@ } [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseNotLinked_ContextMenuItemValidateAllDisabledAndTooltipSet() - { - // Setup - var group = new CalculationGroup - { - Children = - { - new GrassCoverErosionInwardsCalculation() - } - }; - - var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(new GrassCoverErosionInwardsCalculation()); - - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocks); - var nodeData = new GrassCoverErosionInwardsCalculationGroupContext(group, - null, - failureMechanism, - assessmentSection); - - var applicationFeatureCommandHandler = mocks.Stub(); - var importHandler = mocks.Stub(); - importHandler.Stub(ih => ih.GetSupportedImportInfos(nodeData)).Return(Array.Empty()); - var exportHandler = mocks.Stub(); - var updateHandler = mocks.Stub(); - var viewCommandsHandler = mocks.Stub(); - - using (var treeViewControl = new TreeViewControl()) - { - var menuBuilder = new ContextMenuBuilder(applicationFeatureCommandHandler, - importHandler, - exportHandler, - updateHandler, - viewCommandsHandler, - nodeData, - treeViewControl); - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); - gui.Stub(g => g.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuValidateAllIndexRootGroup, - "Alles &valideren", - "Er is geen hydraulische belastingendatabase geïmporteerd.", - RiskeerCommonFormsResources.ValidateAllIcon, - false); - } - } - } - - [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseLinkedToInvalidFile_ContextMenuItemValidateAllDisabledAndTooltipSet() - { - // Setup - var group = new CalculationGroup - { - Children = - { - new GrassCoverErosionInwardsCalculation() - } - }; - - var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(new GrassCoverErosionInwardsCalculation()); - - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocks, "invalidFilePath"); - - var nodeData = new GrassCoverErosionInwardsCalculationGroupContext(group, - null, - failureMechanism, - assessmentSection); - - var applicationFeatureCommandHandler = mocks.Stub(); - var importHandler = mocks.Stub(); - importHandler.Stub(ih => ih.GetSupportedImportInfos(nodeData)).Return(Array.Empty()); - var exportHandler = mocks.Stub(); - var updateHandler = mocks.Stub(); - var viewCommandsHandler = mocks.Stub(); - - using (var treeViewControl = new TreeViewControl()) - { - var menuBuilder = new ContextMenuBuilder(applicationFeatureCommandHandler, - importHandler, - exportHandler, - updateHandler, - viewCommandsHandler, - nodeData, - treeViewControl); - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); - gui.Stub(g => g.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - ToolStripItem contextMenuItem = contextMenu.Items[contextMenuValidateAllIndexRootGroup]; - - Assert.AreEqual("Alles &valideren", contextMenuItem.Text); - StringAssert.Contains("Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt.", contextMenuItem.ToolTipText); - TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.ValidateAllIcon, contextMenuItem.Image); - Assert.IsFalse(contextMenuItem.Enabled); - } - } - } - - [Test] public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemValidateAllEnabled() { // Setup