Index: Riskeer/Integration/src/Riskeer.Integration.Forms/PresentationObjects/HydraulicBoundaryDatabaseContext.cs =================================================================== diff -u -r6039c7413267b75578dd7df2c1b57e51a5bd44bd -rc7dbd30a5f6b57cad128d5f5d6cd076eefc50c12 --- Riskeer/Integration/src/Riskeer.Integration.Forms/PresentationObjects/HydraulicBoundaryDatabaseContext.cs (.../HydraulicBoundaryDatabaseContext.cs) (revision 6039c7413267b75578dd7df2c1b57e51a5bd44bd) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/PresentationObjects/HydraulicBoundaryDatabaseContext.cs (.../HydraulicBoundaryDatabaseContext.cs) (revision c7dbd30a5f6b57cad128d5f5d6cd076eefc50c12) @@ -22,6 +22,7 @@ using System; using Core.Common.Controls.PresentationObjects; using Riskeer.Common.Data.Hydraulics; +using Riskeer.Integration.Data; namespace Riskeer.Integration.Forms.PresentationObjects { @@ -35,21 +36,34 @@ /// /// The hydraulic boundary database that the belongs to. /// The hydraulic boundary data that the belongs to. + /// The assessment section that the belongs to. /// Thrown when any input parameter is null. - public HydraulicBoundaryDatabaseContext(HydraulicBoundaryDatabase wrappedData, HydraulicBoundaryData hydraulicBoundaryData) + public HydraulicBoundaryDatabaseContext(HydraulicBoundaryDatabase wrappedData, HydraulicBoundaryData hydraulicBoundaryData, + AssessmentSection assessmentSection) : base(wrappedData) { if (hydraulicBoundaryData == null) { throw new ArgumentNullException(nameof(hydraulicBoundaryData)); } + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + HydraulicBoundaryData = hydraulicBoundaryData; + AssessmentSection = assessmentSection; } /// /// Gets the hydraulic boundary data that the context belongs to. /// public HydraulicBoundaryData HydraulicBoundaryData { get; } + + /// + /// Gets the assessment section that the context belongs to. + /// + public AssessmentSection AssessmentSection { get; } } } \ No newline at end of file Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs =================================================================== diff -u -rf51811e1b57d294a8416a7f774fd17075174f41e -rc7dbd30a5f6b57cad128d5f5d6cd076eefc50c12 --- Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision f51811e1b57d294a8416a7f774fd17075174f41e) +++ Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision c7dbd30a5f6b57cad128d5f5d6cd076eefc50c12) @@ -2502,7 +2502,8 @@ { return nodeData.WrappedData.HydraulicBoundaryDatabases .Select(hydraulicBoundaryDatabase => new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabase, - nodeData.WrappedData)) + nodeData.WrappedData, + nodeData.AssessmentSection)) .Cast() .ToArray(); } Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs =================================================================== diff -u -r6039c7413267b75578dd7df2c1b57e51a5bd44bd -rc7dbd30a5f6b57cad128d5f5d6cd076eefc50c12 --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs (.../HydraulicBoundaryDatabaseContextTest.cs) (revision 6039c7413267b75578dd7df2c1b57e51a5bd44bd) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs (.../HydraulicBoundaryDatabaseContextTest.cs) (revision c7dbd30a5f6b57cad128d5f5d6cd076eefc50c12) @@ -22,7 +22,9 @@ using System; using Core.Common.Controls.PresentationObjects; using NUnit.Framework; +using Riskeer.Common.Data.AssessmentSection; using Riskeer.Common.Data.Hydraulics; +using Riskeer.Integration.Data; using Riskeer.Integration.Forms.PresentationObjects; namespace Riskeer.Integration.Forms.Test.PresentationObjects @@ -34,27 +36,43 @@ public void Constructor_ExpectedValues() { // Setup - var hydraulicBoundaryData = new HydraulicBoundaryData(); var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + var hydraulicBoundaryData = new HydraulicBoundaryData(); + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); // Call - var context = new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabase, hydraulicBoundaryData); + var context = new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabase, hydraulicBoundaryData, assessmentSection); // Assert Assert.IsInstanceOf>(context); Assert.AreSame(hydraulicBoundaryDatabase, context.WrappedData); Assert.AreSame(hydraulicBoundaryData, context.HydraulicBoundaryData); + Assert.AreSame(assessmentSection, context.AssessmentSection); } [Test] public void Constructor_HydraulicBoundaryDataNull_ThrowsArgumentNullException() { + // Setup + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); + // Call - void Call() => new HydraulicBoundaryDatabaseContext(new HydraulicBoundaryDatabase(), null); + void Call() => new HydraulicBoundaryDatabaseContext(new HydraulicBoundaryDatabase(), null, assessmentSection); // Assert var exception = Assert.Throws(Call); Assert.AreEqual("hydraulicBoundaryData", exception.ParamName); } + + [Test] + public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() + { + // Call + void Call() => new HydraulicBoundaryDatabaseContext(new HydraulicBoundaryDatabase(), new HydraulicBoundaryData(), null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("assessmentSection", exception.ParamName); + } } } \ No newline at end of file Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/PropertyInfos/HydraulicBoundaryDatabasePropertyInfo.cs =================================================================== diff -u -rb5cdbed2bee3f01132c90e80ec3986d00ec23507 -rc7dbd30a5f6b57cad128d5f5d6cd076eefc50c12 --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/PropertyInfos/HydraulicBoundaryDatabasePropertyInfo.cs (.../HydraulicBoundaryDatabasePropertyInfo.cs) (revision b5cdbed2bee3f01132c90e80ec3986d00ec23507) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/PropertyInfos/HydraulicBoundaryDatabasePropertyInfo.cs (.../HydraulicBoundaryDatabasePropertyInfo.cs) (revision c7dbd30a5f6b57cad128d5f5d6cd076eefc50c12) @@ -23,7 +23,9 @@ using Core.Gui.Plugin; using Core.Gui.PropertyBag; using NUnit.Framework; +using Riskeer.Common.Data.AssessmentSection; using Riskeer.Common.Data.Hydraulics; +using Riskeer.Integration.Data; using Riskeer.Integration.Forms.PresentationObjects; using Riskeer.Integration.Forms.PropertyClasses; @@ -60,7 +62,8 @@ { // Setup var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); - var context = new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabase, new HydraulicBoundaryData()); + var context = new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabase, new HydraulicBoundaryData(), + new AssessmentSection(AssessmentSectionComposition.Dike)); // Call IObjectProperties objectProperties = info.CreateInstance(context); Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs =================================================================== diff -u -r0cb4daf2c493ca235a7f87b22f986ca8574e9ed3 -rc7dbd30a5f6b57cad128d5f5d6cd076eefc50c12 --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs) (revision 0cb4daf2c493ca235a7f87b22f986ca8574e9ed3) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs) (revision c7dbd30a5f6b57cad128d5f5d6cd076eefc50c12) @@ -31,8 +31,10 @@ using NUnit.Extensions.Forms; using NUnit.Framework; using Rhino.Mocks; +using Riskeer.Common.Data.AssessmentSection; using Riskeer.Common.Data.Hydraulics; using Riskeer.Common.Plugin.TestUtil; +using Riskeer.Integration.Data; using Riskeer.Integration.Forms.PresentationObjects; using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources; @@ -79,10 +81,13 @@ // Setup const string fileName = "hrdFile.sqlite"; - var context = new HydraulicBoundaryDatabaseContext(new HydraulicBoundaryDatabase - { - FilePath = $@"path\to\{fileName}" - }, new HydraulicBoundaryData()); + var context = new HydraulicBoundaryDatabaseContext( + new HydraulicBoundaryDatabase + { + FilePath = $@"path\to\{fileName}" + }, + new HydraulicBoundaryData(), + new AssessmentSection(AssessmentSectionComposition.Dike)); using (var plugin = new RiskeerPlugin()) { @@ -226,7 +231,8 @@ mockRepository.ReplayAll(); - var context = new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabase2, hydraulicBoundaryData); + var context = new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabase2, hydraulicBoundaryData, + new AssessmentSection(AssessmentSectionComposition.Dike)); using (var plugin = new RiskeerPlugin()) { Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/HydraulicBoundaryDatabasesContextTreeNodeInfoTest.cs =================================================================== diff -u -rcac722da9ba87a46434b4e5576276e595a898d93 -rc7dbd30a5f6b57cad128d5f5d6cd076eefc50c12 --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/HydraulicBoundaryDatabasesContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabasesContextTreeNodeInfoTest.cs) (revision cac722da9ba87a46434b4e5576276e595a898d93) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/HydraulicBoundaryDatabasesContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabasesContextTreeNodeInfoTest.cs) (revision c7dbd30a5f6b57cad128d5f5d6cd076eefc50c12) @@ -236,9 +236,11 @@ var hydraulicBoundaryDatabaseContext1 = (HydraulicBoundaryDatabaseContext) objects[0]; Assert.AreSame(hydraulicBoundaryDatabase1, hydraulicBoundaryDatabaseContext1.WrappedData); Assert.AreSame(assessmentSection.HydraulicBoundaryData, hydraulicBoundaryDatabaseContext1.HydraulicBoundaryData); + Assert.AreSame(assessmentSection, hydraulicBoundaryDatabaseContext1.AssessmentSection); var hydraulicBoundaryDatabaseContext2 = (HydraulicBoundaryDatabaseContext) objects[1]; Assert.AreSame(assessmentSection.HydraulicBoundaryData, hydraulicBoundaryDatabaseContext2.HydraulicBoundaryData); + Assert.AreSame(assessmentSection, hydraulicBoundaryDatabaseContext2.AssessmentSection); } }