Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PropertyInfos/PipingInputContextPropertyInfoTest.cs =================================================================== diff -u -ra5bf4f56dbf07e5cf48d0b874f5d46d7d02f0dba -r268e08df8d649b7e4f24f2f76635357eba8635f3 --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PropertyInfos/PipingInputContextPropertyInfoTest.cs (.../PipingInputContextPropertyInfoTest.cs) (revision a5bf4f56dbf07e5cf48d0b874f5d46d7d02f0dba) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PropertyInfos/PipingInputContextPropertyInfoTest.cs (.../PipingInputContextPropertyInfoTest.cs) (revision 268e08df8d649b7e4f24f2f76635357eba8635f3) @@ -60,39 +60,69 @@ Assert.AreEqual(typeof(PipingInputContextProperties), info.PropertyObjectType); } - [TestCase(NormType.Signaling)] - [TestCase(NormType.LowerLimit)] - public void CreateInstance_WithContext_ExpectedProperties(NormType normType) + [Test] + public void CreateInstance_WithContextAndNormTypeSignaling_ExpectedProperties() { // Setup - const double designWaterLevelSignaling = 1.1; - const double designWaterLevelLowerLimit = 2.2; + var assessmentSection = new ObservableTestAssessmentSectionStub + { + FailureMechanismContribution = + { + NormativeNorm = NormType.Signaling + } + }; - var testHydraulicBoundaryLocation = new TestHydraulicBoundaryLocation + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); + var scenario = new PipingCalculationScenario(new GeneralPipingInput()) { - DesignWaterLevelCalculation2 = + InputParameters = { - Output = new TestHydraulicBoundaryLocationOutput(designWaterLevelSignaling) - }, - DesignWaterLevelCalculation3 = - { - Output = new TestHydraulicBoundaryLocationOutput(designWaterLevelLowerLimit) + HydraulicBoundaryLocation = hydraulicBoundaryLocation } }; + var failureMechanism = new PipingFailureMechanism(); + var context = new PipingInputContext( + scenario.InputParameters, + scenario, + Enumerable.Empty(), + Enumerable.Empty(), + failureMechanism, assessmentSection); + + assessmentSection.SetHydraulicBoundaryLocationCalculations(new[] + { + hydraulicBoundaryLocation + }, true); + + // Call + IObjectProperties objectProperties = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(context, objectProperties.Data); + + double expectedAssessmentLevel = assessmentSection.WaterLevelCalculationsForSignalingNorm.ElementAt(0).Output.Result; + Assert.AreEqual(expectedAssessmentLevel, ((PipingInputContextProperties) objectProperties).AssessmentLevel); + } + + [Test] + public void CreateInstance_WithContextAndNormTypeLowerLimit_ExpectedProperties() + { + // Setup var assessmentSection = new ObservableTestAssessmentSectionStub { FailureMechanismContribution = { - NormativeNorm = normType + NormativeNorm = NormType.LowerLimit } }; + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); var scenario = new PipingCalculationScenario(new GeneralPipingInput()) { InputParameters = { - HydraulicBoundaryLocation = testHydraulicBoundaryLocation + HydraulicBoundaryLocation = hydraulicBoundaryLocation } }; @@ -104,16 +134,19 @@ Enumerable.Empty(), failureMechanism, assessmentSection); + assessmentSection.SetHydraulicBoundaryLocationCalculations(new[] + { + hydraulicBoundaryLocation + }, true); + // Call IObjectProperties objectProperties = info.CreateInstance(context); // Assert Assert.IsInstanceOf(objectProperties); Assert.AreSame(context, objectProperties.Data); - double expectedAssessmentLevel = normType == NormType.Signaling - ? designWaterLevelSignaling - : designWaterLevelLowerLimit; + double expectedAssessmentLevel = assessmentSection.WaterLevelCalculationsForLowerLimitNorm.ElementAt(0).Output.Result; Assert.AreEqual(expectedAssessmentLevel, ((PipingInputContextProperties) objectProperties).AssessmentLevel); } }