Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresFailureMechanismProperties.cs =================================================================== diff -u -rae723c147c281ccbb2dd0b06c6f863c2d8d0403d -re27a2a4b649ecc232679d527acd5bb4c78e0219d --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresFailureMechanismProperties.cs (.../HeightStructuresFailureMechanismProperties.cs) (revision ae723c147c281ccbb2dd0b06c6f863c2d8d0403d) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresFailureMechanismProperties.cs (.../HeightStructuresFailureMechanismProperties.cs) (revision e27a2a4b649ecc232679d527acd5bb4c78e0219d) @@ -38,11 +38,12 @@ { private const int namePropertyIndex = 1; private const int codePropertyIndex = 2; - private const int isRelevantPropertyIndex = 3; - private const int gravitationalAccelerationPropertyIndex = 4; - private const int nPropertyIndex = 5; - private const int modelFactorOvertoppingFlowPropertyIndex = 6; - private const int modelFactorStorageVolumePropertyIndex = 7; + private const int contributionPropertyIndex = 3; + private const int isRelevantPropertyIndex = 4; + private const int gravitationalAccelerationPropertyIndex = 5; + private const int nPropertyIndex = 6; + private const int modelFactorOvertoppingFlowPropertyIndex = 7; + private const int modelFactorStorageVolumePropertyIndex = 8; /// /// Creates a new instance of . @@ -90,7 +91,8 @@ private bool ShouldHidePropertyWhenFailureMechanismIrrelevant(string propertyName) { - return nameof(N).Equals(propertyName) + return nameof(Contribution).Equals(propertyName) + || nameof(N).Equals(propertyName) || nameof(GravitationalAcceleration).Equals(propertyName) || nameof(ModelFactorOvertoppingFlow).Equals(propertyName) || nameof(ModelFactorStorageVolume).Equals(propertyName); @@ -122,6 +124,19 @@ } } + [DynamicVisible] + [PropertyOrder(contributionPropertyIndex)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Contribution_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Contribution_Description))] + public double Contribution + { + get + { + return data.Contribution; + } + } + [PropertyOrder(isRelevantPropertyIndex)] [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_IsRelevant_DisplayName))] Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailureMechanismPropertiesTest.cs =================================================================== diff -u -r98544d1ded83f880238cb8e69f77b58ec1dbcc19 -re27a2a4b649ecc232679d527acd5bb4c78e0219d --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailureMechanismPropertiesTest.cs (.../HeightStructuresFailureMechanismPropertiesTest.cs) (revision 98544d1ded83f880238cb8e69f77b58ec1dbcc19) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailureMechanismPropertiesTest.cs (.../HeightStructuresFailureMechanismPropertiesTest.cs) (revision e27a2a4b649ecc232679d527acd5bb4c78e0219d) @@ -38,11 +38,12 @@ { private const int namePropertyIndex = 0; private const int codePropertyIndex = 1; - private const int isRelevantPropertyIndex = 2; - private const int gravitationalAccelerationPropertyIndex = 3; - private const int nPropertyIndex = 4; - private const int modelFactorOvertoppingFlowPropertyIndex = 5; - private const int modelFactorStorageVolumePropertyIndex = 6; + private const int contributionPropertyIndex = 2; + private const int isRelevantPropertyIndex = 3; + private const int gravitationalAccelerationPropertyIndex = 4; + private const int nPropertyIndex = 5; + private const int modelFactorOvertoppingFlowPropertyIndex = 6; + private const int modelFactorStorageVolumePropertyIndex = 7; [Test] public void Constructor_DataNull_ThrowArgumentNullException() @@ -72,13 +73,12 @@ // Assert Assert.IsInstanceOf>(properties); Assert.AreSame(failureMechanism, properties.Data); - - Assert.AreEqual("Kunstwerken - Hoogte kunstwerk", properties.Name); - Assert.AreEqual("HTKW", properties.Code); + Assert.AreEqual(failureMechanism.Name, properties.Name); + Assert.AreEqual(failureMechanism.Code, properties.Code); + Assert.AreEqual(failureMechanism.Contribution, properties.Contribution); Assert.AreEqual(isRelevant, properties.IsRelevant); GeneralHeightStructuresInput generalInput = failureMechanism.GeneralInput; - Assert.AreEqual(generalInput.N, properties.N); Assert.AreEqual(generalInput.GravitationalAcceleration, properties.GravitationalAcceleration); Assert.AreEqual(generalInput.ModelFactorOvertoppingFlow.Mean, properties.ModelFactorOvertoppingFlow.Mean); @@ -104,7 +104,7 @@ const string modelSettingsCategory = "Modelinstellingen"; PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); - Assert.AreEqual(7, dynamicProperties.Count); + Assert.AreEqual(8, dynamicProperties.Count); PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty, @@ -120,6 +120,13 @@ "Het label van het toetsspoor.", true); + PropertyDescriptor contributionProperty = dynamicProperties[contributionPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(contributionProperty, + generalCategory, + "Faalkansbijdrage [%]", + "Procentuele bijdrage van dit toetsspoor aan de totale overstromingskans van het traject.", + true); + PropertyDescriptor isRelevantProperty = dynamicProperties[isRelevantPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(isRelevantProperty, generalCategory, @@ -187,7 +194,7 @@ "Het label van het toetsspoor.", true); - PropertyDescriptor isRelevantProperty = dynamicProperties[isRelevantPropertyIndex]; + PropertyDescriptor isRelevantProperty = dynamicProperties[isRelevantPropertyIndex - 1]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(isRelevantProperty, generalCategory, "Is relevant", @@ -263,6 +270,7 @@ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.Code))); Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.IsRelevant))); + Assert.AreEqual(isRelevant, properties.DynamicVisibleValidationMethod(nameof(properties.Contribution))); Assert.AreEqual(isRelevant, properties.DynamicVisibleValidationMethod(nameof(properties.N))); Assert.AreEqual(isRelevant, properties.DynamicVisibleValidationMethod(nameof(properties.GravitationalAcceleration))); Assert.AreEqual(isRelevant, properties.DynamicVisibleValidationMethod(nameof(properties.ModelFactorOvertoppingFlow)));