Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Merge/AssessmentSectionProviderDialog.cs =================================================================== diff -u -r18de555608fde7d9bfcef1346ff811dac47255eb -rd1e995328e2e80a3b292492724112a5072d31ca3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Merge/AssessmentSectionProviderDialog.cs (.../AssessmentSectionProviderDialog.cs) (revision 18de555608fde7d9bfcef1346ff811dac47255eb) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Merge/AssessmentSectionProviderDialog.cs (.../AssessmentSectionProviderDialog.cs) (revision d1e995328e2e80a3b292492724112a5072d31ca3) @@ -25,6 +25,11 @@ public bool SelectData(IEnumerable assessmentSections) { + if (assessmentSections == null) + { + throw new ArgumentNullException(nameof(assessmentSections)); + } + SetComboBoxData(assessmentSections); Show(); Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Merge/IMergeDataProvider.cs =================================================================== diff -u -r0abc3d3c19968df4450672ef585b3262d00b3ff8 -rd1e995328e2e80a3b292492724112a5072d31ca3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Merge/IMergeDataProvider.cs (.../IMergeDataProvider.cs) (revision 0abc3d3c19968df4450672ef585b3262d00b3ff8) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Merge/IMergeDataProvider.cs (.../IMergeDataProvider.cs) (revision d1e995328e2e80a3b292492724112a5072d31ca3) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.Collections.Generic; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Integration.Data; @@ -45,6 +46,8 @@ /// /// The collection of assessment sections to select from. /// Indicator whether selection succeeded. + /// Thrown when + /// is null. bool SelectData(IEnumerable assessmentSections); } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Merge/AssessmentSectionProviderDialogTest.cs =================================================================== diff -u -r18de555608fde7d9bfcef1346ff811dac47255eb -rd1e995328e2e80a3b292492724112a5072d31ca3 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Merge/AssessmentSectionProviderDialogTest.cs (.../AssessmentSectionProviderDialogTest.cs) (revision 18de555608fde7d9bfcef1346ff811dac47255eb) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Merge/AssessmentSectionProviderDialogTest.cs (.../AssessmentSectionProviderDialogTest.cs) (revision d1e995328e2e80a3b292492724112a5072d31ca3) @@ -136,6 +136,27 @@ } [Test] + public void SelectData_AssessmentSectionsNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var dialogParent = mocks.Stub(); + mocks.ReplayAll(); + + using (var dialog = new AssessmentSectionProviderDialog(dialogParent)) + { + // Call + TestDelegate call = () => dialog.SelectData(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("assessmentSections", exception.ParamName); + } + + mocks.VerifyAll(); + } + + [Test] public void SelectData_WithEmptyAssessmentSections_SetsDataOnDialog() { // Setup @@ -204,7 +225,7 @@ var comboBox = (ComboBox) new ComboBoxTester("assessmentSectionComboBox", dialog).TheObject; var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; - + // Precondition AssessmentSection defaultSelectedAssessmentSection = assessmentSections[0]; Assert.AreSame(defaultSelectedAssessmentSection, comboBox.SelectedItem);