Index: Riskeer/Integration/src/Riskeer.Integration.Forms/PresentationObjects/HydraulicBoundaryDatabaseContext.cs =================================================================== diff -u -r6630ee068d7ed26b2bc5767e8184c9cd3f45c9c1 -r6039c7413267b75578dd7df2c1b57e51a5bd44bd --- Riskeer/Integration/src/Riskeer.Integration.Forms/PresentationObjects/HydraulicBoundaryDatabaseContext.cs (.../HydraulicBoundaryDatabaseContext.cs) (revision 6630ee068d7ed26b2bc5767e8184c9cd3f45c9c1) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/PresentationObjects/HydraulicBoundaryDatabaseContext.cs (.../HydraulicBoundaryDatabaseContext.cs) (revision 6039c7413267b75578dd7df2c1b57e51a5bd44bd) @@ -33,9 +33,23 @@ /// /// Creates a new instance of . /// - /// The that the belongs to. - /// Thrown when is null. - public HydraulicBoundaryDatabaseContext(HydraulicBoundaryDatabase wrappedData) - : base(wrappedData) {} + /// The hydraulic boundary database that the belongs to. + /// The hydraulic boundary data that the belongs to. + /// Thrown when any input parameter is null. + public HydraulicBoundaryDatabaseContext(HydraulicBoundaryDatabase wrappedData, HydraulicBoundaryData hydraulicBoundaryData) + : base(wrappedData) + { + if (hydraulicBoundaryData == null) + { + throw new ArgumentNullException(nameof(hydraulicBoundaryData)); + } + + HydraulicBoundaryData = hydraulicBoundaryData; + } + + /// + /// Gets the hydraulic boundary data that the context belongs to. + /// + public HydraulicBoundaryData HydraulicBoundaryData { get; } } } \ No newline at end of file Index: Riskeer/Integration/src/Riskeer.Integration.Forms/PresentationObjects/HydraulicBoundaryDatabasesContext.cs =================================================================== diff -u -redaf679ecb5aedb14cc2034cbb5b8bd566ace830 -r6039c7413267b75578dd7df2c1b57e51a5bd44bd --- Riskeer/Integration/src/Riskeer.Integration.Forms/PresentationObjects/HydraulicBoundaryDatabasesContext.cs (.../HydraulicBoundaryDatabasesContext.cs) (revision edaf679ecb5aedb14cc2034cbb5b8bd566ace830) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/PresentationObjects/HydraulicBoundaryDatabasesContext.cs (.../HydraulicBoundaryDatabasesContext.cs) (revision 6039c7413267b75578dd7df2c1b57e51a5bd44bd) @@ -35,7 +35,7 @@ /// /// Creates a new instance of . /// - /// The that the belongs to. + /// The hydraulic boundary data that the belongs to. /// The assessment section that the belongs to. /// Thrown when any parameter is null. public HydraulicBoundaryDatabasesContext(HydraulicBoundaryData wrappedData, AssessmentSection assessmentSection) Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs =================================================================== diff -u -r43b8f08a4a22b5118fc43e09d39627f75e10031c -r6039c7413267b75578dd7df2c1b57e51a5bd44bd --- Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 43b8f08a4a22b5118fc43e09d39627f75e10031c) +++ Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 6039c7413267b75578dd7df2c1b57e51a5bd44bd) @@ -2477,7 +2477,8 @@ private static object[] HydraulicBoundaryDatabasesContextChildNodeObjects(HydraulicBoundaryDatabasesContext nodeData) { return nodeData.WrappedData.HydraulicBoundaryDatabases - .Select(hydraulicBoundaryDatabase => new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabase)) + .Select(hydraulicBoundaryDatabase => new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabase, + nodeData.WrappedData)) .Cast() .ToArray(); } Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs =================================================================== diff -u -r6630ee068d7ed26b2bc5767e8184c9cd3f45c9c1 -r6039c7413267b75578dd7df2c1b57e51a5bd44bd --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs (.../HydraulicBoundaryDatabaseContextTest.cs) (revision 6630ee068d7ed26b2bc5767e8184c9cd3f45c9c1) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs (.../HydraulicBoundaryDatabaseContextTest.cs) (revision 6039c7413267b75578dd7df2c1b57e51a5bd44bd) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using Core.Common.Controls.PresentationObjects; using NUnit.Framework; using Riskeer.Common.Data.Hydraulics; @@ -33,14 +34,27 @@ public void Constructor_ExpectedValues() { // Setup + var hydraulicBoundaryData = new HydraulicBoundaryData(); var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); // Call - var context = new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabase); + var context = new HydraulicBoundaryDatabaseContext(hydraulicBoundaryDatabase, hydraulicBoundaryData); // Assert Assert.IsInstanceOf>(context); Assert.AreSame(hydraulicBoundaryDatabase, context.WrappedData); + Assert.AreSame(hydraulicBoundaryData, context.HydraulicBoundaryData); } + + [Test] + public void Constructor_HydraulicBoundaryDataNull_ThrowsArgumentNullException() + { + // Call + void Call() => new HydraulicBoundaryDatabaseContext(new HydraulicBoundaryDatabase(), null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("hydraulicBoundaryData", exception.ParamName); + } } } \ No newline at end of file Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs =================================================================== diff -u -r489a49d30e21797749370d72c6a02b5a43bfd8ad -r6039c7413267b75578dd7df2c1b57e51a5bd44bd --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs) (revision 489a49d30e21797749370d72c6a02b5a43bfd8ad) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs) (revision 6039c7413267b75578dd7df2c1b57e51a5bd44bd) @@ -70,15 +70,15 @@ } [Test] - public void Text_WithContext_ReturnsExpectedName() + public void Text_WithValidData_ReturnsExpectedName() { // Setup const string fileName = "hrdFile.sqlite"; var context = new HydraulicBoundaryDatabaseContext(new HydraulicBoundaryDatabase { FilePath = $@"path\to\{fileName}" - }); + }, new HydraulicBoundaryData()); using (var plugin = new RiskeerPlugin()) { Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/HydraulicBoundaryDatabasesContextTreeNodeInfoTest.cs =================================================================== diff -u -r43b8f08a4a22b5118fc43e09d39627f75e10031c -r6039c7413267b75578dd7df2c1b57e51a5bd44bd --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/HydraulicBoundaryDatabasesContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabasesContextTreeNodeInfoTest.cs) (revision 43b8f08a4a22b5118fc43e09d39627f75e10031c) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/HydraulicBoundaryDatabasesContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabasesContextTreeNodeInfoTest.cs) (revision 6039c7413267b75578dd7df2c1b57e51a5bd44bd) @@ -156,7 +156,7 @@ // Setup var mockRepository = new MockRepository(); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - + using (var treeViewControl = new TreeViewControl()) { IGui gui = StubFactory.CreateGuiStub(mockRepository); @@ -186,20 +186,20 @@ mockRepository.VerifyAll(); } - + [Test] public void ContextMenuStrip_ClickOnAddHydraulicBoundaryDatabaseItem_HydraulicBoundaryDatabaseAddedAndObserversNotified() { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); HydraulicBoundaryData hydraulicBoundaryData = assessmentSection.HydraulicBoundaryData; - + hydraulicBoundaryData.HydraulicLocationConfigurationSettings.SetValues("some/path/hlcd.sqlite", "scenarioName", 0, "scope", false, "seaLevel", "riverDischarge", "lakeLevel", "windDirection", "windSpeed", "comment"); - + var context = new HydraulicBoundaryDatabasesContext(hydraulicBoundaryData, assessmentSection); var mockRepository = new MockRepository(); @@ -267,9 +267,10 @@ var hydraulicBoundaryDatabaseContext1 = (HydraulicBoundaryDatabaseContext) objects[0]; Assert.AreSame(hydraulicBoundaryDatabase1, hydraulicBoundaryDatabaseContext1.WrappedData); + Assert.AreSame(assessmentSection.HydraulicBoundaryData, hydraulicBoundaryDatabaseContext1.HydraulicBoundaryData); var hydraulicBoundaryDatabaseContext2 = (HydraulicBoundaryDatabaseContext) objects[1]; - Assert.AreSame(hydraulicBoundaryDatabase2, hydraulicBoundaryDatabaseContext2.WrappedData); + Assert.AreSame(assessmentSection.HydraulicBoundaryData, hydraulicBoundaryDatabaseContext2.HydraulicBoundaryData); } }