Index: Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/PropertyClasses/HeightStructuresFailurePathProperties.cs =================================================================== diff -u -r4075241549b94454a6ad23fc355c69be49aecc17 -red81b2c9fe714201309ffa8746a766c3b09c55b0 --- Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/PropertyClasses/HeightStructuresFailurePathProperties.cs (.../HeightStructuresFailurePathProperties.cs) (revision 4075241549b94454a6ad23fc355c69be49aecc17) +++ Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/PropertyClasses/HeightStructuresFailurePathProperties.cs (.../HeightStructuresFailurePathProperties.cs) (revision ed81b2c9fe714201309ffa8746a766c3b09c55b0) @@ -39,6 +39,7 @@ private const int contributionPropertyIndex = 4; private const int inAssemblyPropertyIndex = 5; private const int nPropertyIndex = 6; + private const int applyLengthEffectInSectionPropertyIndex = 7; /// /// Creates a new instance of . @@ -51,6 +52,19 @@ CodePropertyIndex = codePropertyIndex }) {} + [DynamicVisibleValidationMethod] + public bool DynamicVisibleValidationMethod(string propertyName) + { + return data.InAssembly || !ShouldHidePropertyWhenFailureMechanismNotPartOfAssembly(propertyName); + } + + private static bool ShouldHidePropertyWhenFailureMechanismNotPartOfAssembly(string propertyName) + { + return nameof(Contribution).Equals(propertyName) + || nameof(N).Equals(propertyName) + || nameof(ApplyLengthEffectInSection).Equals(propertyName); + } + #region Length effect parameters [DynamicVisible] @@ -71,19 +85,20 @@ } } - #endregion - - [DynamicVisibleValidationMethod] - public bool DynamicVisibleValidationMethod(string propertyName) + [DynamicVisible] + [PropertyOrder(applyLengthEffectInSectionPropertyIndex)] + [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_LengthEffect))] + [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_Apply_LengthEffect_In_Section_DisplayName))] + [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_Apply_LengthEffect_In_Section_Description))] + public bool ApplyLengthEffectInSection { - return data.InAssembly || !ShouldHidePropertyWhenFailureMechanismNotPartOfAssembly(propertyName); + get + { + return false; + } } - private static bool ShouldHidePropertyWhenFailureMechanismNotPartOfAssembly(string propertyName) - { - return nameof(Contribution).Equals(propertyName) - || nameof(N).Equals(propertyName); - } + #endregion #region General Index: Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailurePathPropertiesTest.cs =================================================================== diff -u -rfdfcebfac58179f6b1d1e19d376342f82eaaffcd -red81b2c9fe714201309ffa8746a766c3b09c55b0 --- Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailurePathPropertiesTest.cs (.../HeightStructuresFailurePathPropertiesTest.cs) (revision fdfcebfac58179f6b1d1e19d376342f82eaaffcd) +++ Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailurePathPropertiesTest.cs (.../HeightStructuresFailurePathPropertiesTest.cs) (revision ed81b2c9fe714201309ffa8746a766c3b09c55b0) @@ -41,6 +41,7 @@ private const int contributionPropertyIndex = 3; private const int inAssemblyPropertyIndex = 4; private const int nPropertyIndex = 5; + private const int applySectionLengthInSectionPropertyIndex = 6; [Test] public void Constructor_ExpectedValues() @@ -68,6 +69,7 @@ Assert.AreEqual(generalInput.N, properties.N, properties.N.GetAccuracy()); + Assert.IsFalse(properties.ApplyLengthEffectInSection); } [Test] @@ -81,7 +83,7 @@ // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); - Assert.AreEqual(6, dynamicProperties.Count); + Assert.AreEqual(7, dynamicProperties.Count); const string generalCategory = "Algemeen"; const string lengthEffectCategory = "Lengte-effect"; @@ -126,6 +128,13 @@ lengthEffectCategory, "N [-]", "De parameter 'N' die gebruikt wordt om het lengte-effect mee te nemen in de beoordeling."); + + PropertyDescriptor applySectionLengthInSectionProperty = dynamicProperties[applySectionLengthInSectionPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(applySectionLengthInSectionProperty, + lengthEffectCategory, + "Toepassen lengte-effect binnen vak", + "Geeft aan of het lengte-effect binnen een vak toegepast wordt.", + true); } [Test] @@ -248,6 +257,7 @@ Assert.AreEqual(inAssembly, properties.DynamicVisibleValidationMethod(nameof(properties.Contribution))); Assert.AreEqual(inAssembly, properties.DynamicVisibleValidationMethod(nameof(properties.N))); + Assert.AreEqual(inAssembly, properties.DynamicVisibleValidationMethod(nameof(properties.ApplyLengthEffectInSection))); Assert.IsTrue(properties.DynamicVisibleValidationMethod(null)); }