Index: Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.Plugin.Test/TreeNodeInfos/HydraulicLoadsState/StabilityStoneCoverFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -r468ff12f407f4ce4278e8a23dd3d3814d2ff374d -r7e6530c3d2467a2c2778fee68927600d3d74e0fd --- Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.Plugin.Test/TreeNodeInfos/HydraulicLoadsState/StabilityStoneCoverFailureMechanismContextTreeNodeInfoTest.cs (.../StabilityStoneCoverFailureMechanismContextTreeNodeInfoTest.cs) (revision 468ff12f407f4ce4278e8a23dd3d3814d2ff374d) +++ Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.Plugin.Test/TreeNodeInfos/HydraulicLoadsState/StabilityStoneCoverFailureMechanismContextTreeNodeInfoTest.cs (.../StabilityStoneCoverFailureMechanismContextTreeNodeInfoTest.cs) (revision 7e6530c3d2467a2c2778fee68927600d3d74e0fd) @@ -261,37 +261,6 @@ } [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseNotLinked_CalculateAllDisabled() - { - // Setup - using (var treeViewControl = new TreeViewControl()) - { - var failureMechanism = new StabilityStoneCoverFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(new StabilityStoneCoverWaveConditionsCalculation()); - - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocks); - var nodeData = new StabilityStoneCoverFailureMechanismContext(failureMechanism, assessmentSection); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - var gui = mocks.Stub(); - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(g => g.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - plugin.Gui = gui; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - ToolStripItem calculateItem = contextMenu.Items[contextMenuCalculateAllIndex]; - Assert.IsFalse(calculateItem.Enabled); - Assert.AreEqual("Er is geen hydraulische belastingendatabase geïmporteerd.", calculateItem.ToolTipText); - } - } - } - - [Test] public void GivenValidCalculations_WhenCalculatingAllFromContextMenu_ThenAllCalculationsScheduled() { // Given Index: Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r159b12c3ac4df0b314da0290a3c5ad1b72cf20af -r7e6530c3d2467a2c2778fee68927600d3d74e0fd --- Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverCalculationGroupContextTreeNodeInfoTest.cs (.../StabilityStoneCoverCalculationGroupContextTreeNodeInfoTest.cs) (revision 159b12c3ac4df0b314da0290a3c5ad1b72cf20af) +++ Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverCalculationGroupContextTreeNodeInfoTest.cs (.../StabilityStoneCoverCalculationGroupContextTreeNodeInfoTest.cs) (revision 7e6530c3d2467a2c2778fee68927600d3d74e0fd) @@ -693,92 +693,6 @@ } [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseNotLinked_CalculateAllAndValidateAllDisabled() - { - // Setup - using (var treeViewControl = new TreeViewControl()) - { - var group = new CalculationGroup(); - - var failureMechanism = new StabilityStoneCoverFailureMechanism(); - group.Children.Add(new StabilityStoneCoverWaveConditionsCalculation()); - failureMechanism.CalculationsGroup.Children.Add(group); - - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocks); - var nodeData = new StabilityStoneCoverCalculationGroupContext(group, - failureMechanism.CalculationsGroup, - failureMechanism, - assessmentSection); - var parentNodeData = new StabilityStoneCoverCalculationGroupContext(failureMechanism.CalculationsGroup, - null, - failureMechanism, - assessmentSection); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(g => g.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl)) - { - // Assert - ToolStripItem validateItem = contextMenu.Items[contextMenuValidateAllIndexNestedGroup]; - ToolStripItem calculateItem = contextMenu.Items[contextMenuCalculateAllIndexNestedGroup]; - Assert.IsFalse(validateItem.Enabled); - Assert.IsFalse(calculateItem.Enabled); - Assert.AreEqual("Er is geen hydraulische belastingendatabase geïmporteerd.", calculateItem.ToolTipText); - Assert.AreEqual("Er is geen hydraulische belastingendatabase geïmporteerd.", validateItem.ToolTipText); - } - } - } - - [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseLinkedToInvalidFile_CalculateAllAndValidateAllDisabled() - { - // Setup - using (var treeViewControl = new TreeViewControl()) - { - var group = new CalculationGroup(); - - var failureMechanism = new StabilityStoneCoverFailureMechanism(); - group.Children.Add(new StabilityStoneCoverWaveConditionsCalculation()); - failureMechanism.CalculationsGroup.Children.Add(group); - - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocks, "invalidFilePath"); - - var nodeData = new StabilityStoneCoverCalculationGroupContext(group, - failureMechanism.CalculationsGroup, - failureMechanism, - assessmentSection); - var parentNodeData = new StabilityStoneCoverCalculationGroupContext(failureMechanism.CalculationsGroup, - null, - failureMechanism, - assessmentSection); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(g => g.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl)) - { - // Assert - ToolStripItem validateItem = contextMenu.Items[contextMenuValidateAllIndexNestedGroup]; - ToolStripItem calculateItem = contextMenu.Items[contextMenuCalculateAllIndexNestedGroup]; - Assert.IsFalse(validateItem.Enabled); - Assert.IsFalse(calculateItem.Enabled); - const string message = "Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt. Fout bij het lezen van bestand 'invalidFilePath': het bestand bestaat niet."; - Assert.AreEqual(message, calculateItem.ToolTipText); - Assert.AreEqual(message, validateItem.ToolTipText); - } - } - } - - [Test] [TestCase(true)] [TestCase(false)] public void ContextMenuStrip_AllRequiredInputSet_CalculateAllAndValidateAllEnabled(bool usePreprocessorClosure) Index: Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -r468ff12f407f4ce4278e8a23dd3d3814d2ff374d -r7e6530c3d2467a2c2778fee68927600d3d74e0fd --- Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 468ff12f407f4ce4278e8a23dd3d3814d2ff374d) +++ Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 7e6530c3d2467a2c2778fee68927600d3d74e0fd) @@ -553,163 +553,6 @@ } [Test] - public void GivenFailureMechanismWithoutSections_ThenValidationItemDisabled() - { - // Given - var failureMechanism = new StabilityStoneCoverFailureMechanism(); - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocks); - - var parent = new CalculationGroup(); - var calculation = new StabilityStoneCoverWaveConditionsCalculation - { - Name = "A" - }; - var context = new StabilityStoneCoverWaveConditionsCalculationContext(calculation, - parent, - failureMechanism, - assessmentSection); - - using (var treeViewControl = new TreeViewControl()) - { - var appFeatureCommandHandler = mocks.Stub(); - var importHandler = mocks.Stub(); - var exportHandler = mocks.Stub(); - var updateHandler = mocks.Stub(); - var viewCommands = mocks.Stub(); - var menuBuilder = new ContextMenuBuilder(appFeatureCommandHandler, - importHandler, - exportHandler, - updateHandler, - viewCommands, - context, - treeViewControl); - - var gui = mocks.Stub(); - gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilder); - gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - plugin.Gui = gui; - - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl)) - { - // Then - TestHelper.AssertContextMenuStripContainsItem(contextMenu, - validateMenuItemIndex, - "&Valideren", - "Er is geen hydraulische belastingendatabase geïmporteerd.", - RiskeerCommonFormsResources.ValidateIcon, - false); - } - } - } - - [Test] - public void GivenAssessmentSectionWithHydraulicBoundaryDatabaseNotLinked_ThenValidationItemDisabled() - { - // Given - var failureMechanism = new StabilityStoneCoverFailureMechanism(); - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocks); - - var parent = new CalculationGroup(); - var calculation = new StabilityStoneCoverWaveConditionsCalculation - { - Name = "A" - }; - var context = new StabilityStoneCoverWaveConditionsCalculationContext(calculation, - parent, - failureMechanism, - assessmentSection); - - using (var treeViewControl = new TreeViewControl()) - { - var appFeatureCommandHandler = mocks.Stub(); - var importHandler = mocks.Stub(); - var exportHandler = mocks.Stub(); - var updateHandler = mocks.Stub(); - var viewCommands = mocks.Stub(); - var menuBuilder = new ContextMenuBuilder(appFeatureCommandHandler, - importHandler, - exportHandler, - updateHandler, - viewCommands, - context, - treeViewControl); - - var gui = mocks.Stub(); - gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilder); - gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - plugin.Gui = gui; - - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl)) - { - // Then - TestHelper.AssertContextMenuStripContainsItem(contextMenu, - validateMenuItemIndex, - "&Valideren", - "Er is geen hydraulische belastingendatabase geïmporteerd.", - RiskeerCommonFormsResources.ValidateIcon, - false); - } - } - } - - [Test] - public void GivenAssessmentSectionWithHydraulicBoundaryDatabaseLinkedToInvalidFile_ThenValidationItemDisabled() - { - // Given - var failureMechanism = new StabilityStoneCoverFailureMechanism(); - - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocks, "invalidFilePath"); - - var parent = new CalculationGroup(); - var calculation = new StabilityStoneCoverWaveConditionsCalculation - { - Name = "A" - }; - var context = new StabilityStoneCoverWaveConditionsCalculationContext(calculation, - parent, - failureMechanism, - assessmentSection); - - using (var treeViewControl = new TreeViewControl()) - { - var appFeatureCommandHandler = mocks.Stub(); - var importHandler = mocks.Stub(); - var exportHandler = mocks.Stub(); - var updateHandler = mocks.Stub(); - var viewCommands = mocks.Stub(); - var menuBuilder = new ContextMenuBuilder(appFeatureCommandHandler, - importHandler, - exportHandler, - updateHandler, - viewCommands, - context, - treeViewControl); - - var gui = mocks.Stub(); - gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilder); - gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - plugin.Gui = gui; - - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl)) - { - // Then - TestHelper.AssertContextMenuStripContainsItem(contextMenu, - validateMenuItemIndex, - "&Valideren", - "Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt. Fout bij het lezen van bestand 'invalidFilePath': het bestand bestaat niet.", - RiskeerCommonFormsResources.ValidateIcon, - false); - } - } - } - - [Test] public void GivenValidInput_ThenValidationItemEnabled() { // Given @@ -1106,111 +949,6 @@ } [Test] - public void GivenAssessmentSectionWithHydraulicBoundaryDatabaseNotLinked_ThenCalculationItemDisabled() - { - // Given - var failureMechanism = new StabilityStoneCoverFailureMechanism(); - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocks); - - var parent = new CalculationGroup(); - var calculation = new StabilityStoneCoverWaveConditionsCalculation - { - Name = "A" - }; - var context = new StabilityStoneCoverWaveConditionsCalculationContext(calculation, - parent, - failureMechanism, - assessmentSection); - - using (var treeViewControl = new TreeViewControl()) - { - var appFeatureCommandHandler = mocks.Stub(); - var importHandler = mocks.Stub(); - var exportHandler = mocks.Stub(); - var updateHandler = mocks.Stub(); - var viewCommands = mocks.Stub(); - var menuBuilder = new ContextMenuBuilder(appFeatureCommandHandler, - importHandler, - exportHandler, - updateHandler, - viewCommands, - context, - treeViewControl); - - var gui = mocks.Stub(); - gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilder); - gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - plugin.Gui = gui; - - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl)) - { - // Then - TestHelper.AssertContextMenuStripContainsItem(contextMenu, - calculateMenuItemIndex, - "Be&rekenen", - "Er is geen hydraulische belastingendatabase geïmporteerd.", - RiskeerCommonFormsResources.CalculateIcon, - false); - } - } - } - - [Test] - public void GivenAssessmentSectionWithHydraulicBoundaryDatabaseLinkedToInvalidFile_ThenCalculationItemDisabled() - { - // Given - var failureMechanism = new StabilityStoneCoverFailureMechanism(); - - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocks, "invalidFilePath"); - - var parent = new CalculationGroup(); - var calculation = new StabilityStoneCoverWaveConditionsCalculation - { - Name = "A" - }; - var context = new StabilityStoneCoverWaveConditionsCalculationContext(calculation, - parent, - failureMechanism, - assessmentSection); - - using (var treeViewControl = new TreeViewControl()) - { - var appFeatureCommandHandler = mocks.Stub(); - var importHandler = mocks.Stub(); - var exportHandler = mocks.Stub(); - var updateHandler = mocks.Stub(); - var viewCommands = mocks.Stub(); - var menuBuilder = new ContextMenuBuilder(appFeatureCommandHandler, - importHandler, - exportHandler, - updateHandler, - viewCommands, - context, - treeViewControl); - - var gui = mocks.Stub(); - gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilder); - gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - plugin.Gui = gui; - - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl)) - { - // Then - TestHelper.AssertContextMenuStripContainsItem(contextMenu, - calculateMenuItemIndex, - "Be&rekenen", - "Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt. Fout bij het lezen van bestand 'invalidFilePath': het bestand bestaat niet.", - RiskeerCommonFormsResources.CalculateIcon, - false); - } - } - } - - [Test] [TestCase(true)] [TestCase(false)] public void GivenValidInput_ThenCalculationItemEnabled(bool usePreprocessorClosure) Index: Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/HydraulicLoadsState/WaveImpactAsphaltCoverFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -rcad65e5b829797a55dcca22f2b284957f9d5a548 -r7e6530c3d2467a2c2778fee68927600d3d74e0fd --- Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/HydraulicLoadsState/WaveImpactAsphaltCoverFailureMechanismContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverFailureMechanismContextTreeNodeInfoTest.cs) (revision cad65e5b829797a55dcca22f2b284957f9d5a548) +++ Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/HydraulicLoadsState/WaveImpactAsphaltCoverFailureMechanismContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverFailureMechanismContextTreeNodeInfoTest.cs) (revision 7e6530c3d2467a2c2778fee68927600d3d74e0fd) @@ -260,37 +260,6 @@ } [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseNotLinked_CalculateAllDisabled() - { - // Setup - using (var treeViewControl = new TreeViewControl()) - { - var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(new WaveImpactAsphaltCoverWaveConditionsCalculation()); - - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocks); - var nodeData = new WaveImpactAsphaltCoverFailureMechanismContext(failureMechanism, assessmentSection); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - var gui = mocks.Stub(); - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(g => g.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - plugin.Gui = gui; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - ToolStripItem calculateItem = contextMenu.Items[contextMenuCalculateAllIndex]; - Assert.IsFalse(calculateItem.Enabled); - Assert.AreEqual("Er is geen hydraulische belastingendatabase geïmporteerd.", calculateItem.ToolTipText); - } - } - } - - [Test] public void GivenValidCalculations_WhenCalculatingAllFromContextMenu_ThenAllCalculationsScheduled() { // Given Index: Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r159b12c3ac4df0b314da0290a3c5ad1b72cf20af -r7e6530c3d2467a2c2778fee68927600d3d74e0fd --- Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverCalculationGroupContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverCalculationGroupContextTreeNodeInfoTest.cs) (revision 159b12c3ac4df0b314da0290a3c5ad1b72cf20af) +++ Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverCalculationGroupContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverCalculationGroupContextTreeNodeInfoTest.cs) (revision 7e6530c3d2467a2c2778fee68927600d3d74e0fd) @@ -712,89 +712,6 @@ } [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseNotLinked_CalculateAllAndValidateAllDisabled() - { - // Setup - using (var treeViewControl = new TreeViewControl()) - { - var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); - var group = new CalculationGroup(); - group.Children.Add(new WaveImpactAsphaltCoverWaveConditionsCalculation()); - failureMechanism.CalculationsGroup.Children.Add(group); - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocks); - var nodeData = new WaveImpactAsphaltCoverCalculationGroupContext(group, - failureMechanism.CalculationsGroup, - failureMechanism, - assessmentSection); - var parentNodeData = new WaveImpactAsphaltCoverCalculationGroupContext(failureMechanism.CalculationsGroup, - null, - failureMechanism, - assessmentSection); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(g => g.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl)) - { - // Assert - ToolStripItem validateItem = contextMenu.Items[contextMenuValidateAllIndexNestedGroup]; - ToolStripItem calculateItem = contextMenu.Items[contextMenuCalculateAllIndexNestedGroup]; - Assert.IsFalse(validateItem.Enabled); - Assert.IsFalse(calculateItem.Enabled); - Assert.AreEqual("Er is geen hydraulische belastingendatabase geïmporteerd.", calculateItem.ToolTipText); - Assert.AreEqual("Er is geen hydraulische belastingendatabase geïmporteerd.", validateItem.ToolTipText); - } - } - } - - [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseLinkedToInvalidFile_CalculateAllAndValidateAllDisabled() - { - // Setup - using (var treeViewControl = new TreeViewControl()) - { - var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); - var group = new CalculationGroup(); - group.Children.Add(new WaveImpactAsphaltCoverWaveConditionsCalculation()); - failureMechanism.CalculationsGroup.Children.Add(group); - - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocks, "invalidFilePath"); - - var nodeData = new WaveImpactAsphaltCoverCalculationGroupContext(group, - failureMechanism.CalculationsGroup, - failureMechanism, - assessmentSection); - var parentNodeData = new WaveImpactAsphaltCoverCalculationGroupContext(failureMechanism.CalculationsGroup, - null, - failureMechanism, - assessmentSection); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(g => g.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl)) - { - // Assert - ToolStripItem validateItem = contextMenu.Items[contextMenuValidateAllIndexNestedGroup]; - ToolStripItem calculateItem = contextMenu.Items[contextMenuCalculateAllIndexNestedGroup]; - Assert.IsFalse(validateItem.Enabled); - Assert.IsFalse(calculateItem.Enabled); - const string message = "Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt. Fout bij het lezen van bestand 'invalidFilePath': het bestand bestaat niet."; - Assert.AreEqual(message, calculateItem.ToolTipText); - Assert.AreEqual(message, validateItem.ToolTipText); - } - } - } - - [Test] [TestCase(true)] [TestCase(false)] public void ContextMenuStrip_AllRequiredInputSet_CalculateAllAndValidateAllEnabled(bool usePreprocessorClosure) Index: Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rcad65e5b829797a55dcca22f2b284957f9d5a548 -r7e6530c3d2467a2c2778fee68927600d3d74e0fd --- Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision cad65e5b829797a55dcca22f2b284957f9d5a548) +++ Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 7e6530c3d2467a2c2778fee68927600d3d74e0fd) @@ -548,110 +548,6 @@ } [Test] - public void GivenAssessmentSectionWithHydraulicBoundaryDatabaseNotLinked_ThenValidationItemDisabled() - { - // Given - var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocks); - - var parent = new CalculationGroup(); - var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation - { - Name = "A" - }; - var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation, - parent, - failureMechanism, - assessmentSection); - - using (var treeViewControl = new TreeViewControl()) - { - var appFeatureCommandHandler = mocks.Stub(); - var importHandler = mocks.Stub(); - var exportHandler = mocks.Stub(); - var updateHandler = mocks.Stub(); - var viewCommands = mocks.Stub(); - var menuBuilder = new ContextMenuBuilder(appFeatureCommandHandler, - importHandler, - exportHandler, - updateHandler, - viewCommands, - context, - treeViewControl); - - var gui = mocks.Stub(); - gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilder); - gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - plugin.Gui = gui; - - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl)) - { - // Then - TestHelper.AssertContextMenuStripContainsItem(contextMenu, - validateMenuItemIndex, - "&Valideren", - "Er is geen hydraulische belastingendatabase geïmporteerd.", - RiskeerCommonFormsResources.ValidateIcon, - false); - } - } - } - - [Test] - public void GivenAssessmentSectionWithHydraulicBoundaryDatabaseLinkedToInvalidFile_ThenValidationItemDisabled() - { - // Given - var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocks, "invalidFilePath"); - - var parent = new CalculationGroup(); - var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation - { - Name = "A" - }; - var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation, - parent, - failureMechanism, - assessmentSection); - - using (var treeViewControl = new TreeViewControl()) - { - var appFeatureCommandHandler = mocks.Stub(); - var importHandler = mocks.Stub(); - var exportHandler = mocks.Stub(); - var updateHandler = mocks.Stub(); - var viewCommands = mocks.Stub(); - var menuBuilder = new ContextMenuBuilder(appFeatureCommandHandler, - importHandler, - exportHandler, - updateHandler, - viewCommands, - context, - treeViewControl); - - var gui = mocks.Stub(); - gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilder); - gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - plugin.Gui = gui; - - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl)) - { - // Then - TestHelper.AssertContextMenuStripContainsItem(contextMenu, - validateMenuItemIndex, - "&Valideren", - "Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt. Fout bij het lezen van bestand 'invalidFilePath': het bestand bestaat niet.", - RiskeerCommonFormsResources.ValidateIcon, - false); - } - } - } - - [Test] public void GivenValidInput_ThenValidationItemEnabled() { // Given @@ -1046,110 +942,6 @@ } [Test] - public void GivenAssessmentSectionWithHydraulicBoundaryDatabaseNotLinked_ThenCalculationItemDisabled() - { - // Given - var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocks); - - var parent = new CalculationGroup(); - var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation - { - Name = "A" - }; - var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation, - parent, - failureMechanism, - assessmentSection); - - using (var treeViewControl = new TreeViewControl()) - { - var appFeatureCommandHandler = mocks.Stub(); - var importHandler = mocks.Stub(); - var exportHandler = mocks.Stub(); - var updateHandler = mocks.Stub(); - var viewCommands = mocks.Stub(); - var menuBuilder = new ContextMenuBuilder(appFeatureCommandHandler, - importHandler, - exportHandler, - updateHandler, - viewCommands, - context, - treeViewControl); - - var gui = mocks.Stub(); - gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilder); - gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - plugin.Gui = gui; - - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl)) - { - // Then - TestHelper.AssertContextMenuStripContainsItem(contextMenu, - calculateMenuItemIndex, - "Be&rekenen", - "Er is geen hydraulische belastingendatabase geïmporteerd.", - RiskeerCommonFormsResources.CalculateIcon, - false); - } - } - } - - [Test] - public void GivenAssessmentSectionWithHydraulicBoundaryDatabaseLinkedToInvalidFile_ThenCalculationItemDisabled() - { - // Given - var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); - IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocks, "invalidFilePath"); - - var parent = new CalculationGroup(); - var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation - { - Name = "A" - }; - var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation, - parent, - failureMechanism, - assessmentSection); - - using (var treeViewControl = new TreeViewControl()) - { - var appFeatureCommandHandler = mocks.Stub(); - var importHandler = mocks.Stub(); - var exportHandler = mocks.Stub(); - var updateHandler = mocks.Stub(); - var viewCommands = mocks.Stub(); - var menuBuilder = new ContextMenuBuilder(appFeatureCommandHandler, - importHandler, - exportHandler, - updateHandler, - viewCommands, - context, - treeViewControl); - - var gui = mocks.Stub(); - gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilder); - gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); - mocks.ReplayAll(); - - plugin.Gui = gui; - - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl)) - { - // Then - TestHelper.AssertContextMenuStripContainsItem(contextMenu, - calculateMenuItemIndex, - "Be&rekenen", - "Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt. Fout bij het lezen van bestand 'invalidFilePath': het bestand bestaat niet.", - RiskeerCommonFormsResources.CalculateIcon, - false); - } - } - } - - [Test] [TestCase(true)] [TestCase(false)] public void GivenValidInput_ThenCalculationItemEnabled(bool usePreprocessorClosure)