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"))