Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PropertyClasses/ClosingStructuresInputContextProperties.cs =================================================================== diff -u -rd4e6fdd1b3c4e1f7f39ce1707cb9ae4241ac6e04 -r0c17207d7682c740778dc3e665b5f1dfc70c37dd --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PropertyClasses/ClosingStructuresInputContextProperties.cs (.../ClosingStructuresInputContextProperties.cs) (revision d4e6fdd1b3c4e1f7f39ce1707cb9ae4241ac6e04) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PropertyClasses/ClosingStructuresInputContextProperties.cs (.../ClosingStructuresInputContextProperties.cs) (revision 0c17207d7682c740778dc3e665b5f1dfc70c37dd) @@ -102,27 +102,6 @@ StormDurationPropertyIndex = stormDurationPropertyIndex }, propertyChangeHandler) {} - #region Hydraulic data - - [DynamicVisible] - [PropertyOrder(insideWaterLevelPropertyIndex)] - [TypeConverter(typeof(ExpandableObjectConverter))] - [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_HydraulicData))] - [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_InsideWaterLevel_DisplayName))] - [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_InsideWaterLevel_Description))] - public NormalDistributionProperties InsideWaterLevel - { - get - { - return new NormalDistributionProperties(DistributionPropertiesReadOnly.None, data.WrappedData, this) - { - Data = data.WrappedData.InsideWaterLevel - }; - } - } - - #endregion - [DynamicVisibleValidationMethod] public bool DynamicVisibleValidationMethod(string propertyName) { @@ -185,6 +164,27 @@ data.FailureMechanism.Calculations.Cast>()); } + #region Hydraulic data + + [DynamicVisible] + [PropertyOrder(insideWaterLevelPropertyIndex)] + [TypeConverter(typeof(ExpandableObjectConverter))] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_HydraulicData))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_InsideWaterLevel_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_InsideWaterLevel_Description))] + public NormalDistributionProperties InsideWaterLevel + { + get + { + return new NormalDistributionProperties(DistributionPropertiesReadOnly.None, data.WrappedData, this) + { + Data = data.WrappedData.InsideWaterLevel + }; + } + } + + #endregion + #region Model factors [DynamicVisible] @@ -202,14 +202,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_ModelSettings))] [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_DrainCoefficient_DisplayName))] [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_DrainCoefficient_Description))] - public NormalDistributionProperties DrainCoefficient + public ConfirmingNormalDistributionProperties DrainCoefficient { get { - return new NormalDistributionProperties(DistributionPropertiesReadOnly.StandardDeviation, data.WrappedData, this) - { - Data = data.WrappedData.DrainCoefficient - }; + return new ConfirmingNormalDistributionProperties( + DistributionPropertiesReadOnly.StandardDeviation, + data.WrappedData.DrainCoefficient, + data.Calculation, + data.WrappedData, + PropertyChangeHandler); } } @@ -280,14 +282,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_ThresholdHeightOpenWeir_DisplayName))] [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_ThresholdHeightOpenWeir_Description))] - public NormalDistributionProperties ThresholdHeightOpenWeir + public ConfirmingNormalDistributionProperties ThresholdHeightOpenWeir { get { - return new NormalDistributionProperties(DistributionPropertiesReadOnly.None, data.WrappedData, this) - { - Data = data.WrappedData.ThresholdHeightOpenWeir - }; + return new ConfirmingNormalDistributionProperties( + DistributionPropertiesReadOnly.None, + data.WrappedData.ThresholdHeightOpenWeir, + data.Calculation, + data.WrappedData, + PropertyChangeHandler); } } @@ -297,14 +301,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_AreaFlowApertures_DisplayName))] [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_AreaFlowApertures_Description))] - public LogNormalDistributionProperties AreaFlowApertures + public ConfirmingLogNormalDistributionProperties AreaFlowApertures { get { - return new LogNormalDistributionProperties(DistributionPropertiesReadOnly.None, data.WrappedData, this) - { - Data = data.WrappedData.AreaFlowApertures - }; + return new ConfirmingLogNormalDistributionProperties( + DistributionPropertiesReadOnly.None, + data.WrappedData.AreaFlowApertures, + data.Calculation, + data.WrappedData, + PropertyChangeHandler); } } @@ -375,14 +381,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.LevelCrestStructureNotClosing_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.LevelCrestStructureNotClosing_Description))] - public NormalDistributionProperties LevelCrestStructureNotClosing + public ConfirmingNormalDistributionProperties LevelCrestStructureNotClosing { get { - return new NormalDistributionProperties(DistributionPropertiesReadOnly.None, data.WrappedData, this) - { - Data = data.WrappedData.LevelCrestStructureNotClosing - }; + return new ConfirmingNormalDistributionProperties( + DistributionPropertiesReadOnly.None, + data.WrappedData.LevelCrestStructureNotClosing, + data.Calculation, + data.WrappedData, + PropertyChangeHandler); } } Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresInputContextPropertiesTest.cs =================================================================== diff -u -r242268fc2adc055cc3ac4f28b14b4db26251b30e -r0c17207d7682c740778dc3e665b5f1dfc70c37dd --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresInputContextPropertiesTest.cs (.../ClosingStructuresInputContextPropertiesTest.cs) (revision 242268fc2adc055cc3ac4f28b14b4db26251b30e) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresInputContextPropertiesTest.cs (.../ClosingStructuresInputContextPropertiesTest.cs) (revision 0c17207d7682c740778dc3e665b5f1dfc70c37dd) @@ -29,16 +29,15 @@ using Core.Common.Base.Geometry; using Core.Common.Gui.PropertyBag; using Core.Common.TestUtil; -using Core.Common.Utils.Reflection; using NUnit.Framework; using Rhino.Mocks; using Ringtoets.ClosingStructures.Data; using Ringtoets.ClosingStructures.Data.TestUtil; using Ringtoets.ClosingStructures.Forms.PresentationObjects; using Ringtoets.ClosingStructures.Forms.PropertyClasses; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.FailureMechanism; -using Ringtoets.Common.Data.Probability; using Ringtoets.Common.Data.Structures; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Helpers; @@ -134,9 +133,9 @@ Assert.AreSame(inputContext, properties.Data); ClosingStructuresInput input = calculation.InputParameters; - var expectedProbabilityOrFrequencyOpenStructureBeforeFlooding = ProbabilityFormattingHelper.Format(input.ProbabilityOrFrequencyOpenStructureBeforeFlooding); - var expectedFailureProbabilityOpenStructure = ProbabilityFormattingHelper.Format(input.FailureProbabilityOpenStructure); - var expectedFailureProbabilityReparation = ProbabilityFormattingHelper.Format(input.FailureProbabilityReparation); + string expectedProbabilityOrFrequencyOpenStructureBeforeFlooding = ProbabilityFormattingHelper.Format(input.ProbabilityOrFrequencyOpenStructureBeforeFlooding); + string expectedFailureProbabilityOpenStructure = ProbabilityFormattingHelper.Format(input.FailureProbabilityOpenStructure); + string expectedFailureProbabilityReparation = ProbabilityFormattingHelper.Format(input.FailureProbabilityReparation); Assert.AreSame(input.ModelFactorSuperCriticalFlow, properties.ModelFactorSuperCriticalFlow.Data); Assert.AreEqual(input.StructureNormalOrientation, properties.StructureNormalOrientation); @@ -185,9 +184,9 @@ var dynamicPropertyBag = new DynamicPropertyBag(properties); PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(new Attribute[] - { - new BrowsableAttribute(true) - }); + { + new BrowsableAttribute(true) + }); Assert.AreEqual(22, dynamicProperties.Count); PropertyDescriptor inflowModelTypeProperty = dynamicProperties[verticalWallInflowModelTypePropertyIndex]; @@ -283,9 +282,9 @@ var dynamicPropertyBag = new DynamicPropertyBag(properties); PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(new Attribute[] - { - new BrowsableAttribute(true) - }); + { + new BrowsableAttribute(true) + }); Assert.AreEqual(21, dynamicProperties.Count); PropertyDescriptor insideWaterLevelProperty = dynamicProperties[floodedCulvertInsideWaterLevelPropertyIndex]; @@ -390,9 +389,9 @@ var dynamicPropertyBag = new DynamicPropertyBag(properties); PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(new Attribute[] - { - new BrowsableAttribute(true) - }); + { + new BrowsableAttribute(true) + }); Assert.AreEqual(22, dynamicProperties.Count); PropertyDescriptor insideWaterLevelProperty = dynamicProperties[lowSillInsideWaterLevelPropertyIndex]; @@ -485,7 +484,7 @@ var properties = new ClosingStructuresInputContextProperties(inputContext, handler); // Call - var availableForeshoreProfiles = properties.GetAvailableForeshoreProfiles(); + IEnumerable availableForeshoreProfiles = properties.GetAvailableForeshoreProfiles(); // Assert Assert.AreSame(failureMechanism.ForeshoreProfiles, availableForeshoreProfiles); @@ -515,13 +514,13 @@ var properties = new ClosingStructuresInputContextProperties(inputContext, handler); // Call - var availableStructures = properties.GetAvailableStructures(); + IEnumerable availableStructures = properties.GetAvailableStructures(); // Assert Assert.AreSame(failureMechanism.ClosingStructures, availableStructures); mockRepository.VerifyAll(); } - + [Test] public void FactorStormDurationOpenStructure_Always_InputChangedAndObsevablesNotified() { @@ -577,6 +576,60 @@ } [Test] + public void ModelFactorSuperCriticalFlow_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.ModelFactorSuperCriticalFlow.Mean = newMean, + newMean); + } + + [Test] + public void WidthFlowApertures_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.WidthFlowApertures.Mean = newMean, + newMean); + } + + [Test] + public void ThresholdHeightOpenWeir_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.ThresholdHeightOpenWeir.Mean = newMean, + newMean); + } + + [Test] + public void AreaFlowApertures_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.AreaFlowApertures.Mean = newMean, + newMean); + } + + [Test] + public void DrainCoefficient_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.DrainCoefficient.Mean = newMean, + newMean); + } + + [Test] + public void LevelCrestStructureNotClosing_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.LevelCrestStructureNotClosing.Mean = newMean, + newMean); + } + + [Test] [TestCase(double.MinValue)] [TestCase(double.MaxValue)] public void ProbabilityOrFrequencyOpenStructureBeforeFlooding_InvalidDoubleValues_ThrowsArgumentException(double newValue) @@ -742,7 +795,6 @@ Enumerable.Empty()); var properties = new ClosingStructuresInputContextProperties(inputContext, handler); - // Call TestDelegate call = () => properties.FailureProbabilityOpenStructure = newProbabilityString; @@ -846,7 +898,6 @@ Enumerable.Empty()); var properties = new ClosingStructuresInputContextProperties(inputContext, handler); - // Call TestDelegate call = () => properties.FailureProbabilityReparation = newProbabilityString; @@ -1094,6 +1145,44 @@ Assert.IsTrue(properties.DynamicVisibleValidationMethod(null)); } + private void SetPropertyAndVerifyNotifcationsAndOutput( + Action setProperty, + TPropertyValue expectedValueSet) + { + // Setup + var observable = mockRepository.StrictMock(); + observable.Expect(o => o.NotifyObservers()); + mockRepository.ReplayAll(); + + var failureMechanism = new ClosingStructuresFailureMechanism(); + var calculation = new StructuresCalculation(); + ClosingStructuresInput input = calculation.InputParameters; + input.ForeshoreProfile = new TestForeshoreProfile(); + + var customHandler = new CalculationInputSetPropertyValueAfterConfirmationParameterTester( + input, + calculation, + expectedValueSet, + new[] + { + observable + }); + + var inputContext = new ClosingStructuresInputContext(input, + calculation, + failureMechanism, + assessmentSection); + var properties = new ClosingStructuresInputContextProperties(inputContext, customHandler); + + // Call + setProperty(properties); + + // Assert + Assert.IsFalse(calculation.HasOutput); + + mockRepository.VerifyAll(); + } + #region Property indices #region VerticalWall structures indices @@ -1177,43 +1266,5 @@ #endregion #endregion - - private void SetPropertyAndVerifyNotifcationsAndOutput( - Action setProperty, - TPropertyValue expectedValueSet) - { - // Setup - var observable = mockRepository.StrictMock(); - observable.Expect(o => o.NotifyObservers()); - mockRepository.ReplayAll(); - - var failureMechanism = new ClosingStructuresFailureMechanism(); - var calculation = new StructuresCalculation(); - ClosingStructuresInput input = calculation.InputParameters; - input.ForeshoreProfile = new TestForeshoreProfile(); - - var customHandler = new CalculationInputSetPropertyValueAfterConfirmationParameterTester( - input, - calculation, - expectedValueSet, - new[] - { - observable - }); - - var inputContext = new ClosingStructuresInputContext(input, - calculation, - failureMechanism, - assessmentSection); - var properties = new ClosingStructuresInputContextProperties(inputContext, customHandler); - - // Call - setProperty(properties); - - // Assert - Assert.IsFalse(calculation.HasOutput); - - mockRepository.VerifyAll(); - } } } \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/ConfirmingVariationCoefficientNormalDistributionProperties.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/ConfirmingVariationCoefficientNormalDistributionProperties.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/ConfirmingVariationCoefficientNormalDistributionProperties.cs (revision 0c17207d7682c740778dc3e665b5f1dfc70c37dd) @@ -0,0 +1,92 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Base.Data; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.Common.Forms.Properties; + +namespace Ringtoets.Common.Forms.PropertyClasses +{ + /// + /// An implementation for . + /// + public class ConfirmingVariationCoefficientNormalDistributionProperties + : ConfirmingVariationCoefficientDistributionPropertiesBase + where TCalculationInput : ICalculationInput + { + /// + /// Creates a new instance of . + /// + /// Indicates which properties, if any, should be + /// marked as read-only. + /// The to create the properties for. + /// The calculation the belongs to. + /// The calculation input the belongs to. + /// Optional handler that is used to handle property changes. + /// Thrown when is null + /// or when any number of properties in this class is editable and any other parameter is null. + public ConfirmingVariationCoefficientNormalDistributionProperties( + VariationCoefficientDistributionPropertiesReadOnly propertiesReadOnly, + VariationCoefficientNormalDistribution distribution, + ICalculation calculation, + TCalculationInput calculationInput, + ICalculationInputPropertyChangeHandler handler) + : base(propertiesReadOnly, distribution, calculation, calculationInput, handler) {} + + public override string DistributionType + { + get + { + return Resources.DistributionType_Normal; + } + } + + [ResourcesDescription(typeof(Resources), nameof(Resources.NormalDistribution_Mean_Description))] + public override RoundedDouble Mean + { + get + { + return base.Mean; + } + set + { + base.Mean = value; + } + } + + [ResourcesDescription(typeof(Resources), nameof(Resources.NormalDistribution_VariationCoefficient_Description))] + public override RoundedDouble CoefficientOfVariation + { + get + { + return base.CoefficientOfVariation; + } + set + { + base.CoefficientOfVariation = value; + } + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresInputBaseProperties.cs =================================================================== diff -u -rd4e6fdd1b3c4e1f7f39ce1707cb9ae4241ac6e04 -r0c17207d7682c740778dc3e665b5f1dfc70c37dd --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresInputBaseProperties.cs (.../StructuresInputBaseProperties.cs) (revision d4e6fdd1b3c4e1f7f39ce1707cb9ae4241ac6e04) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresInputBaseProperties.cs (.../StructuresInputBaseProperties.cs) (revision 0c17207d7682c740778dc3e665b5f1dfc70c37dd) @@ -59,7 +59,6 @@ where TCalculation : ICalculation where TFailureMechanism : IFailureMechanism { - private readonly ICalculationInputPropertyChangeHandler propertyChangeHandler; private readonly Dictionary propertyIndexLookup; /// @@ -84,7 +83,7 @@ throw new ArgumentNullException(nameof(propertyChangeHandler)); } - this.propertyChangeHandler = propertyChangeHandler; + PropertyChangeHandler = propertyChangeHandler; Data = data; propertyIndexLookup = new Dictionary { @@ -136,6 +135,28 @@ }; } + #region Model factors + + [DynamicPropertyOrder] + [TypeConverter(typeof(ExpandableObjectConverter))] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_ModelSettings))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.Structure_ModelFactorSuperCriticalFlow_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.Structure_ModelFactorSuperCriticalFlow_Description))] + public virtual ConfirmingNormalDistributionProperties ModelFactorSuperCriticalFlow + { + get + { + return new ConfirmingNormalDistributionProperties( + DistributionPropertiesReadOnly.StandardDeviation, + data.WrappedData.ModelFactorSuperCriticalFlow, + data.Calculation, + data.WrappedData, + PropertyChangeHandler); + } + } + + #endregion + [DynamicPropertyOrderEvaluationMethod] public int DynamicPropertyOrderEvaluationMethod(string propertyName) { @@ -163,6 +184,11 @@ } /// + /// The change handler responsible for handling effects of a property change. + /// + protected ICalculationInputPropertyChangeHandler PropertyChangeHandler { get; } + + /// /// Sets a probability value to one of the properties of a wrapped data object. /// /// The probability value to set. @@ -201,7 +227,7 @@ SetCalculationInputPropertyValueDelegate setPropertyValue, TValue value) { - IEnumerable affectedObjects = propertyChangeHandler.SetPropertyValueAfterConfirmation( + IEnumerable affectedObjects = PropertyChangeHandler.SetPropertyValueAfterConfirmation( data.WrappedData, data.Calculation, value, @@ -221,7 +247,7 @@ private void ClearCalculationOutput() { IEnumerable affectedCalculation = RingtoetsCommonDataSynchronizationService.ClearCalculationOutput(data.Calculation); - foreach (var calculation in affectedCalculation) + foreach (IObservable calculation in affectedCalculation) { calculation.NotifyObservers(); } @@ -320,28 +346,6 @@ #endregion } - #region Model factors - - [DynamicPropertyOrder] - [TypeConverter(typeof(ExpandableObjectConverter))] - [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_ModelSettings))] - [ResourcesDisplayName(typeof(Resources), nameof(Resources.Structure_ModelFactorSuperCriticalFlow_DisplayName))] - [ResourcesDescription(typeof(Resources), nameof(Resources.Structure_ModelFactorSuperCriticalFlow_Description))] - public virtual ConfirmingNormalDistributionProperties ModelFactorSuperCriticalFlow - { - get - { - return new ConfirmingNormalDistributionProperties( - DistributionPropertiesReadOnly.StandardDeviation, - data.WrappedData.ModelFactorSuperCriticalFlow, - data.Calculation, - data.WrappedData, - propertyChangeHandler); - } - } - - #endregion - #region Schematization [DynamicPropertyOrder] @@ -358,11 +362,11 @@ set { ChangePropertyAndNotify((input, newValue) => - { - data.WrappedData.Structure = newValue; - AfterSettingStructure(); - }, - value); + { + data.WrappedData.Structure = newValue; + AfterSettingStructure(); + }, + value); } } @@ -410,9 +414,9 @@ return new ConfirmingLogNormalDistributionProperties( DistributionPropertiesReadOnly.None, data.WrappedData.FlowWidthAtBottomProtection, - data.Calculation, - data.WrappedData, - propertyChangeHandler); + data.Calculation, + data.WrappedData, + PropertyChangeHandler); } } @@ -430,7 +434,7 @@ data.WrappedData.WidthFlowApertures, data.Calculation, data.WrappedData, - propertyChangeHandler); + PropertyChangeHandler); } } @@ -448,7 +452,7 @@ data.WrappedData.StorageStructureArea, data.Calculation, data.WrappedData, - propertyChangeHandler); + PropertyChangeHandler); } } @@ -466,7 +470,7 @@ data.WrappedData.AllowedLevelIncreaseStorage, data.Calculation, data.WrappedData, - propertyChangeHandler); + PropertyChangeHandler); } } @@ -484,7 +488,7 @@ data.WrappedData.CriticalOvertoppingDischarge, data.Calculation, data.WrappedData, - propertyChangeHandler); + PropertyChangeHandler); } } @@ -503,8 +507,8 @@ ChangePropertyAndNotify( (input, newValue) => SetProbabilityValue( - newValue, - data.WrappedData, + newValue, + data.WrappedData, (wrappedData, parsedValue) => wrappedData.FailureProbabilityStructureWithErosion = parsedValue) , value); } @@ -539,7 +543,7 @@ { return data.WrappedData.ForeshoreProfile == null ? new ConfirmingUseBreakWaterProperties() : - new ConfirmingUseBreakWaterProperties(data.WrappedData, data.Calculation, propertyChangeHandler); + new ConfirmingUseBreakWaterProperties(data.WrappedData, data.Calculation, PropertyChangeHandler); } } @@ -552,7 +556,7 @@ { get { - return new ConfirmingUseForeshoreProperties(data.WrappedData, data.Calculation, propertyChangeHandler); + return new ConfirmingUseForeshoreProperties(data.WrappedData, data.Calculation, PropertyChangeHandler); } } @@ -595,7 +599,7 @@ data.WrappedData.StormDuration, data.Calculation, data.WrappedData, - propertyChangeHandler); + PropertyChangeHandler); } } Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -rd4e6fdd1b3c4e1f7f39ce1707cb9ae4241ac6e04 -r0c17207d7682c740778dc3e665b5f1dfc70c37dd --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision d4e6fdd1b3c4e1f7f39ce1707cb9ae4241ac6e04) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 0c17207d7682c740778dc3e665b5f1dfc70c37dd) @@ -76,6 +76,7 @@ Resources.resx + Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ConfirmingVariationCoefficientLogNormalDistributionPropertiesTest.cs =================================================================== diff -u -rd4e6fdd1b3c4e1f7f39ce1707cb9ae4241ac6e04 -r0c17207d7682c740778dc3e665b5f1dfc70c37dd --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ConfirmingVariationCoefficientLogNormalDistributionPropertiesTest.cs (.../ConfirmingVariationCoefficientLogNormalDistributionPropertiesTest.cs) (revision d4e6fdd1b3c4e1f7f39ce1707cb9ae4241ac6e04) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ConfirmingVariationCoefficientLogNormalDistributionPropertiesTest.cs (.../ConfirmingVariationCoefficientLogNormalDistributionPropertiesTest.cs) (revision 0c17207d7682c740778dc3e665b5f1dfc70c37dd) @@ -77,8 +77,8 @@ "Verwachtingswaarde", "De gemiddelde waarde van de lognormale verdeling."); - PropertyDescriptor standardDeviationProperty = dynamicProperties[2]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(standardDeviationProperty, + PropertyDescriptor variationCoefficientProperty = dynamicProperties[2]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(variationCoefficientProperty, "Misc", "Variatiecoëfficiënt", "De variatiecoëfficiënt van de lognormale verdeling."); Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ConfirmingVariationCoefficientNormalDistributionPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ConfirmingVariationCoefficientNormalDistributionPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ConfirmingVariationCoefficientNormalDistributionPropertiesTest.cs (revision 0c17207d7682c740778dc3e665b5f1dfc70c37dd) @@ -0,0 +1,89 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.ComponentModel; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class ConfirmingVariationCoefficientNormalDistributionPropertiesTest + { + private MockRepository mockRepository; + + [SetUp] + public void SetUp() + { + mockRepository = new MockRepository(); + } + + [Test] + public void Constructor_WithParameters_ExpectedValues() + { + // Setup + var mocks = new MockRepository(); + var calculation = mocks.Stub(); + var input = mocks.Stub(); + var handler = mocks.Stub(); + mockRepository.ReplayAll(); + + var distribution = new VariationCoefficientNormalDistribution(); + + // Call + var properties = new ConfirmingVariationCoefficientNormalDistributionProperties( + VariationCoefficientDistributionPropertiesReadOnly.None, distribution, calculation, input, handler); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.AreSame(distribution, properties.Data); + Assert.AreEqual("Normaal", properties.DistributionType); + + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(3, dynamicProperties.Count); + + PropertyDescriptor distributionTypeProperty = dynamicProperties[0]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(distributionTypeProperty, + "Misc", + "Type verdeling", + "Het soort kansverdeling waarin deze parameter gedefinieerd wordt.", + true); + + PropertyDescriptor meanProperty = dynamicProperties[1]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(meanProperty, + "Misc", + "Verwachtingswaarde", + "De gemiddelde waarde van de normale verdeling."); + + PropertyDescriptor variationCoefficientProperty = dynamicProperties[2]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(variationCoefficientProperty, + "Misc", + "Variatiecoëfficiënt", + "De variatiecoëfficiënt van de normale verdeling."); + + mockRepository.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -rd4e6fdd1b3c4e1f7f39ce1707cb9ae4241ac6e04 -r0c17207d7682c740778dc3e665b5f1dfc70c37dd --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision d4e6fdd1b3c4e1f7f39ce1707cb9ae4241ac6e04) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 0c17207d7682c740778dc3e665b5f1dfc70c37dd) @@ -83,6 +83,7 @@ + Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresInputContextProperties.cs =================================================================== diff -u -r242268fc2adc055cc3ac4f28b14b4db26251b30e -r0c17207d7682c740778dc3e665b5f1dfc70c37dd --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresInputContextProperties.cs (.../HeightStructuresInputContextProperties.cs) (revision 242268fc2adc055cc3ac4f28b14b4db26251b30e) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresInputContextProperties.cs (.../HeightStructuresInputContextProperties.cs) (revision 0c17207d7682c740778dc3e665b5f1dfc70c37dd) @@ -27,7 +27,6 @@ using Core.Common.Utils.Attributes; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.Structures; -using Ringtoets.Common.Forms.ChangeHandlers; using Ringtoets.Common.Forms.PropertyClasses; using Ringtoets.Common.Utils; using Ringtoets.HeightStructures.Data; @@ -95,14 +94,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_LevelCrestStructure_DisplayName))] [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_LevelCrestStructure_Description))] - public NormalDistributionProperties LevelCrestStructure + public ConfirmingNormalDistributionProperties LevelCrestStructure { get { - return new NormalDistributionProperties(DistributionPropertiesReadOnly.None, data.WrappedData, this) - { - Data = data.WrappedData.LevelCrestStructure - }; + return new ConfirmingNormalDistributionProperties( + DistributionPropertiesReadOnly.None, + data.WrappedData.LevelCrestStructure, + data.Calculation, + data.WrappedData, + PropertyChangeHandler); } } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs =================================================================== diff -u -r242268fc2adc055cc3ac4f28b14b4db26251b30e -r0c17207d7682c740778dc3e665b5f1dfc70c37dd --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs (.../HeightStructuresInputContextPropertiesTest.cs) (revision 242268fc2adc055cc3ac4f28b14b4db26251b30e) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs (.../HeightStructuresInputContextPropertiesTest.cs) (revision 0c17207d7682c740778dc3e665b5f1dfc70c37dd) @@ -24,8 +24,10 @@ using System.ComponentModel; using System.Linq; using Core.Common.Base; +using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Common.Gui.PropertyBag; +using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; @@ -286,5 +288,53 @@ Assert.AreSame(calculation, failureMechanism.SectionResults.ElementAt(0).Calculation); mockRepository.VerifyAll(); } + + [Test] + public void LevelCrestStructure_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.LevelCrestStructure.Mean = newMean, + newMean); + } + + private void SetPropertyAndVerifyNotifcationsAndOutput( + Action setProperty, + TPropertyValue expectedValueSet) + { + // Setup + var observable = mockRepository.StrictMock(); + var assessmentSection = mockRepository.StrictMock(); + observable.Expect(o => o.NotifyObservers()); + mockRepository.ReplayAll(); + + var failureMechanism = new HeightStructuresFailureMechanism(); + var calculation = new StructuresCalculation(); + HeightStructuresInput input = calculation.InputParameters; + input.ForeshoreProfile = new TestForeshoreProfile(); + + var customHandler = new CalculationInputSetPropertyValueAfterConfirmationParameterTester( + input, + calculation, + expectedValueSet, + new[] + { + observable + }); + + var inputContext = new HeightStructuresInputContext(input, + calculation, + failureMechanism, + assessmentSection); + var properties = new HeightStructuresInputContextProperties(inputContext, customHandler); + + // Call + setProperty(properties); + + // Assert + Assert.IsFalse(calculation.HasOutput); + + mockRepository.VerifyAll(); + } } } \ No newline at end of file Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/PropertyClasses/StabilityPointStructuresInputContextProperties.cs =================================================================== diff -u -rd4e6fdd1b3c4e1f7f39ce1707cb9ae4241ac6e04 -r0c17207d7682c740778dc3e665b5f1dfc70c37dd --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/PropertyClasses/StabilityPointStructuresInputContextProperties.cs (.../StabilityPointStructuresInputContextProperties.cs) (revision d4e6fdd1b3c4e1f7f39ce1707cb9ae4241ac6e04) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/PropertyClasses/StabilityPointStructuresInputContextProperties.cs (.../StabilityPointStructuresInputContextProperties.cs) (revision 0c17207d7682c740778dc3e665b5f1dfc70c37dd) @@ -206,14 +206,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_HydraulicData))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.Structure_InsideWaterLevelFailureConstruction_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.Structure_InsideWaterLevelFailureConstruction_Description))] - public NormalDistributionProperties InsideWaterLevelFailureConstruction + public ConfirmingNormalDistributionProperties InsideWaterLevelFailureConstruction { get { - return new NormalDistributionProperties(DistributionPropertiesReadOnly.None, data.WrappedData, this) - { - Data = data.WrappedData.InsideWaterLevelFailureConstruction - }; + return new ConfirmingNormalDistributionProperties( + DistributionPropertiesReadOnly.None, + data.WrappedData.InsideWaterLevelFailureConstruction, + data.Calculation, + data.WrappedData, + PropertyChangeHandler); } } @@ -222,14 +224,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_HydraulicData))] [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_InsideWaterLevel_DisplayName))] [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_InsideWaterLevel_Description))] - public NormalDistributionProperties InsideWaterLevel + public ConfirmingNormalDistributionProperties InsideWaterLevel { get { - return new NormalDistributionProperties(DistributionPropertiesReadOnly.None, data.WrappedData, this) - { - Data = data.WrappedData.InsideWaterLevel - }; + return new ConfirmingNormalDistributionProperties( + DistributionPropertiesReadOnly.None, + data.WrappedData.InsideWaterLevel, + data.Calculation, + data.WrappedData, + PropertyChangeHandler); } } @@ -252,14 +256,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_ModelSettings))] [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_DrainCoefficient_DisplayName))] [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_DrainCoefficient_Description))] - public NormalDistributionProperties DrainCoefficient + public ConfirmingNormalDistributionProperties DrainCoefficient { get { - return new NormalDistributionProperties(DistributionPropertiesReadOnly.StandardDeviation, data.WrappedData, this) - { - Data = data.WrappedData.DrainCoefficient - }; + return new ConfirmingNormalDistributionProperties( + DistributionPropertiesReadOnly.StandardDeviation, + data.WrappedData.DrainCoefficient, + data.Calculation, + data.WrappedData, + PropertyChangeHandler); } } @@ -334,14 +340,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_LevelCrestStructure_DisplayName))] [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_LevelCrestStructure_Description))] - public NormalDistributionProperties LevelCrestStructure + public ConfirmingNormalDistributionProperties LevelCrestStructure { get { - return new NormalDistributionProperties(DistributionPropertiesReadOnly.None, data.WrappedData, this) - { - Data = data.WrappedData.LevelCrestStructure - }; + return new ConfirmingNormalDistributionProperties( + DistributionPropertiesReadOnly.None, + data.WrappedData.LevelCrestStructure, + data.Calculation, + data.WrappedData, + PropertyChangeHandler); } } @@ -350,14 +358,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_ThresholdHeightOpenWeir_DisplayName))] [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_ThresholdHeightOpenWeir_Description))] - public NormalDistributionProperties ThresholdHeightOpenWeir + public ConfirmingNormalDistributionProperties ThresholdHeightOpenWeir { get { - return new NormalDistributionProperties(DistributionPropertiesReadOnly.None, data.WrappedData, this) - { - Data = data.WrappedData.ThresholdHeightOpenWeir - }; + return new ConfirmingNormalDistributionProperties( + DistributionPropertiesReadOnly.None, + data.WrappedData.ThresholdHeightOpenWeir, + data.Calculation, + data.WrappedData, + PropertyChangeHandler); } } @@ -366,15 +376,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_Schematization")] [ResourcesDisplayName(typeof(Resources), "Structure_FlowVelocityStructureClosable_DisplayName")] [ResourcesDescription(typeof(Resources), "Structure_FlowVelocityStructureClosable_Description")] - public VariationCoefficientNormalDistributionProperties FlowVelocityStructureClosable + public ConfirmingVariationCoefficientNormalDistributionProperties FlowVelocityStructureClosable { get { - return new VariationCoefficientNormalDistributionProperties(VariationCoefficientDistributionPropertiesReadOnly.CoefficientOfVariation, - data.WrappedData, this) - { - Data = data.WrappedData.FlowVelocityStructureClosable - }; + return new ConfirmingVariationCoefficientNormalDistributionProperties( + VariationCoefficientDistributionPropertiesReadOnly.CoefficientOfVariation, + data.WrappedData.FlowVelocityStructureClosable, + data.Calculation, + data.WrappedData, + PropertyChangeHandler); } } @@ -384,14 +395,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_AreaFlowApertures_DisplayName))] [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Structure_AreaFlowApertures_Description))] - public LogNormalDistributionProperties AreaFlowApertures + public ConfirmingLogNormalDistributionProperties AreaFlowApertures { get { - return new LogNormalDistributionProperties(DistributionPropertiesReadOnly.None, data.WrappedData, this) - { - Data = data.WrappedData.AreaFlowApertures - }; + return new ConfirmingLogNormalDistributionProperties( + DistributionPropertiesReadOnly.None, + data.WrappedData.AreaFlowApertures, + data.Calculation, + data.WrappedData, + PropertyChangeHandler); } } @@ -401,17 +414,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.Structure_ConstructiveStrengthLinearLoadModel_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.Structure_ConstructiveStrengthLinearLoadModel_Description))] - public VariationCoefficientLogNormalDistributionProperties ConstructiveStrengthLinearLoadModel + public ConfirmingVariationCoefficientLogNormalDistributionProperties ConstructiveStrengthLinearLoadModel { get { - return new VariationCoefficientLogNormalDistributionProperties( + return new ConfirmingVariationCoefficientLogNormalDistributionProperties( VariationCoefficientDistributionPropertiesReadOnly.None, + data.WrappedData.ConstructiveStrengthLinearLoadModel, + data.Calculation, data.WrappedData, - this) - { - Data = data.WrappedData.ConstructiveStrengthLinearLoadModel - }; + PropertyChangeHandler); } } @@ -421,17 +433,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.Structure_ConstructiveStrengthQuadraticLoadModel_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.Structure_ConstructiveStrengthQuadraticLoadModel_Description))] - public VariationCoefficientLogNormalDistributionProperties ConstructiveStrengthQuadraticLoadModel + public ConfirmingVariationCoefficientLogNormalDistributionProperties ConstructiveStrengthQuadraticLoadModel { get { - return new VariationCoefficientLogNormalDistributionProperties( + return new ConfirmingVariationCoefficientLogNormalDistributionProperties( VariationCoefficientDistributionPropertiesReadOnly.None, + data.WrappedData.ConstructiveStrengthQuadraticLoadModel, + data.Calculation, data.WrappedData, - this) - { - Data = data.WrappedData.ConstructiveStrengthQuadraticLoadModel - }; + PropertyChangeHandler); } } @@ -441,17 +452,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.Structure_StabilityLinearLoadModel_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.Structure_StabilityLinearLoadModel_Description))] - public VariationCoefficientLogNormalDistributionProperties StabilityLinearLoadModel + public ConfirmingVariationCoefficientLogNormalDistributionProperties StabilityLinearLoadModel { get { - return new VariationCoefficientLogNormalDistributionProperties( + return new ConfirmingVariationCoefficientLogNormalDistributionProperties( VariationCoefficientDistributionPropertiesReadOnly.None, + data.WrappedData.StabilityLinearLoadModel, + data.Calculation, data.WrappedData, - this) - { - Data = data.WrappedData.StabilityLinearLoadModel - }; + PropertyChangeHandler); } } @@ -461,17 +471,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.Structure_StabilityQuadraticLoadModel_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.Structure_StabilityQuadraticLoadModel_Description))] - public VariationCoefficientLogNormalDistributionProperties StabilityQuadraticLoadModel + public ConfirmingVariationCoefficientLogNormalDistributionProperties StabilityQuadraticLoadModel { get { - return new VariationCoefficientLogNormalDistributionProperties( + return new ConfirmingVariationCoefficientLogNormalDistributionProperties( VariationCoefficientDistributionPropertiesReadOnly.None, + data.WrappedData.StabilityQuadraticLoadModel, + data.Calculation, data.WrappedData, - this) - { - Data = data.WrappedData.StabilityQuadraticLoadModel - }; + PropertyChangeHandler); } } @@ -502,17 +511,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.Structure_FailureCollisionEnergy_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.Structure_FailureCollisionEnergy_Description))] - public VariationCoefficientLogNormalDistributionProperties FailureCollisionEnergy + public ConfirmingVariationCoefficientLogNormalDistributionProperties FailureCollisionEnergy { get { - return new VariationCoefficientLogNormalDistributionProperties( + return new ConfirmingVariationCoefficientLogNormalDistributionProperties( VariationCoefficientDistributionPropertiesReadOnly.None, + data.WrappedData.FailureCollisionEnergy, + data.Calculation, data.WrappedData, - this) - { - Data = data.WrappedData.FailureCollisionEnergy - }; + PropertyChangeHandler); } } @@ -521,17 +529,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.Structure_ShipMass_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.Structure_ShipMass_Description))] - public VariationCoefficientNormalDistributionProperties ShipMass + public ConfirmingVariationCoefficientNormalDistributionProperties ShipMass { get { - return new VariationCoefficientNormalDistributionProperties( + return new ConfirmingVariationCoefficientNormalDistributionProperties( VariationCoefficientDistributionPropertiesReadOnly.None, + data.WrappedData.ShipMass, + data.Calculation, data.WrappedData, - this) - { - Data = data.WrappedData.ShipMass - }; + PropertyChangeHandler); } } @@ -540,17 +547,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.Structure_ShipVelocity_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.Structure_ShipVelocity_Description))] - public VariationCoefficientNormalDistributionProperties ShipVelocity + public ConfirmingVariationCoefficientNormalDistributionProperties ShipVelocity { get { - return new VariationCoefficientNormalDistributionProperties( + return new ConfirmingVariationCoefficientNormalDistributionProperties( VariationCoefficientDistributionPropertiesReadOnly.None, + data.WrappedData.ShipVelocity, + data.Calculation, data.WrappedData, - this) - { - Data = data.WrappedData.ShipVelocity - }; + PropertyChangeHandler); } } @@ -598,14 +604,16 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.Structure_BankWidth_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.Structure_BankWidth_Description))] - public NormalDistributionProperties BankWidth + public ConfirmingNormalDistributionProperties BankWidth { get { - return new NormalDistributionProperties(DistributionPropertiesReadOnly.None, data.WrappedData, this) - { - Data = data.WrappedData.BankWidth - }; + return new ConfirmingNormalDistributionProperties( + DistributionPropertiesReadOnly.None, + data.WrappedData.BankWidth, + data.Calculation, + data.WrappedData, + PropertyChangeHandler); } } Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresInputContextPropertiesTest.cs =================================================================== diff -u -r242268fc2adc055cc3ac4f28b14b4db26251b30e -r0c17207d7682c740778dc3e665b5f1dfc70c37dd --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresInputContextPropertiesTest.cs (.../StabilityPointStructuresInputContextPropertiesTest.cs) (revision 242268fc2adc055cc3ac4f28b14b4db26251b30e) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresInputContextPropertiesTest.cs (.../StabilityPointStructuresInputContextPropertiesTest.cs) (revision 0c17207d7682c740778dc3e665b5f1dfc70c37dd) @@ -36,7 +36,6 @@ using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Structures; using Ringtoets.Common.Data.TestUtil; -using Ringtoets.Common.Forms.ChangeHandlers; using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.PropertyClasses; using Ringtoets.Common.Forms.TestUtil; @@ -1031,6 +1030,159 @@ } [Test] + public void ModelFactorSuperCriticalFlow_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.ModelFactorSuperCriticalFlow.Mean = newMean, + newMean); + } + + [Test] + public void WidthFlowApertures_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.WidthFlowApertures.Mean = newMean, + newMean); + } + + [Test] + public void InsideWaterLevelFailureConstruction_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.InsideWaterLevelFailureConstruction.Mean = newMean, + newMean); + } + + [Test] + public void InsideWaterLevel_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.InsideWaterLevel.Mean = newMean, + newMean); + } + + [Test] + public void DrainCoefficient_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.DrainCoefficient.Mean = newMean, + newMean); + } + + [Test] + public void LevelCrestStructure_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.LevelCrestStructure.Mean = newMean, + newMean); + } + + [Test] + public void ThresholdHeightOpenWeir_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.ThresholdHeightOpenWeir.Mean = newMean, + newMean); + } + + [Test] + public void FlowVelocityStructureClosable_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.FlowVelocityStructureClosable.Mean = newMean, + newMean); + } + + [Test] + public void AreaFlowApertures_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.AreaFlowApertures.Mean = newMean, + newMean); + } + + [Test] + public void ConstructiveStrengthLinearLoadModel_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.ConstructiveStrengthLinearLoadModel.Mean = newMean, + newMean); + } + + [Test] + public void ConstructiveStrengthQuadraticLoadModel_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.ConstructiveStrengthQuadraticLoadModel.Mean = newMean, + newMean); + } + + [Test] + public void StabilityLinearLoadModel_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.StabilityLinearLoadModel.Mean = newMean, + newMean); + } + + [Test] + public void StabilityQuadraticLoadModel_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.StabilityQuadraticLoadModel.Mean = newMean, + newMean); + } + + [Test] + public void FailureCollisionEnergy_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.FailureCollisionEnergy.Mean = newMean, + newMean); + } + + [Test] + public void ShipMass_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.ShipMass.Mean = newMean, + newMean); + } + + [Test] + public void ShipVelocity_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.ShipVelocity.Mean = newMean, + newMean); + } + + [Test] + public void BankWidth_MeanChanged_InputChangedAndObsevablesNotified() + { + RoundedDouble newMean = new Random(21).NextRoundedDouble(); + SetPropertyAndVerifyNotifcationsAndOutput( + properties => properties.BankWidth.Mean = newMean, + newMean); + } + + [Test] [TestCase(double.MinValue)] [TestCase(double.MaxValue)] public void SetFailureProbabilityRepairClosure_InvalidValues_ThrowsArgumentException(double newValue)