Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PropertyInfos/PipingInputContextPropertyInfoTest.cs =================================================================== diff -u -ra5bf4f56dbf07e5cf48d0b874f5d46d7d02f0dba -r6f33b44599df032ecae3342b0aacd606a9e87c1f --- 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 6f33b44599df032ecae3342b0aacd606a9e87c1f) @@ -60,39 +60,70 @@ 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 AssessmentSectionStub + { + 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 assessmentSection = new ObservableTestAssessmentSectionStub + 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 AssessmentSectionStub + { FailureMechanismContribution = { - NormativeNorm = normType + NormativeNorm = NormType.LowerLimit } }; + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); var scenario = new PipingCalculationScenario(new GeneralPipingInput()) { InputParameters = { - HydraulicBoundaryLocation = testHydraulicBoundaryLocation + HydraulicBoundaryLocation = hydraulicBoundaryLocation } }; @@ -102,18 +133,22 @@ scenario, Enumerable.Empty(), Enumerable.Empty(), - failureMechanism, assessmentSection); + 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); } }