Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultPerSectionView.cs
===================================================================
diff -u -rd61d7132f071bfb24f72fba861f85b7a35814b5d -r0cc72be2fd4e559be6f4ca8c8b19d553d904c165
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultPerSectionView.cs (.../AssemblyResultPerSectionView.cs) (revision d61d7132f071bfb24f72fba861f85b7a35814b5d)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultPerSectionView.cs (.../AssemblyResultPerSectionView.cs) (revision 0cc72be2fd4e559be6f4ca8c8b19d553d904c165)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using System.Windows.Forms;
using Core.Common.Controls.Views;
using Ringtoets.Integration.Data;
@@ -34,11 +35,25 @@
///
/// Creates a new instance of .
///
- public AssemblyResultPerSectionView()
+ /// The to create the view for.
+ /// Thrown when
+ /// is null.
+ public AssemblyResultPerSectionView(AssessmentSection assessmentSection)
{
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ AssessmentSection = assessmentSection;
InitializeComponent();
}
+ ///
+ /// Gets the the view belongs to.
+ ///
+ public AssessmentSection AssessmentSection { get; }
+
public object Data { get; set; }
}
-}
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultPerSectionViewTest.cs
===================================================================
diff -u -rd61d7132f071bfb24f72fba861f85b7a35814b5d -r0cc72be2fd4e559be6f4ca8c8b19d553d904c165
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultPerSectionViewTest.cs (.../AssemblyResultPerSectionViewTest.cs) (revision d61d7132f071bfb24f72fba861f85b7a35814b5d)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultPerSectionViewTest.cs (.../AssemblyResultPerSectionViewTest.cs) (revision 0cc72be2fd4e559be6f4ca8c8b19d553d904c165)
@@ -19,9 +19,13 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using System.Windows.Forms;
using Core.Common.Controls.Views;
+using Core.Common.TestUtil;
using NUnit.Framework;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Integration.Data;
using Ringtoets.Integration.Forms.Views;
namespace Ringtoets.Integration.Forms.Test.Views
@@ -30,15 +34,31 @@
public class AssemblyResultPerSectionViewTest
{
[Test]
- public void Constructor_WithAssessmentSection_ExpectedValuesSet()
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
{
// Call
- using (var view = new AssemblyResultPerSectionView())
+ TestDelegate call = () => new AssemblyResultPerSectionView(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_WithAssessmentSection_ExpectedValues()
+ {
+ // Setup
+ var random = new Random(39);
+ var assessmentSection = new AssessmentSection(random.NextEnumValue());
+
+ // Call
+ using (var view = new AssemblyResultPerSectionView(assessmentSection))
{
// Assert
Assert.IsInstanceOf(view);
Assert.IsInstanceOf(view);
Assert.IsNull(view.Data);
+ Assert.AreSame(assessmentSection, view.AssessmentSection);
}
}
}