Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresInputContextPropertiesTest.cs =================================================================== diff -u -r3dba5efb1341e8aaba0de9848669b1c7e45cdfda -r6f508b75b217be46357cbf83fca6d488b35c8b51 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresInputContextPropertiesTest.cs (.../ClosingStructuresInputContextPropertiesTest.cs) (revision 3dba5efb1341e8aaba0de9848669b1c7e45cdfda) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresInputContextPropertiesTest.cs (.../ClosingStructuresInputContextPropertiesTest.cs) (revision 6f508b75b217be46357cbf83fca6d488b35c8b51) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Collections.Generic; using System.ComponentModel; using System.Globalization; using System.Linq; @@ -37,6 +38,7 @@ using Ringtoets.ClosingStructures.Forms.PropertyClasses; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Structures; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Helpers; @@ -665,6 +667,38 @@ mockRepository.VerifyAll(); } + [Test] + public void SetStructure_StructureInSection_UpdateSectionResults() + { + // Setup + var assessmentSectionStub = mockRepository.Stub(); + mockRepository.ReplayAll(); + + var failureMechanism = new ClosingStructuresFailureMechanism(); + var calculation = new StructuresCalculation(); + var inputContext = new ClosingStructuresInputContext(calculation.InputParameters, + calculation, + failureMechanism, + assessmentSectionStub); + var properties = new ClosingStructuresInputContextProperties + { + Data = inputContext + }; + + failureMechanism.AddSection(new FailureMechanismSection("Section", new List + { + new Point2D(-10.0, -10.0), + new Point2D(10.0, 10.0) + })); + + // Call + properties.Structure = new TestClosingStructure(); + + // Assert + Assert.AreSame(calculation, failureMechanism.SectionResults.ElementAt(0).Calculation); + mockRepository.VerifyAll(); + } + private static ForeshoreProfile CreateForeshoreProfile() { return new ForeshoreProfile(new Point2D(0, 0), Enumerable.Empty(), new BreakWater(BreakWaterType.Caisson, 0), new ForeshoreProfile.ConstructionProperties()); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs =================================================================== diff -u -rf31183a0e18731b0b2ef9487c7f7a09713c4c5ef -r6f508b75b217be46357cbf83fca6d488b35c8b51 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs (.../HeightStructuresInputContextPropertiesTest.cs) (revision f31183a0e18731b0b2ef9487c7f7a09713c4c5ef) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs (.../HeightStructuresInputContextPropertiesTest.cs) (revision 6f508b75b217be46357cbf83fca6d488b35c8b51) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Collections.Generic; using System.ComponentModel; using System.Linq; using Application.Ringtoets.Storage.TestUtil; @@ -31,6 +32,7 @@ using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Structures; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.PropertyClasses; @@ -209,6 +211,38 @@ } [Test] + public void SetStructure_StructureInSection_UpdateSectionResults() + { + // Setup + var assessmentSectionStub = mockRepository.Stub(); + mockRepository.ReplayAll(); + + var failureMechanism = new HeightStructuresFailureMechanism(); + var calculation = new StructuresCalculation(); + var inputContext = new HeightStructuresInputContext(calculation.InputParameters, + calculation, + failureMechanism, + assessmentSectionStub); + var properties = new HeightStructuresInputContextProperties + { + Data = inputContext + }; + + failureMechanism.AddSection(new FailureMechanismSection("Section", new List + { + new Point2D(-10.0, -10.0), + new Point2D(10.0, 10.0) + })); + + // Call + properties.Structure = new TestHeightStructure(); + + // Assert + Assert.AreSame(calculation, failureMechanism.SectionResults.ElementAt(0).Calculation); + mockRepository.VerifyAll(); + } + + [Test] public void PropertyAttributes_ReturnExpectedValues() { // Setup