Index: Core/Common/src/Core.Common.Gui/Converters/KeyValueElementAttribute.cs =================================================================== diff -u -rca27aee933103177a29a8d2ab46e127dbb8bacf6 -rb14f45e3735bbdde95f710bf396a85326eb388d5 --- Core/Common/src/Core.Common.Gui/Converters/KeyValueElementAttribute.cs (.../KeyValueElementAttribute.cs) (revision ca27aee933103177a29a8d2ab46e127dbb8bacf6) +++ Core/Common/src/Core.Common.Gui/Converters/KeyValueElementAttribute.cs (.../KeyValueElementAttribute.cs) (revision b14f45e3735bbdde95f710bf396a85326eb388d5) @@ -26,7 +26,7 @@ { /// /// Attribute when using the to define what is - /// shown as name and value for eache element. + /// shown as name and value for each element. /// [AttributeUsage(AttributeTargets.Property)] public class KeyValueElementAttribute : Attribute @@ -39,6 +39,7 @@ /// /// The name of the property to show as name. /// The name of the property to show as value. + /// Thrown when any parameter is null. public KeyValueElementAttribute(string namePropertyName, string valuePropertyName) { this.namePropertyName = namePropertyName; @@ -59,12 +60,15 @@ /// /// The source to obtain the property value of. /// The value used as name of the property. + /// Thrown when the property used for the name of + /// the is not found on the . + /// public string GetName(object source) { PropertyInfo namePropertyInfo = source.GetType().GetProperty(namePropertyName); if (namePropertyInfo == null) { - throw new ArgumentException($"Key property '{namePropertyName}' was not found on type {source.GetType().Name}."); + throw new ArgumentException($"Name property '{namePropertyName}' was not found on type {source.GetType().Name}."); } return Convert.ToString(namePropertyInfo.GetValue(source, new object[0])); @@ -76,12 +80,15 @@ /// /// The source to obtain the property value of. /// The value used as value of the property. + /// Thrown when the property used for the value of + /// the is not found on the . + /// public string GetValue(object source) { PropertyInfo valuePropertyInfo = source.GetType().GetProperty(valuePropertyName); if (valuePropertyInfo == null) { - throw new ArgumentException($"Key property '{valuePropertyName}' was not found on type {source.GetType().Name}."); + throw new ArgumentException($"Value property '{valuePropertyName}' was not found on type {source.GetType().Name}."); } return Convert.ToString(valuePropertyInfo.GetValue(source, new object[0])); Index: Core/Common/src/Core.Common.Gui/Converters/KeyValueExpandableArrayConverter.cs =================================================================== diff -u -rc5ac6656bddb53b9a1ec2edd5ca2f19c5b7d8e80 -rb14f45e3735bbdde95f710bf396a85326eb388d5 --- Core/Common/src/Core.Common.Gui/Converters/KeyValueExpandableArrayConverter.cs (.../KeyValueExpandableArrayConverter.cs) (revision c5ac6656bddb53b9a1ec2edd5ca2f19c5b7d8e80) +++ Core/Common/src/Core.Common.Gui/Converters/KeyValueExpandableArrayConverter.cs (.../KeyValueExpandableArrayConverter.cs) (revision b14f45e3735bbdde95f710bf396a85326eb388d5) @@ -76,13 +76,19 @@ /// /// Array element property descriptor used by . - /// Properties are named based the first item in the provided tuple and the value is + /// Properties are named based on the first item in the provided tuple and the value is /// based on the second item. /// private class ArrayPropertyDescriptor : SimplePropertyDescriptor { private readonly object value; + /// + /// Creates a new instance of . + /// + /// The type of elements of the array. + /// The name of the property. + /// The value of the property. public ArrayPropertyDescriptor(Type elementType, string name, object value) : base(elementType, name, value.GetType()) { Index: Core/Common/test/Core.Common.Gui.Test/Converters/KeyValueElementAttributeTest.cs =================================================================== diff -u -rca27aee933103177a29a8d2ab46e127dbb8bacf6 -rb14f45e3735bbdde95f710bf396a85326eb388d5 --- Core/Common/test/Core.Common.Gui.Test/Converters/KeyValueElementAttributeTest.cs (.../KeyValueElementAttributeTest.cs) (revision ca27aee933103177a29a8d2ab46e127dbb8bacf6) +++ Core/Common/test/Core.Common.Gui.Test/Converters/KeyValueElementAttributeTest.cs (.../KeyValueElementAttributeTest.cs) (revision b14f45e3735bbdde95f710bf396a85326eb388d5) @@ -21,6 +21,7 @@ using System; using Core.Common.Gui.Converters; +using Core.Common.TestUtil; using NUnit.Framework; namespace Core.Common.Gui.Test.Converters @@ -31,11 +32,8 @@ [Test] public void Constructor_WithoutValuePropertyName_ThrowsArgumentNullException() { - // Setup - const string namePropertyName = "name"; - // Call - TestDelegate test = () => new KeyValueElementAttribute(namePropertyName, null); + TestDelegate test = () => new KeyValueElementAttribute("name", null); // Assert var exception = Assert.Throws(test); @@ -45,11 +43,8 @@ [Test] public void Constructor_WithoutNamePropertyName_ThrowsArgumentNullException() { - // Setup - const string valuePropertyName = "value"; - // Call - TestDelegate test = () => new KeyValueElementAttribute(null, valuePropertyName); + TestDelegate test = () => new KeyValueElementAttribute(null, "value"); // Assert var exception = Assert.Throws(test); @@ -59,12 +54,8 @@ [Test] public void Constructor_WithParameters_CreatesNewInstance() { - // Setup - const string valuePropertyName = "value"; - const string namePropertyName = "name"; - // Call - var attribute = new KeyValueElementAttribute(namePropertyName, valuePropertyName); + var attribute = new KeyValueElementAttribute("name", "value"); // Assert Assert.IsInstanceOf(attribute); @@ -116,7 +107,8 @@ TestDelegate test = () => attribute.GetName(new TestObject()); // Assert - Assert.Throws(test); + const string expectedMessage = "Name property 'IDoNotExist' was not found on type TestObject."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); } [Test] @@ -165,7 +157,8 @@ TestDelegate test = () => attribute.GetValue(new TestObject()); // Assert - Assert.Throws(test); + const string expectedMessage = "Value property 'IDoNotExist' was not found on type TestObject."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); } private class TestObject Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/TopLevelSubMechanismIllustrationPointProperties.cs =================================================================== diff -u -r6a60e0e3f676c71e253ad41839519c18dd641e9e -rb14f45e3735bbdde95f710bf396a85326eb388d5 --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/TopLevelSubMechanismIllustrationPointProperties.cs (.../TopLevelSubMechanismIllustrationPointProperties.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/TopLevelSubMechanismIllustrationPointProperties.cs (.../TopLevelSubMechanismIllustrationPointProperties.cs) (revision b14f45e3735bbdde95f710bf396a85326eb388d5) @@ -127,7 +127,7 @@ public override string ToString() { - return $"{data.SubMechanismIllustrationPoint.Name}"; + return data.SubMechanismIllustrationPoint.Name; } } } \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationContextProperties.cs =================================================================== diff -u -r6cdf02ac497b3bab4f7f955efac588545f5b8986 -rb14f45e3735bbdde95f710bf396a85326eb388d5 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationContextProperties.cs (.../DesignWaterLevelLocationContextProperties.cs) (revision 6cdf02ac497b3bab4f7f955efac588545f5b8986) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationContextProperties.cs (.../DesignWaterLevelLocationContextProperties.cs) (revision b14f45e3735bbdde95f710bf396a85326eb388d5) @@ -21,7 +21,6 @@ using System.ComponentModel; using Core.Common.Base.Data; -using Core.Common.Base.Geometry; using Core.Common.Gui.Attributes; using Core.Common.Utils; using Core.Common.Utils.Attributes;