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