Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/DesignWaterLevelCalculationsContextTreeNodeInfoTest.cs =================================================================== diff -u -rcafecac138fbe2ed4e5a063e7456e44d18cf8b12 -r49912e63dace0335eca4c3393324ad69136d7d99 --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/DesignWaterLevelCalculationsContextTreeNodeInfoTest.cs (.../DesignWaterLevelCalculationsContextTreeNodeInfoTest.cs) (revision cafecac138fbe2ed4e5a063e7456e44d18cf8b12) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/DesignWaterLevelCalculationsContextTreeNodeInfoTest.cs (.../DesignWaterLevelCalculationsContextTreeNodeInfoTest.cs) (revision 49912e63dace0335eca4c3393324ad69136d7d99) @@ -275,56 +275,6 @@ } [Test] - public void ContextMenuStrip_InvalidNorm_ContextMenuItemCalculateAllDisabledAndTooltipSet() - { - // Setup - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - { - FilePath = Path.Combine(TestHelper.GetTestDataPath(TestDataPath.Riskeer.Common.IO, nameof(HydraulicBoundaryDatabase)), "complete.sqlite") - }; - HydraulicBoundaryDatabaseTestHelper.SetHydraulicBoundaryLocationConfigurationSettings(hydraulicBoundaryDatabase); - - var assessmentSection = mockRepository.Stub(); - assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(hydraulicBoundaryDatabase); - - var nodeData = new DesignWaterLevelCalculationsContext(new ObservableList(), - assessmentSection, - () => 1.0, - "A"); - - using (var treeViewControl = new TreeViewControl()) - { - var gui = mockRepository.Stub(); - gui.Stub(g => g.ProjectOpened += null).IgnoreArguments(); - gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); - gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); - gui.Stub(cmp => cmp.MainWindow).Return(mockRepository.Stub()); - mockRepository.ReplayAll(); - - using (var plugin = new RiskeerPlugin()) - { - TreeNodeInfo info = GetInfo(plugin); - - plugin.Gui = gui; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - ToolStripItem contextMenuItem = contextMenu.Items[contextMenuRunAssessmentLevelCalculationsIndex]; - - Assert.AreEqual("Alles be&rekenen", contextMenuItem.Text); - StringAssert.Contains("Doelkans is te groot om een berekening uit te kunnen voeren.", contextMenuItem.ToolTipText); - TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.CalculateAllIcon, contextMenuItem.Image); - Assert.IsFalse(contextMenuItem.Enabled); - } - } - } - - mockRepository.VerifyAll(); // Expect no calls on arguments - } - - [Test] public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemCalculateAllEnabled() { // Setup @@ -502,10 +452,10 @@ new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation) }; - Func getNormFunc = () => 0.01; + double GetNormFunc() => 0.01; var context = new DesignWaterLevelCalculationsContext(hydraulicBoundaryLocationCalculations, assessmentSection, - getNormFunc, + GetNormFunc, "A"); using (var treeViewControl = new TreeViewControl()) @@ -554,7 +504,7 @@ AssessmentLevelCalculationInput designWaterLevelCalculationInput = designWaterLevelCalculator.ReceivedInputs.First(); Assert.AreEqual(hydraulicBoundaryLocation.Id, designWaterLevelCalculationInput.HydraulicBoundaryLocationId); - Assert.AreEqual(StatisticsConverter.ProbabilityToReliability(getNormFunc()), designWaterLevelCalculationInput.Beta); + Assert.AreEqual(StatisticsConverter.ProbabilityToReliability(GetNormFunc()), designWaterLevelCalculationInput.Beta); } } } @@ -583,7 +533,7 @@ }; HydraulicBoundaryDatabaseTestHelper.SetHydraulicBoundaryLocationConfigurationSettings(assessmentSection.HydraulicBoundaryDatabase); - Func getNormFunc = () => 0.01; + double GetNormFunc() => 0.01; var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation("locationName"); var hydraulicBoundaryLocationCalculations = new ObservableList @@ -593,7 +543,7 @@ var context = new DesignWaterLevelCalculationsContext(hydraulicBoundaryLocationCalculations, assessmentSection, - getNormFunc, + GetNormFunc, "A"); using (var treeViewControl = new TreeViewControl()) @@ -642,7 +592,7 @@ AssessmentLevelCalculationInput designWaterLevelCalculationInput = designWaterLevelCalculator.ReceivedInputs.First(); Assert.AreEqual(hydraulicBoundaryLocation.Id, designWaterLevelCalculationInput.HydraulicBoundaryLocationId); - Assert.AreEqual(StatisticsConverter.ProbabilityToReliability(getNormFunc()), designWaterLevelCalculationInput.Beta); + Assert.AreEqual(StatisticsConverter.ProbabilityToReliability(GetNormFunc()), designWaterLevelCalculationInput.Beta); } } } @@ -670,7 +620,7 @@ }; HydraulicBoundaryDatabaseTestHelper.SetHydraulicBoundaryLocationConfigurationSettings(assessmentSection.HydraulicBoundaryDatabase); - Func getNormFunc = () => 0.01; + double GetNormFunc() => 0.01; var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation("locationName"); var hydraulicBoundaryLocationCalculations = new ObservableList @@ -680,7 +630,7 @@ var context = new DesignWaterLevelCalculationsContext(hydraulicBoundaryLocationCalculations, assessmentSection, - getNormFunc, + GetNormFunc, "A"); using (var treeViewControl = new TreeViewControl()) @@ -729,7 +679,7 @@ AssessmentLevelCalculationInput designWaterLevelCalculationInput = designWaterLevelCalculator.ReceivedInputs.First(); Assert.AreEqual(hydraulicBoundaryLocation.Id, designWaterLevelCalculationInput.HydraulicBoundaryLocationId); - Assert.AreEqual(StatisticsConverter.ProbabilityToReliability(getNormFunc()), designWaterLevelCalculationInput.Beta); + Assert.AreEqual(StatisticsConverter.ProbabilityToReliability(GetNormFunc()), designWaterLevelCalculationInput.Beta); } } } @@ -802,10 +752,10 @@ using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) { // When - Action call = () => contextMenuAdapter.Items[contextMenuRunAssessmentLevelCalculationsIndex].PerformClick(); + void Call() => contextMenuAdapter.Items[contextMenuRunAssessmentLevelCalculationsIndex].PerformClick(); // Then - TestHelper.AssertLogMessages(call, messages => + TestHelper.AssertLogMessages(Call, messages => { string[] msgs = messages.ToArray(); Assert.AreEqual(8, msgs.Length); Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/WaveHeightCalculationsContextTreeNodeInfoTest.cs =================================================================== diff -u -rcafecac138fbe2ed4e5a063e7456e44d18cf8b12 -r49912e63dace0335eca4c3393324ad69136d7d99 --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/WaveHeightCalculationsContextTreeNodeInfoTest.cs (.../WaveHeightCalculationsContextTreeNodeInfoTest.cs) (revision cafecac138fbe2ed4e5a063e7456e44d18cf8b12) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/WaveHeightCalculationsContextTreeNodeInfoTest.cs (.../WaveHeightCalculationsContextTreeNodeInfoTest.cs) (revision 49912e63dace0335eca4c3393324ad69136d7d99) @@ -383,56 +383,6 @@ } [Test] - public void ContextMenuStrip_InvalidNorm_ContextMenuItemCalculateAllDisabledAndTooltipSet() - { - // Setup - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - { - FilePath = Path.Combine(TestHelper.GetTestDataPath(TestDataPath.Riskeer.Common.IO, nameof(HydraulicBoundaryDatabase)), "complete.sqlite") - }; - HydraulicBoundaryDatabaseTestHelper.SetHydraulicBoundaryLocationConfigurationSettings(hydraulicBoundaryDatabase); - - var assessmentSection = mockRepository.Stub(); - assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(hydraulicBoundaryDatabase); - - var nodeData = new WaveHeightCalculationsContext(new ObservableList(), - assessmentSection, - () => 1.0, - "A"); - - using (var treeViewControl = new TreeViewControl()) - { - var gui = mockRepository.Stub(); - gui.Stub(g => g.ProjectOpened += null).IgnoreArguments(); - gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); - gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); - gui.Stub(cmp => cmp.MainWindow).Return(mockRepository.Stub()); - mockRepository.ReplayAll(); - - using (var plugin = new RiskeerPlugin()) - { - TreeNodeInfo info = GetInfo(plugin); - - plugin.Gui = gui; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - ToolStripItem contextMenuItem = contextMenu.Items[contextMenuRunWaveHeightCalculationsIndex]; - - Assert.AreEqual("Alles be&rekenen", contextMenuItem.Text); - StringAssert.Contains("Doelkans is te groot om een berekening uit te kunnen voeren.", contextMenuItem.ToolTipText); - TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.CalculateAllIcon, contextMenuItem.Image); - Assert.IsFalse(contextMenuItem.Enabled); - } - } - } - - mockRepository.VerifyAll(); // Expect no calls on arguments - } - - [Test] public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemCalculateAllEnabled() { // Setup @@ -495,7 +445,7 @@ }; HydraulicBoundaryDatabaseTestHelper.SetHydraulicBoundaryLocationConfigurationSettings(assessmentSection.HydraulicBoundaryDatabase); - Func getNormFunc = () => 0.01; + double GetNormFunc() => 0.01; var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation("locationName"); var hydraulicBoundaryLocationCalculations = new ObservableList @@ -505,7 +455,7 @@ var context = new WaveHeightCalculationsContext(hydraulicBoundaryLocationCalculations, assessmentSection, - getNormFunc, + GetNormFunc, "A"); using (var treeViewControl = new TreeViewControl()) @@ -555,7 +505,7 @@ WaveHeightCalculationInput waveHeightCalculationInput = waveHeightCalculator.ReceivedInputs.First(); Assert.AreEqual(hydraulicBoundaryLocation.Id, waveHeightCalculationInput.HydraulicBoundaryLocationId); - Assert.AreEqual(StatisticsConverter.ProbabilityToReliability(getNormFunc()), waveHeightCalculationInput.Beta); + Assert.AreEqual(StatisticsConverter.ProbabilityToReliability(GetNormFunc()), waveHeightCalculationInput.Beta); } } } @@ -584,7 +534,7 @@ }; HydraulicBoundaryDatabaseTestHelper.SetHydraulicBoundaryLocationConfigurationSettings(assessmentSection.HydraulicBoundaryDatabase); - Func getNormFunc = () => 0.01; + double GetNormFunc() => 0.01; var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation("locationName"); var hydraulicBoundaryLocationCalculations = new ObservableList @@ -594,7 +544,7 @@ var context = new WaveHeightCalculationsContext(hydraulicBoundaryLocationCalculations, assessmentSection, - getNormFunc, + GetNormFunc, "A"); using (var treeViewControl = new TreeViewControl()) @@ -643,7 +593,7 @@ WaveHeightCalculationInput waveHeightCalculationInput = waveHeightCalculator.ReceivedInputs.First(); Assert.AreEqual(hydraulicBoundaryLocation.Id, waveHeightCalculationInput.HydraulicBoundaryLocationId); - Assert.AreEqual(StatisticsConverter.ProbabilityToReliability(getNormFunc()), waveHeightCalculationInput.Beta); + Assert.AreEqual(StatisticsConverter.ProbabilityToReliability(GetNormFunc()), waveHeightCalculationInput.Beta); } } } @@ -671,7 +621,7 @@ }; HydraulicBoundaryDatabaseTestHelper.SetHydraulicBoundaryLocationConfigurationSettings(assessmentSection.HydraulicBoundaryDatabase); - Func getNormFunc = () => 0.01; + double GetNormFunc() => 0.01; var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation("locationName"); var hydraulicBoundaryLocationCalculations = new ObservableList @@ -681,7 +631,7 @@ var context = new WaveHeightCalculationsContext(hydraulicBoundaryLocationCalculations, assessmentSection, - getNormFunc, + GetNormFunc, "A"); using (var treeViewControl = new TreeViewControl()) @@ -730,7 +680,7 @@ WaveHeightCalculationInput waveHeightCalculationInput = waveHeightCalculator.ReceivedInputs.First(); Assert.AreEqual(hydraulicBoundaryLocation.Id, waveHeightCalculationInput.HydraulicBoundaryLocationId); - Assert.AreEqual(StatisticsConverter.ProbabilityToReliability(getNormFunc()), waveHeightCalculationInput.Beta); + Assert.AreEqual(StatisticsConverter.ProbabilityToReliability(GetNormFunc()), waveHeightCalculationInput.Beta); } } } @@ -805,10 +755,10 @@ using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) { // When - Action action = () => contextMenuAdapter.Items[contextMenuRunWaveHeightCalculationsIndex].PerformClick(); + void Action() => contextMenuAdapter.Items[contextMenuRunWaveHeightCalculationsIndex].PerformClick(); // Then - TestHelper.AssertLogMessages(action, messages => + TestHelper.AssertLogMessages(Action, messages => { string[] msgs = messages.ToArray(); Assert.AreEqual(8, msgs.Length);