Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs =================================================================== diff -u -r5c66b4dea20f2aa7bc89e67bb124232d060f1477 -re7e455ded8ce63d7d6694009d2b6d71d6e233bdf --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision 5c66b4dea20f2aa7bc89e67bb124232d060f1477) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision e7e455ded8ce63d7d6694009d2b6d71d6e233bdf) @@ -73,7 +73,8 @@ { CreateInstance = context => new StabilityStoneCoverWaveConditionsInputContextProperties( context, - () => context.AssessmentSection.GetNormativeAssessmentLevel(context.Calculation.InputParameters.HydraulicBoundaryLocation), + () => context.AssessmentSection.GetAssessmentLevel(context.Calculation.InputParameters.HydraulicBoundaryLocation, + context.Calculation.InputParameters.CategoryType), new ObservablePropertyChangeHandler(context.Calculation, context.WrappedData)) }; } Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/PropertyInfos/StabilityStoneCoverWaveConditionsInputContextPropertyInfoTest.cs =================================================================== diff -u -r6f33b44599df032ecae3342b0aacd606a9e87c1f -re7e455ded8ce63d7d6694009d2b6d71d6e233bdf --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/PropertyInfos/StabilityStoneCoverWaveConditionsInputContextPropertyInfoTest.cs (.../StabilityStoneCoverWaveConditionsInputContextPropertyInfoTest.cs) (revision 6f33b44599df032ecae3342b0aacd606a9e87c1f) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/PropertyInfos/StabilityStoneCoverWaveConditionsInputContextPropertyInfoTest.cs (.../StabilityStoneCoverWaveConditionsInputContextPropertyInfoTest.cs) (revision e7e455ded8ce63d7d6694009d2b6d71d6e233bdf) @@ -19,12 +19,15 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.Collections; using System.Linq; +using Core.Common.Base.Data; using Core.Common.Gui.Plugin; using Core.Common.Gui.PropertyBag; using NUnit.Framework; -using Ringtoets.Common.Data.Contribution; +using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.Common.Data.Hydraulics; using Ringtoets.Common.Data.TestUtil; using Ringtoets.StabilityStoneCover.Data; using Ringtoets.StabilityStoneCover.Forms.PresentationObjects; @@ -51,23 +54,20 @@ } [Test] - public void CreateInstance_WithContextAndNormTypeSignaling_ExpectedProperties() + [TestCaseSource(nameof(DifferentCategoryTypes))] + public void CreateInstance_WithContextThatHasInputWithSpecificCategoryType_ExpectedProperties( + IAssessmentSection assessmentSection, + HydraulicBoundaryLocation hydraulicBoundaryLocation, + AssessmentSectionCategoryType categoryType, + RoundedDouble expectedAssessmentLevel) { // Setup - var assessmentSection = new AssessmentSectionStub - { - FailureMechanismContribution = - { - NormativeNorm = NormType.Signaling - } - }; - - var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); var calculation = new StabilityStoneCoverWaveConditionsCalculation { InputParameters = { - HydraulicBoundaryLocation = hydraulicBoundaryLocation + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + CategoryType = categoryType } }; @@ -76,11 +76,6 @@ assessmentSection, new ForeshoreProfile[0]); - assessmentSection.SetHydraulicBoundaryLocationCalculations(new[] - { - hydraulicBoundaryLocation - }, true); - using (var plugin = new StabilityStoneCoverPlugin()) { PropertyInfo info = GetInfo(plugin); @@ -92,61 +87,52 @@ Assert.IsInstanceOf(objectProperties); Assert.AreSame(context, objectProperties.Data); - double expectedAssessmentLevel = assessmentSection.WaterLevelCalculationsForSignalingNorm.ElementAt(0).Output.Result; Assert.AreEqual(expectedAssessmentLevel, ((StabilityStoneCoverWaveConditionsInputContextProperties) objectProperties).AssessmentLevel); } } - [Test] - public void CreateInstance_WithContextAndNormTypeLowerLimit_ExpectedProperties() + private static PropertyInfo GetInfo(StabilityStoneCoverPlugin plugin) { - // Setup - var assessmentSection = new AssessmentSectionStub - { - FailureMechanismContribution = - { - NormativeNorm = NormType.LowerLimit - } - }; + return plugin.GetPropertyInfos().First(pi => pi.DataType == typeof(StabilityStoneCoverWaveConditionsInputContext)); + } + private static IEnumerable DifferentCategoryTypes() + { + var assessmentSection = new AssessmentSectionStub(); var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); - var calculation = new StabilityStoneCoverWaveConditionsCalculation - { - InputParameters = - { - HydraulicBoundaryLocation = hydraulicBoundaryLocation - } - }; - var context = new StabilityStoneCoverWaveConditionsInputContext(calculation.InputParameters, - calculation, - assessmentSection, - new ForeshoreProfile[0]); - assessmentSection.SetHydraulicBoundaryLocationCalculations(new[] { hydraulicBoundaryLocation }, true); - using (var plugin = new StabilityStoneCoverPlugin()) - { - PropertyInfo info = GetInfo(plugin); + yield return new TestCaseData( + assessmentSection, + hydraulicBoundaryLocation, + AssessmentSectionCategoryType.FactorizedSignalingNorm, + assessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm.ElementAt(0).Output.Result + ).SetName("FactorizedSignalingNorm"); - // Call - IObjectProperties objectProperties = info.CreateInstance(context); + yield return new TestCaseData( + assessmentSection, + hydraulicBoundaryLocation, + AssessmentSectionCategoryType.SignalingNorm, + assessmentSection.WaterLevelCalculationsForSignalingNorm.ElementAt(0).Output.Result + ).SetName("SignalingNorm"); - // Assert - Assert.IsInstanceOf(objectProperties); - Assert.AreSame(context, objectProperties.Data); + yield return new TestCaseData( + assessmentSection, + hydraulicBoundaryLocation, + AssessmentSectionCategoryType.LowerLimitNorm, + assessmentSection.WaterLevelCalculationsForLowerLimitNorm.ElementAt(0).Output.Result + ).SetName("LowerLimitNorm"); - double expectedAssessmentLevel = assessmentSection.WaterLevelCalculationsForLowerLimitNorm.ElementAt(0).Output.Result; - Assert.AreEqual(expectedAssessmentLevel, ((StabilityStoneCoverWaveConditionsInputContextProperties) objectProperties).AssessmentLevel); - } + yield return new TestCaseData( + assessmentSection, + hydraulicBoundaryLocation, + AssessmentSectionCategoryType.FactorizedLowerLimitNorm, + assessmentSection.WaterLevelCalculationsForFactorizedLowerLimitNorm.ElementAt(0).Output.Result + ).SetName("FactorizedLowerLimitNorm"); } - - private static PropertyInfo GetInfo(StabilityStoneCoverPlugin plugin) - { - return plugin.GetPropertyInfos().First(pi => pi.DataType == typeof(StabilityStoneCoverWaveConditionsInputContext)); - } } } \ No newline at end of file Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs =================================================================== diff -u -r5c66b4dea20f2aa7bc89e67bb124232d060f1477 -re7e455ded8ce63d7d6694009d2b6d71d6e233bdf --- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs (.../WaveImpactAsphaltCoverPlugin.cs) (revision 5c66b4dea20f2aa7bc89e67bb124232d060f1477) +++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs (.../WaveImpactAsphaltCoverPlugin.cs) (revision e7e455ded8ce63d7d6694009d2b6d71d6e233bdf) @@ -73,7 +73,8 @@ { CreateInstance = context => new WaveImpactAsphaltCoverWaveConditionsInputContextProperties( context, - () => context.AssessmentSection.GetNormativeAssessmentLevel(context.Calculation.InputParameters.HydraulicBoundaryLocation), + () => context.AssessmentSection.GetAssessmentLevel(context.Calculation.InputParameters.HydraulicBoundaryLocation, + context.Calculation.InputParameters.CategoryType), new ObservablePropertyChangeHandler(context.Calculation, context.WrappedData)) }; } Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/PropertyInfos/WaveImpactAsphaltCoverWaveConditionsInputContextPropertyInfoTest.cs =================================================================== diff -u -r6f33b44599df032ecae3342b0aacd606a9e87c1f -re7e455ded8ce63d7d6694009d2b6d71d6e233bdf --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/PropertyInfos/WaveImpactAsphaltCoverWaveConditionsInputContextPropertyInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsInputContextPropertyInfoTest.cs) (revision 6f33b44599df032ecae3342b0aacd606a9e87c1f) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/PropertyInfos/WaveImpactAsphaltCoverWaveConditionsInputContextPropertyInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsInputContextPropertyInfoTest.cs) (revision e7e455ded8ce63d7d6694009d2b6d71d6e233bdf) @@ -19,12 +19,15 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.Collections; using System.Linq; +using Core.Common.Base.Data; using Core.Common.Gui.Plugin; using Core.Common.Gui.PropertyBag; using NUnit.Framework; -using Ringtoets.Common.Data.Contribution; +using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.Common.Data.Hydraulics; using Ringtoets.Common.Data.TestUtil; using Ringtoets.WaveImpactAsphaltCover.Data; using Ringtoets.WaveImpactAsphaltCover.Forms.PresentationObjects; @@ -51,23 +54,20 @@ } [Test] - public void CreateInstance_WithContextAndNormTypeSignaling_ExpectedProperties() + [TestCaseSource(nameof(DifferentCategoryTypes))] + public void CreateInstance_WithContextThatHasInputWithSpecificCategoryType_ExpectedProperties( + IAssessmentSection assessmentSection, + HydraulicBoundaryLocation hydraulicBoundaryLocation, + AssessmentSectionCategoryType categoryType, + RoundedDouble expectedAssessmentLevel) { // Setup - var assessmentSection = new AssessmentSectionStub - { - FailureMechanismContribution = - { - NormativeNorm = NormType.Signaling - } - }; - - var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation { InputParameters = { - HydraulicBoundaryLocation = hydraulicBoundaryLocation + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + CategoryType = categoryType } }; @@ -76,11 +76,6 @@ assessmentSection, new ForeshoreProfile[0]); - assessmentSection.SetHydraulicBoundaryLocationCalculations(new[] - { - hydraulicBoundaryLocation - }, true); - using (var plugin = new WaveImpactAsphaltCoverPlugin()) { PropertyInfo info = GetInfo(plugin); @@ -92,61 +87,52 @@ Assert.IsInstanceOf(objectProperties); Assert.AreSame(context, objectProperties.Data); - double expectedAssessmentLevel = assessmentSection.WaterLevelCalculationsForSignalingNorm.ElementAt(0).Output.Result; Assert.AreEqual(expectedAssessmentLevel, ((WaveImpactAsphaltCoverWaveConditionsInputContextProperties) objectProperties).AssessmentLevel); } } - [Test] - public void CreateInstance_WithContextAndNormTypeLowerLimit_ExpectedProperties() + private static PropertyInfo GetInfo(WaveImpactAsphaltCoverPlugin plugin) { - // Setup - var assessmentSection = new AssessmentSectionStub - { - FailureMechanismContribution = - { - NormativeNorm = NormType.LowerLimit - } - }; + return plugin.GetPropertyInfos().First(pi => pi.DataType == typeof(WaveImpactAsphaltCoverWaveConditionsInputContext)); + } + private static IEnumerable DifferentCategoryTypes() + { + var assessmentSection = new AssessmentSectionStub(); var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); - var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation - { - InputParameters = - { - HydraulicBoundaryLocation = hydraulicBoundaryLocation - } - }; - var context = new WaveImpactAsphaltCoverWaveConditionsInputContext(calculation.InputParameters, - calculation, - assessmentSection, - new ForeshoreProfile[0]); - assessmentSection.SetHydraulicBoundaryLocationCalculations(new[] { hydraulicBoundaryLocation }, true); - using (var plugin = new WaveImpactAsphaltCoverPlugin()) - { - PropertyInfo info = GetInfo(plugin); + yield return new TestCaseData( + assessmentSection, + hydraulicBoundaryLocation, + AssessmentSectionCategoryType.FactorizedSignalingNorm, + assessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm.ElementAt(0).Output.Result + ).SetName("FactorizedSignalingNorm"); - // Call - IObjectProperties objectProperties = info.CreateInstance(context); + yield return new TestCaseData( + assessmentSection, + hydraulicBoundaryLocation, + AssessmentSectionCategoryType.SignalingNorm, + assessmentSection.WaterLevelCalculationsForSignalingNorm.ElementAt(0).Output.Result + ).SetName("SignalingNorm"); - // Assert - Assert.IsInstanceOf(objectProperties); - Assert.AreSame(context, objectProperties.Data); + yield return new TestCaseData( + assessmentSection, + hydraulicBoundaryLocation, + AssessmentSectionCategoryType.LowerLimitNorm, + assessmentSection.WaterLevelCalculationsForLowerLimitNorm.ElementAt(0).Output.Result + ).SetName("LowerLimitNorm"); - double expectedAssessmentLevel = assessmentSection.WaterLevelCalculationsForLowerLimitNorm.ElementAt(0).Output.Result; - Assert.AreEqual(expectedAssessmentLevel, ((WaveImpactAsphaltCoverWaveConditionsInputContextProperties) objectProperties).AssessmentLevel); - } + yield return new TestCaseData( + assessmentSection, + hydraulicBoundaryLocation, + AssessmentSectionCategoryType.FactorizedLowerLimitNorm, + assessmentSection.WaterLevelCalculationsForFactorizedLowerLimitNorm.ElementAt(0).Output.Result + ).SetName("FactorizedLowerLimitNorm"); } - - private static PropertyInfo GetInfo(WaveImpactAsphaltCoverPlugin plugin) - { - return plugin.GetPropertyInfos().First(pi => pi.DataType == typeof(WaveImpactAsphaltCoverWaveConditionsInputContext)); - } } } \ No newline at end of file