Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/LogNormalDistributionPropertiesTest.cs =================================================================== diff -u -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 -r8c915b3e32d3e34f825bdb6d114344b5a2eb4ca8 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/LogNormalDistributionPropertiesTest.cs (.../LogNormalDistributionPropertiesTest.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/LogNormalDistributionPropertiesTest.cs (.../LogNormalDistributionPropertiesTest.cs) (revision 8c915b3e32d3e34f825bdb6d114344b5a2eb4ca8) @@ -19,8 +19,13 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; +using System.Collections.Generic; using System.ComponentModel; +using System.Linq; using Core.Common.Base; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; using NUnit.Framework; using Rhino.Mocks; using Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses; @@ -55,7 +60,6 @@ mockRepository.VerifyAll(); } - [Test] public void PropertyAttributes_ReturnExpectedValues() { @@ -69,7 +73,38 @@ // Assert TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); Assert.IsInstanceOf(classTypeConverter); + + var dynamicPropertyBag = new DynamicPropertyBag(properties); + PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); + Assert.AreEqual(4, dynamicProperties.Count); + + var meanAttributes = Attribute.GetCustomAttributes(properties.GetType().GetProperty("Mean")); + Assert.IsNotNull(meanAttributes); + AssertAttributesOfType(meanAttributes, "Verwachtingswaarde", + attribute => attribute.DisplayName); + AssertAttributesOfType(meanAttributes, + "De gemiddelde waarde van de lognormale verdeling.", + attribute => attribute.Description); + + var standardAttributes = Attribute.GetCustomAttributes(properties.GetType().GetProperty("StandardDeviation")); + Assert.IsNotNull(standardAttributes); + AssertAttributesOfType(standardAttributes, "Standaardafwijking", + attribute => attribute.DisplayName); + AssertAttributesOfType(standardAttributes, + "De standaardafwijking van de lognormale verdeling.", + attribute => attribute.Description); + mockRepository.VerifyAll(); } + + private static void AssertAttributesOfType(IEnumerable attributes, TR expectedValue, + Func action) + { + var meanDisplayNameAttribute = attributes.OfType(); + Assert.IsNotNull(meanDisplayNameAttribute); + var e = meanDisplayNameAttribute.FirstOrDefault(); + Assert.IsNotNull(e); + Assert.AreEqual(expectedValue, action(e)); + } } } \ No newline at end of file