Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/DesignWaterLevelLocationsContextTreeNodeInfoTest.cs =================================================================== diff -u -rbf6f075099ac4af95a9c0065604d2c5a8a55cf8d -rdaad7104ad012ba7dd5526597d183b87eb7bd564 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/DesignWaterLevelLocationsContextTreeNodeInfoTest.cs (.../DesignWaterLevelLocationsContextTreeNodeInfoTest.cs) (revision bf6f075099ac4af95a9c0065604d2c5a8a55cf8d) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/DesignWaterLevelLocationsContextTreeNodeInfoTest.cs (.../DesignWaterLevelLocationsContextTreeNodeInfoTest.cs) (revision daad7104ad012ba7dd5526597d183b87eb7bd564) @@ -99,7 +99,7 @@ var context = new DesignWaterLevelLocationsContext(new ObservableList(), assessmentSection, () => 0.01, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), categoryBoundaryName); // Setup @@ -153,7 +153,7 @@ var nodeData = new DesignWaterLevelLocationsContext(new ObservableList(), assessmentSection, () => 0.01, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); using (var treeViewControl = new TreeViewControl()) @@ -188,7 +188,7 @@ var nodeData = new DesignWaterLevelLocationsContext(new ObservableList(), assessmentSection, () => 0.01, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); using (var treeViewControl = new TreeViewControl()) @@ -231,7 +231,7 @@ var nodeData = new DesignWaterLevelLocationsContext(assessmentSection.HydraulicBoundaryDatabase.Locations, assessmentSection, () => 0.01, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); using (var treeViewControl = new TreeViewControl()) @@ -280,7 +280,7 @@ var nodeData = new DesignWaterLevelLocationsContext(hydraulicBoundaryDatabase.Locations, assessmentSection, () => 0.01, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); using (var treeViewControl = new TreeViewControl()) @@ -335,7 +335,7 @@ var context = new DesignWaterLevelLocationsContext(assessmentSection.HydraulicBoundaryDatabase.Locations, assessmentSection, getNormFunc, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); using (var treeViewControl = new TreeViewControl()) @@ -407,7 +407,7 @@ var context = new DesignWaterLevelLocationsContext(assessmentSection.HydraulicBoundaryDatabase.Locations, assessmentSection, getNormFunc, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); using (var treeViewControl = new TreeViewControl()) @@ -478,7 +478,7 @@ var context = new DesignWaterLevelLocationsContext(assessmentSection.HydraulicBoundaryDatabase.Locations, assessmentSection, getNormFunc, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); using (var treeViewControl = new TreeViewControl()) @@ -529,21 +529,22 @@ public void GivenHydraulicBoundaryLocationThatSucceeds_CalculatingAssessmentLevelFromContextMenu_ThenLogMessagesAddedOutputSet() { // Given - var location = new TestHydraulicBoundaryLocation("locationName"); + const string locationName = "locationName"; + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(locationName); var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike) { HydraulicBoundaryDatabase = { Locations = { - location + hydraulicBoundaryLocation }, FilePath = Path.Combine(testDataPath, "HRD ijsselmeer.sqlite") } }; const string categoryBoundaryName = "Category"; - var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(); + var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation); var context = new DesignWaterLevelLocationsContext(assessmentSection.HydraulicBoundaryDatabase.Locations, assessmentSection, () => 0.01, @@ -589,14 +590,14 @@ { string[] msgs = messages.ToArray(); Assert.AreEqual(8, msgs.Length); - Assert.AreEqual($"Toetspeil berekenen voor locatie '{location.Name}' ({categoryBoundaryName}) is gestart.", msgs[0]); + Assert.AreEqual($"Toetspeil berekenen voor locatie '{locationName}' ({categoryBoundaryName}) is gestart.", msgs[0]); CalculationServiceTestHelper.AssertValidationStartMessage(msgs[1]); CalculationServiceTestHelper.AssertValidationEndMessage(msgs[2]); CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[3]); - Assert.AreEqual($"Toetspeil berekening voor locatie '{location.Name}' ({categoryBoundaryName}) is niet geconvergeerd.", msgs[4]); + Assert.AreEqual($"Toetspeil berekening voor locatie '{locationName}' ({categoryBoundaryName}) is niet geconvergeerd.", msgs[4]); StringAssert.StartsWith("Toetspeil berekening is uitgevoerd op de tijdelijke locatie", msgs[5]); CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[6]); - Assert.AreEqual($"Toetspeil berekenen voor locatie '{location.Name}' ({categoryBoundaryName}) is gelukt.", msgs[7]); + Assert.AreEqual($"Toetspeil berekenen voor locatie '{locationName}' ({categoryBoundaryName}) is gelukt.", msgs[7]); }); HydraulicBoundaryLocationOutput output = hydraulicBoundaryLocationCalculation.Output; Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/WaveHeightLocationsContextTreeNodeInfoTest.cs =================================================================== diff -u -rbf6f075099ac4af95a9c0065604d2c5a8a55cf8d -rdaad7104ad012ba7dd5526597d183b87eb7bd564 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/WaveHeightLocationsContextTreeNodeInfoTest.cs (.../WaveHeightLocationsContextTreeNodeInfoTest.cs) (revision bf6f075099ac4af95a9c0065604d2c5a8a55cf8d) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/WaveHeightLocationsContextTreeNodeInfoTest.cs (.../WaveHeightLocationsContextTreeNodeInfoTest.cs) (revision daad7104ad012ba7dd5526597d183b87eb7bd564) @@ -99,7 +99,7 @@ var context = new WaveHeightLocationsContext(new ObservableList(), assessmentSection, () => 0.01, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), categoryBoundaryName); // Setup @@ -153,7 +153,7 @@ var nodeData = new WaveHeightLocationsContext(new ObservableList(), assessmentSection, () => 0.01, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); using (var treeViewControl = new TreeViewControl()) @@ -188,7 +188,7 @@ var nodeData = new WaveHeightLocationsContext(new ObservableList(), assessmentSection, () => 0.01, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); using (var treeViewControl = new TreeViewControl()) @@ -231,7 +231,7 @@ var nodeData = new WaveHeightLocationsContext(assessmentSection.HydraulicBoundaryDatabase.Locations, assessmentSection, () => 0.01, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); using (var treeViewControl = new TreeViewControl()) @@ -280,7 +280,7 @@ var nodeData = new WaveHeightLocationsContext(hydraulicBoundaryDatabase.Locations, assessmentSection, () => 0.01, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); using (var treeViewControl = new TreeViewControl()) @@ -335,7 +335,7 @@ var context = new WaveHeightLocationsContext(assessmentSection.HydraulicBoundaryDatabase.Locations, assessmentSection, getNormFunc, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); using (var treeViewControl = new TreeViewControl()) @@ -407,7 +407,7 @@ var context = new WaveHeightLocationsContext(assessmentSection.HydraulicBoundaryDatabase.Locations, assessmentSection, getNormFunc, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); using (var treeViewControl = new TreeViewControl()) @@ -478,7 +478,7 @@ var context = new WaveHeightLocationsContext(assessmentSection.HydraulicBoundaryDatabase.Locations, assessmentSection, getNormFunc, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); using (var treeViewControl = new TreeViewControl()) @@ -530,22 +530,22 @@ { // Given const string locationName = "locationName"; - var location = new TestHydraulicBoundaryLocation(locationName); + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(locationName); var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike) { HydraulicBoundaryDatabase = { Locations = { - location + hydraulicBoundaryLocation }, FilePath = Path.Combine(testDataPath, "HRD ijsselmeer.sqlite") }, Id = string.Empty }; const string categoryBoundaryName = "Category"; - var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(); + var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation); var context = new WaveHeightLocationsContext(assessmentSection.HydraulicBoundaryDatabase.Locations, assessmentSection, () => 0.01, Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/DesignWaterLevelLocationsViewInfoTest.cs =================================================================== diff -u -rfc3b0b96c11a1e048daa4984cb080486abea89ad -rdaad7104ad012ba7dd5526597d183b87eb7bd564 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/DesignWaterLevelLocationsViewInfoTest.cs (.../DesignWaterLevelLocationsViewInfoTest.cs) (revision fc3b0b96c11a1e048daa4984cb080486abea89ad) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/DesignWaterLevelLocationsViewInfoTest.cs (.../DesignWaterLevelLocationsViewInfoTest.cs) (revision daad7104ad012ba7dd5526597d183b87eb7bd564) @@ -76,7 +76,7 @@ var context = new DesignWaterLevelLocationsContext(new ObservableList(), new ObservableTestAssessmentSectionStub(), () => 0.01, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), categoryBoundaryName); // Call @@ -125,7 +125,7 @@ var context = new DesignWaterLevelLocationsContext(locations, assessmentSection, () => 0.01, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); // Call @@ -143,7 +143,7 @@ var context = new DesignWaterLevelLocationsContext(new ObservableList(), assessmentSection, () => 0.01, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); // Call @@ -158,31 +158,29 @@ { // Setup var random = new Random(); - var hydraulicBoundaryLocations = new ObservableList(); - var hydraulicBoundaryLocationsLookup = new Dictionary + + var hydraulicBoundaryLocations = new ObservableList { + new TestHydraulicBoundaryLocation(), + new TestHydraulicBoundaryLocation() + }; + + var hydraulicBoundaryLocationCalculations = new[] + { + new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocations[0]) { - new TestHydraulicBoundaryLocation(), - new HydraulicBoundaryLocationCalculation - { - Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()) - } + Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()) }, + new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocations[1]) { - new TestHydraulicBoundaryLocation(), - new HydraulicBoundaryLocationCalculation - { - Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()) - } + Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()) } }; - hydraulicBoundaryLocations.AddRange(hydraulicBoundaryLocationsLookup.Keys); - var context = new DesignWaterLevelLocationsContext(hydraulicBoundaryLocations, new ObservableTestAssessmentSectionStub(), () => 0.01, - hbl => hydraulicBoundaryLocationsLookup[hbl], + hbl => hydraulicBoundaryLocationCalculations.First(hblc => ReferenceEquals(hblc.HydraulicBoundaryLocation, hbl)), "Category"); // Call @@ -197,8 +195,8 @@ DataGridView locationsDataGridView = ControlTestHelper.GetDataGridView(view, "DataGridView"); DataGridViewRowCollection rows = locationsDataGridView.Rows; Assert.AreEqual(2, rows.Count); - Assert.AreEqual(hydraulicBoundaryLocationsLookup.Values.ElementAt(0).Output.Result.ToString(), rows[0].Cells[locationDesignWaterLevelColumnIndex].FormattedValue); - Assert.AreEqual(hydraulicBoundaryLocationsLookup.Values.ElementAt(1).Output.Result.ToString(), rows[1].Cells[locationDesignWaterLevelColumnIndex].FormattedValue); + Assert.AreEqual(hydraulicBoundaryLocationCalculations[0].Output.Result.ToString(), rows[0].Cells[locationDesignWaterLevelColumnIndex].FormattedValue); + Assert.AreEqual(hydraulicBoundaryLocationCalculations[1].Output.Result.ToString(), rows[1].Cells[locationDesignWaterLevelColumnIndex].FormattedValue); } } @@ -212,7 +210,7 @@ { new TestHydraulicBoundaryLocation() }; - Func getCalculationFunc = hbl => new HydraulicBoundaryLocationCalculation(); + Func getCalculationFunc = hbl => new HydraulicBoundaryLocationCalculation(hbl); var context = new DesignWaterLevelLocationsContext(hydraulicBoundaryLocations, new ObservableTestAssessmentSectionStub(), @@ -280,14 +278,16 @@ const string categoryBoundaryName = "Category"; + Func getCalculationFunc = hbl => new HydraulicBoundaryLocationCalculation(hbl); + var context = new DesignWaterLevelLocationsContext(locations, assessmentSection, getNormFunc, - hbl => new HydraulicBoundaryLocationCalculation(), + getCalculationFunc, categoryBoundaryName); using (var view = new DesignWaterLevelLocationsView(locations, - hbl => new HydraulicBoundaryLocationCalculation(), + getCalculationFunc, new ObservableTestAssessmentSectionStub(), getNormFunc, categoryBoundaryName)) @@ -315,7 +315,7 @@ var assessmentSection = new ObservableTestAssessmentSectionStub(); using (var view = new DesignWaterLevelLocationsView(new ObservableList(), - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), assessmentSection, () => 0.01, "Category")) @@ -336,7 +336,7 @@ var assessmentSectionB = new ObservableTestAssessmentSectionStub(); using (var view = new DesignWaterLevelLocationsView(new ObservableList(), - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), assessmentSectionA, () => 0.01, "Category")) @@ -356,7 +356,7 @@ var assessmentSectionA = new ObservableTestAssessmentSectionStub(); using (var view = new DesignWaterLevelLocationsView(new ObservableList(), - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), assessmentSectionA, () => 0.01, "Category")) Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/WaveHeightLocationsViewInfoTest.cs =================================================================== diff -u -rfc3b0b96c11a1e048daa4984cb080486abea89ad -rdaad7104ad012ba7dd5526597d183b87eb7bd564 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/WaveHeightLocationsViewInfoTest.cs (.../WaveHeightLocationsViewInfoTest.cs) (revision fc3b0b96c11a1e048daa4984cb080486abea89ad) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/WaveHeightLocationsViewInfoTest.cs (.../WaveHeightLocationsViewInfoTest.cs) (revision daad7104ad012ba7dd5526597d183b87eb7bd564) @@ -76,7 +76,7 @@ var context = new WaveHeightLocationsContext(new ObservableList(), new ObservableTestAssessmentSectionStub(), () => 0.01, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), categoryBoundaryName); // Call @@ -126,7 +126,7 @@ var context = new WaveHeightLocationsContext(locations, assessmentSection, () => 0.01, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); // Call @@ -144,7 +144,7 @@ var context = new WaveHeightLocationsContext(new ObservableList(), assessmentSection, () => 0.01, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), "Category"); // Call @@ -159,31 +159,29 @@ { // Setup var random = new Random(); - var hydraulicBoundaryLocations = new ObservableList(); - var hydraulicBoundaryLocationsLookup = new Dictionary + + var hydraulicBoundaryLocations = new ObservableList { + new TestHydraulicBoundaryLocation(), + new TestHydraulicBoundaryLocation() + }; + + var hydraulicBoundaryLocationCalculations = new[] + { + new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocations[0]) { - new TestHydraulicBoundaryLocation(), - new HydraulicBoundaryLocationCalculation - { - Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()) - } + Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()) }, + new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocations[1]) { - new TestHydraulicBoundaryLocation(), - new HydraulicBoundaryLocationCalculation - { - Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()) - } + Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()) } }; - hydraulicBoundaryLocations.AddRange(hydraulicBoundaryLocationsLookup.Keys); - var context = new WaveHeightLocationsContext(hydraulicBoundaryLocations, new ObservableTestAssessmentSectionStub(), () => 0.01, - hbl => hydraulicBoundaryLocationsLookup[hbl], + hbl => hydraulicBoundaryLocationCalculations.First(hblc => ReferenceEquals(hblc.HydraulicBoundaryLocation, hbl)), "Category"); // Call @@ -198,8 +196,8 @@ DataGridView locationsDataGridView = ControlTestHelper.GetDataGridView(view, "DataGridView"); DataGridViewRowCollection rows = locationsDataGridView.Rows; Assert.AreEqual(2, rows.Count); - Assert.AreEqual(hydraulicBoundaryLocationsLookup.Values.ElementAt(0).Output.Result.ToString(), rows[0].Cells[locationWaveHeightColumnIndex].FormattedValue); - Assert.AreEqual(hydraulicBoundaryLocationsLookup.Values.ElementAt(1).Output.Result.ToString(), rows[1].Cells[locationWaveHeightColumnIndex].FormattedValue); + Assert.AreEqual(hydraulicBoundaryLocationCalculations[0].Output.Result.ToString(), rows[0].Cells[locationWaveHeightColumnIndex].FormattedValue); + Assert.AreEqual(hydraulicBoundaryLocationCalculations[1].Output.Result.ToString(), rows[1].Cells[locationWaveHeightColumnIndex].FormattedValue); } } @@ -213,7 +211,7 @@ { new TestHydraulicBoundaryLocation() }; - Func getCalculationFunc = hbl => new HydraulicBoundaryLocationCalculation(); + Func getCalculationFunc = hbl => new HydraulicBoundaryLocationCalculation(hbl); var context = new WaveHeightLocationsContext(hydraulicBoundaryLocations, new ObservableTestAssessmentSectionStub(), @@ -282,14 +280,16 @@ const string categoryBoundaryName = "Category"; + Func getCalculationFunc = hbl => new HydraulicBoundaryLocationCalculation(hbl); + var context = new WaveHeightLocationsContext(locations, assessmentSection, getNormFunc, - hbl => new HydraulicBoundaryLocationCalculation(), + getCalculationFunc, categoryBoundaryName); using (var view = new WaveHeightLocationsView(locations, - hbl => new HydraulicBoundaryLocationCalculation(), + getCalculationFunc, assessmentSection, getNormFunc, categoryBoundaryName)) @@ -317,7 +317,7 @@ var assessmentSection = new ObservableTestAssessmentSectionStub(); using (var view = new WaveHeightLocationsView(new ObservableList(), - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), assessmentSection, () => 0.01, "Category")) @@ -338,7 +338,7 @@ var assessmentSectionB = new ObservableTestAssessmentSectionStub(); using (var view = new WaveHeightLocationsView(new ObservableList(), - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), assessmentSectionA, () => 0.01, "Category")) @@ -358,7 +358,7 @@ var assessmentSectionA = new ObservableTestAssessmentSectionStub(); using (var view = new WaveHeightLocationsView(new ObservableList(), - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => new HydraulicBoundaryLocationCalculation(hbl), assessmentSectionA, () => 0.01, "Category"))