Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs
===================================================================
diff -u -r13c53cd1231ab43cab258598b0e87f48ca0fd324 -re57574d36463df31c1bc2bdecac9b3784d3d7097
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs (.../DesignWaterLevelLocationsView.cs) (revision 13c53cd1231ab43cab258598b0e87f48ca0fd324)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs (.../DesignWaterLevelLocationsView.cs) (revision e57574d36463df31c1bc2bdecac9b3784d3d7097)
@@ -48,11 +48,15 @@
/// based on .
/// The assessment section which the locations belong to.
/// for getting the norm to use during calculations.
- /// Thrown when any input parameter is null.
+ /// The name of the category boundary.
+ /// Thrown when , ,
+ /// or is null.
+ /// Thrown when is null or empty.
public DesignWaterLevelLocationsView(ObservableList locations,
Func getCalculationFunc,
IAssessmentSection assessmentSection,
- Func getNormFunc)
+ Func getNormFunc,
+ string categoryBoundaryName)
: base(locations, getCalculationFunc, assessmentSection)
{
if (getNormFunc == null)
@@ -62,7 +66,7 @@
InitializeComponent();
- messageProvider = new DesignWaterLevelCalculationMessageProvider();
+ messageProvider = new DesignWaterLevelCalculationMessageProvider(categoryBoundaryName);
this.getNormFunc = getNormFunc;
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs
===================================================================
diff -u -rbc3e9533de8e4e270211af3ef1821373fe907569 -re57574d36463df31c1bc2bdecac9b3784d3d7097
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs (.../DesignWaterLevelLocationsViewTest.cs) (revision bc3e9533de8e4e270211af3ef1821373fe907569)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs (.../DesignWaterLevelLocationsViewTest.cs) (revision e57574d36463df31c1bc2bdecac9b3784d3d7097)
@@ -83,7 +83,8 @@
TestDelegate test = () => new DesignWaterLevelLocationsView(new ObservableList(),
hbl => new HydraulicBoundaryLocationCalculation(),
assessmentSection,
- null);
+ null,
+ "Category");
// Assert
var exception = Assert.Throws(test);
@@ -101,7 +102,8 @@
using (var view = new DesignWaterLevelLocationsView(new ObservableList(),
hbl => new HydraulicBoundaryLocationCalculation(),
assessmentSection,
- () => 0.01))
+ () => 0.01,
+ "Category"))
{
// Assert
Assert.IsInstanceOf(view);
@@ -117,7 +119,7 @@
mockRepository.ReplayAll();
// Call
- ShowDesignWaterLevelLocationsView(new ObservableList(), assessmentSection, 0.01, testForm);
+ ShowDesignWaterLevelLocationsView(new ObservableList(), assessmentSection, 0.01, "Category", testForm);
// Assert
DataGridView locationsDataGridView = GetLocationsDataGridView();
@@ -357,6 +359,7 @@
// Setup
const string databaseFilePath = "DatabaseFilePath";
const double norm = 0.01;
+ const string categoryBoundaryName = "Category";
var assessmentSection = mockRepository.Stub();
var hydraulicBoundaryDatabase = new TestHydraulicBoundaryDatabase
@@ -377,6 +380,7 @@
HydraulicBoundaryLocation[] calculatedLocationsValue = null;
Func getCalculationFunc = null;
double normValue = double.NaN;
+ var categoryBoundaryNameValue = "";
ICalculationMessageProvider messageProviderValue = null;
guiService.Expect(ch => ch.CalculateDesignWaterLevels(null, null, null, null, int.MinValue, null)).IgnoreArguments().WhenCalled(
invocation =>
@@ -386,12 +390,13 @@
calculatedLocationsValue = ((IEnumerable) invocation.Arguments[2]).ToArray();
getCalculationFunc = (Func) invocation.Arguments[3];
normValue = (double) invocation.Arguments[4];
- messageProviderValue = (ICalculationMessageProvider) invocation.Arguments[5];
+ categoryBoundaryNameValue = (string) invocation.Arguments[5];
+ messageProviderValue = (ICalculationMessageProvider) invocation.Arguments[6];
});
mockRepository.ReplayAll();
- DesignWaterLevelLocationsView view = ShowDesignWaterLevelLocationsView(hydraulicBoundaryDatabase.Locations, assessmentSection, norm, testForm);
+ DesignWaterLevelLocationsView view = ShowDesignWaterLevelLocationsView(hydraulicBoundaryDatabase.Locations, assessmentSection, norm, categoryBoundaryName, testForm);
DataGridView locationsDataGridView = GetLocationsDataGridView();
DataGridViewRowCollection rows = locationsDataGridView.Rows;
rows[0].Cells[locationCalculateColumnIndex].Value = true;
@@ -407,6 +412,7 @@
Assert.AreEqual(databaseFilePath, hydraulicBoundaryDatabaseFilePathValue);
Assert.AreEqual("", preprocessorDirectoryValue);
Assert.AreEqual(norm, normValue);
+ Assert.AreEqual(categoryBoundaryName, categoryBoundaryNameValue);
Assert.AreEqual(1, calculatedLocationsValue.Length);
HydraulicBoundaryLocation expectedLocation = hydraulicBoundaryDatabase.Locations.First();
Assert.AreEqual(expectedLocation, calculatedLocationsValue.First());
@@ -420,6 +426,7 @@
const string databaseFilePath = "DatabaseFilePath";
const string preprocessorDirectory = "PreprocessorDirectory";
const double norm = 0.01;
+ const string categoryBoundaryName = "Category";
var assessmentSection = mockRepository.Stub();
var hydraulicBoundaryDatabase = new TestHydraulicBoundaryDatabase
@@ -443,6 +450,7 @@
HydraulicBoundaryLocation[] calculatedLocationsValue = null;
Func getCalculationFunc = null;
double normValue = double.NaN;
+ var categoryBoundaryNameValue = "";
ICalculationMessageProvider messageProviderValue = null;
guiService.Expect(ch => ch.CalculateDesignWaterLevels(null, null, null, null, int.MinValue, null)).IgnoreArguments().WhenCalled(
invocation =>
@@ -452,12 +460,13 @@
calculatedLocationsValue = ((IEnumerable) invocation.Arguments[2]).ToArray();
getCalculationFunc = (Func) invocation.Arguments[3];
normValue = (double) invocation.Arguments[4];
- messageProviderValue = (ICalculationMessageProvider) invocation.Arguments[5];
+ categoryBoundaryNameValue = (string) invocation.Arguments[5];
+ messageProviderValue = (ICalculationMessageProvider) invocation.Arguments[6];
});
mockRepository.ReplayAll();
- DesignWaterLevelLocationsView view = ShowDesignWaterLevelLocationsView(hydraulicBoundaryDatabase.Locations, assessmentSection, norm, testForm);
+ DesignWaterLevelLocationsView view = ShowDesignWaterLevelLocationsView(hydraulicBoundaryDatabase.Locations, assessmentSection, norm, categoryBoundaryName, testForm);
DataGridView locationsDataGridView = GetLocationsDataGridView();
DataGridViewRowCollection rows = locationsDataGridView.Rows;
rows[0].Cells[locationCalculateColumnIndex].Value = true;
@@ -473,6 +482,7 @@
Assert.AreEqual(databaseFilePath, hydraulicBoundaryDatabaseFilePathValue);
Assert.AreEqual(preprocessorDirectory, preprocessorDirectoryValue);
Assert.AreEqual(norm, normValue);
+ Assert.AreEqual(categoryBoundaryName, categoryBoundaryNameValue);
Assert.AreEqual(1, calculatedLocationsValue.Length);
HydraulicBoundaryLocation expectedLocation = hydraulicBoundaryDatabase.Locations.First();
Assert.AreEqual(expectedLocation, calculatedLocationsValue.First());
@@ -485,6 +495,7 @@
// Setup
const string databaseFilePath = "DatabaseFilePath";
const double norm = 0.01;
+ const string categoryBoundaryName = "Category";
var assessmentSection = mockRepository.Stub();
var hydraulicBoundaryDatabase = new TestHydraulicBoundaryDatabase
@@ -508,6 +519,7 @@
HydraulicBoundaryLocation[] calculatedLocationsValue = null;
Func getCalculationFunc = null;
double normValue = double.NaN;
+ var categoryBoundaryNameValue = "";
ICalculationMessageProvider messageProviderValue = null;
guiService.Expect(ch => ch.CalculateDesignWaterLevels(null, null, null, null, int.MinValue, null)).IgnoreArguments().WhenCalled(
invocation =>
@@ -517,12 +529,13 @@
calculatedLocationsValue = ((IEnumerable) invocation.Arguments[2]).ToArray();
getCalculationFunc = (Func) invocation.Arguments[3];
normValue = (double) invocation.Arguments[4];
- messageProviderValue = (ICalculationMessageProvider) invocation.Arguments[5];
+ categoryBoundaryNameValue = (string) invocation.Arguments[5];
+ messageProviderValue = (ICalculationMessageProvider) invocation.Arguments[6];
});
mockRepository.ReplayAll();
- DesignWaterLevelLocationsView view = ShowDesignWaterLevelLocationsView(hydraulicBoundaryDatabase.Locations, assessmentSection, norm, testForm);
+ DesignWaterLevelLocationsView view = ShowDesignWaterLevelLocationsView(hydraulicBoundaryDatabase.Locations, assessmentSection, norm, categoryBoundaryName, testForm);
DataGridView locationsDataGridView = GetLocationsDataGridView();
DataGridViewRowCollection rows = locationsDataGridView.Rows;
rows[0].Cells[locationCalculateColumnIndex].Value = true;
@@ -538,6 +551,7 @@
Assert.AreEqual(databaseFilePath, hydraulicBoundaryDatabaseFilePathValue);
Assert.AreEqual(string.Empty, preprocessorDirectoryValue);
Assert.AreEqual(norm, normValue);
+ Assert.AreEqual(categoryBoundaryName, categoryBoundaryNameValue);
Assert.AreEqual(1, calculatedLocationsValue.Length);
HydraulicBoundaryLocation expectedLocation = hydraulicBoundaryDatabase.Locations.First();
Assert.AreEqual(expectedLocation, calculatedLocationsValue.First());
@@ -577,12 +591,14 @@
private static DesignWaterLevelLocationsView ShowDesignWaterLevelLocationsView(ObservableList locations,
IAssessmentSection assessmentSection,
double norm,
+ string categoryBoundaryName,
Form form)
{
var view = new DesignWaterLevelLocationsView(locations,
hbl => hbl.DesignWaterLevelCalculation1,
assessmentSection,
- () => norm);
+ () => norm,
+ categoryBoundaryName);
form.Controls.Add(view);
form.Show();
@@ -595,7 +611,7 @@
{
var assessmentSection = new ObservableTestAssessmentSectionStub();
- return ShowDesignWaterLevelLocationsView(locations, assessmentSection, 0.01, form);
+ return ShowDesignWaterLevelLocationsView(locations, assessmentSection, 0.01, "Category", form);
}
private class TestHydraulicBoundaryDatabase : HydraulicBoundaryDatabase