Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismAssemblyCategoryProperties.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismAssemblyCategoryProperties.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismAssemblyCategoryProperties.cs (revision ab0620a9becf183f9796fd55ae83dcbf43ac86c4)
@@ -0,0 +1,101 @@
+// Copyright (C) Stichting Deltares 2017. 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 System.ComponentModel;
+using Core.Common.Gui.Attributes;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.Util;
+using Core.Common.Util.Attributes;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Forms.Properties;
+using Ringtoets.Common.Forms.TypeConverters;
+
+namespace Ringtoets.Common.Forms.PropertyClasses
+{
+ ///
+ /// ViewModel of a for properties panel.
+ ///
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ public class FailureMechanismAssemblyCategoryProperties : ObjectProperties
+ {
+ private const int groupPropertyIndex = 1;
+ private const int lowerBoundaryPropertyIndex = 2;
+ private const int upperBoundaryPropertyIndex = 3;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ public FailureMechanismAssemblyCategoryProperties(FailureMechanismAssemblyCategory assemblyCategory)
+ {
+ if (assemblyCategory == null)
+ {
+ throw new ArgumentNullException(nameof(assemblyCategory));
+ }
+
+ Data = assemblyCategory;
+ }
+
+ [PropertyOrder(groupPropertyIndex)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.CategoryProperties_Group_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.CategoryProperties_Group_Description))]
+ [TypeConverter(typeof(EnumTypeConverter))]
+ public FailureMechanismAssemblyCategoryGroup Group
+ {
+ get
+ {
+ return data.Group;
+ }
+ }
+
+ [PropertyOrder(lowerBoundaryPropertyIndex)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.CategoryProperties_LowerBoundary_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.CategoryProperties_LowerBoundary_Description))]
+ [TypeConverter(typeof(NoProbabilityValueDoubleConverter))]
+ public double LowerBoundary
+ {
+ get
+ {
+ return data.LowerBoundary;
+ }
+ }
+
+ [PropertyOrder(upperBoundaryPropertyIndex)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.CategoryProperties_UpperBoundary_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.CategoryProperties_UpperBoundary_Description))]
+ [TypeConverter(typeof(NoProbabilityValueDoubleConverter))]
+ public double UpperBoundary
+ {
+ get
+ {
+ return data.UpperBoundary;
+ }
+ }
+
+ public override string ToString()
+ {
+ return new EnumDisplayWrapper(data.Group).DisplayName;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionAssemblyCategoryProperties.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionAssemblyCategoryProperties.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionAssemblyCategoryProperties.cs (revision ab0620a9becf183f9796fd55ae83dcbf43ac86c4)
@@ -0,0 +1,101 @@
+// Copyright (C) Stichting Deltares 2017. 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 System.ComponentModel;
+using Core.Common.Gui.Attributes;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.Util;
+using Core.Common.Util.Attributes;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Forms.Properties;
+using Ringtoets.Common.Forms.TypeConverters;
+
+namespace Ringtoets.Common.Forms.PropertyClasses
+{
+ ///
+ /// ViewModel of a for properties panel.
+ ///
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ public class FailureMechanismSectionAssemblyCategoryProperties : ObjectProperties
+ {
+ private const int groupPropertyIndex = 1;
+ private const int lowerBoundaryPropertyIndex = 2;
+ private const int upperBoundaryPropertyIndex = 3;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ public FailureMechanismSectionAssemblyCategoryProperties(FailureMechanismSectionAssemblyCategory assemblyCategory)
+ {
+ if (assemblyCategory == null)
+ {
+ throw new ArgumentNullException(nameof(assemblyCategory));
+ }
+
+ Data = assemblyCategory;
+ }
+
+ [PropertyOrder(groupPropertyIndex)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.CategoryProperties_Group_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.CategoryProperties_Group_Description))]
+ [TypeConverter(typeof(EnumTypeConverter))]
+ public FailureMechanismSectionAssemblyCategoryGroup Group
+ {
+ get
+ {
+ return data.Group;
+ }
+ }
+
+ [PropertyOrder(lowerBoundaryPropertyIndex)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.CategoryProperties_LowerBoundary_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.CategoryProperties_LowerBoundary_Description))]
+ [TypeConverter(typeof(NoProbabilityValueDoubleConverter))]
+ public double LowerBoundary
+ {
+ get
+ {
+ return data.LowerBoundary;
+ }
+ }
+
+ [PropertyOrder(upperBoundaryPropertyIndex)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.CategoryProperties_UpperBoundary_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.CategoryProperties_UpperBoundary_Description))]
+ [TypeConverter(typeof(NoProbabilityValueDoubleConverter))]
+ public double UpperBoundary
+ {
+ get
+ {
+ return data.UpperBoundary;
+ }
+ }
+
+ public override string ToString()
+ {
+ return new EnumDisplayWrapper(data.Group).DisplayName;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj
===================================================================
diff -u -r72ac518de9bbb165cdd1595cf6f460d8e0f760e3 -rab0620a9becf183f9796fd55ae83dcbf43ac86c4
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 72ac518de9bbb165cdd1595cf6f460d8e0f760e3)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision ab0620a9becf183f9796fd55ae83dcbf43ac86c4)
@@ -93,6 +93,8 @@
Resources.resx
+
+
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismAssemblyCategoryPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismAssemblyCategoryPropertiesTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismAssemblyCategoryPropertiesTest.cs (revision ab0620a9becf183f9796fd55ae83dcbf43ac86c4)
@@ -0,0 +1,126 @@
+// Copyright (C) Stichting Deltares 2017. 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 System.ComponentModel;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.TestUtil;
+using Core.Common.Util;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Forms.PropertyClasses;
+
+namespace Ringtoets.Common.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class FailureMechanismAssemblyCategoryPropertiesTest
+ {
+ [Test]
+ public void Constructor_AssemblyCategoryNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new FailureMechanismAssemblyCategoryProperties(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("assemblyCategory", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_ValidParameters_ExpectedValues()
+ {
+ // Setup
+ var random = new Random(39);
+ var assemblyCategory = new FailureMechanismAssemblyCategory(random.NextDouble(),
+ random.NextDouble(),
+ random.NextEnumValue());
+
+ // Call
+ var properties = new FailureMechanismAssemblyCategoryProperties(assemblyCategory);
+
+ // Assert
+ Assert.IsInstanceOf>(properties);
+ Assert.AreSame(assemblyCategory, properties.Data);
+ TestHelper.AssertTypeConverter();
+
+ Assert.AreEqual(assemblyCategory.Group, properties.Group);
+ Assert.AreEqual(assemblyCategory.LowerBoundary, properties.LowerBoundary);
+ Assert.AreEqual(assemblyCategory.UpperBoundary, properties.UpperBoundary);
+ }
+
+ [Test]
+ public void Constructor_Always_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ var random = new Random(39);
+ var assemblyCategory = new FailureMechanismAssemblyCategory(random.NextDouble(),
+ random.NextDouble(),
+ random.NextEnumValue());
+
+ // Call
+ var properties = new FailureMechanismAssemblyCategoryProperties(assemblyCategory);
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(3, dynamicProperties.Count);
+
+ const string generalCategoryName = "Algemeen";
+
+ PropertyDescriptor nameProperty = dynamicProperties[0];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
+ generalCategoryName,
+ "Naam",
+ "Naam van de categorie.",
+ true);
+
+ PropertyDescriptor lowerBoundaryProperty = dynamicProperties[1];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(lowerBoundaryProperty,
+ generalCategoryName,
+ "Ondergrens [1/jaar]",
+ "Ondergrens van de categorie.",
+ true);
+
+ PropertyDescriptor upperBoundaryProperty = dynamicProperties[2];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(upperBoundaryProperty,
+ generalCategoryName,
+ "Bovengrens [1/jaar]",
+ "Bovengrens van de categorie.",
+ true);
+ }
+
+ [Test]
+ public void ToString_Always_ReturnsCategoryGroupDisplayName()
+ {
+ // Setup
+ var random = new Random(39);
+ var categoryGroup = random.NextEnumValue();
+ var properties = new FailureMechanismAssemblyCategoryProperties(new FailureMechanismAssemblyCategory(random.NextDouble(),
+ random.NextDouble(),
+ categoryGroup));
+
+ // Call
+ string result = properties.ToString();
+
+ // Assert
+ Assert.AreEqual(new EnumDisplayWrapper(categoryGroup).DisplayName,
+ result);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismSectionAssemblyCategoryPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismSectionAssemblyCategoryPropertiesTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismSectionAssemblyCategoryPropertiesTest.cs (revision ab0620a9becf183f9796fd55ae83dcbf43ac86c4)
@@ -0,0 +1,126 @@
+// Copyright (C) Stichting Deltares 2017. 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 System.ComponentModel;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.TestUtil;
+using Core.Common.Util;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Forms.PropertyClasses;
+
+namespace Ringtoets.Common.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class FailureMechanismSectionAssemblyCategoryPropertiesTest
+ {
+ [Test]
+ public void Constructor_AssemblyCategoryNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new FailureMechanismSectionAssemblyCategoryProperties(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("assemblyCategory", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_ValidParameters_ExpectedValues()
+ {
+ // Setup
+ var random = new Random(39);
+ var assemblyCategory = new FailureMechanismSectionAssemblyCategory(random.NextDouble(),
+ random.NextDouble(),
+ random.NextEnumValue());
+
+ // Call
+ var properties = new FailureMechanismSectionAssemblyCategoryProperties(assemblyCategory);
+
+ // Assert
+ Assert.IsInstanceOf>(properties);
+ Assert.AreSame(assemblyCategory, properties.Data);
+ TestHelper.AssertTypeConverter();
+
+ Assert.AreEqual(assemblyCategory.Group, properties.Group);
+ Assert.AreEqual(assemblyCategory.LowerBoundary, properties.LowerBoundary);
+ Assert.AreEqual(assemblyCategory.UpperBoundary, properties.UpperBoundary);
+ }
+
+ [Test]
+ public void Constructor_Always_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ var random = new Random(39);
+ var assemblyCategory = new FailureMechanismSectionAssemblyCategory(random.NextDouble(),
+ random.NextDouble(),
+ random.NextEnumValue());
+
+ // Call
+ var properties = new FailureMechanismSectionAssemblyCategoryProperties(assemblyCategory);
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(3, dynamicProperties.Count);
+
+ const string generalCategoryName = "Algemeen";
+
+ PropertyDescriptor nameProperty = dynamicProperties[0];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
+ generalCategoryName,
+ "Naam",
+ "Naam van de categorie.",
+ true);
+
+ PropertyDescriptor lowerBoundaryProperty = dynamicProperties[1];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(lowerBoundaryProperty,
+ generalCategoryName,
+ "Ondergrens [1/jaar]",
+ "Ondergrens van de categorie.",
+ true);
+
+ PropertyDescriptor upperBoundaryProperty = dynamicProperties[2];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(upperBoundaryProperty,
+ generalCategoryName,
+ "Bovengrens [1/jaar]",
+ "Bovengrens van de categorie.",
+ true);
+ }
+
+ [Test]
+ public void ToString_Always_ReturnsCategoryGroupDisplayName()
+ {
+ // Setup
+ var random = new Random(39);
+ var categoryGroup = random.NextEnumValue();
+ var properties = new FailureMechanismSectionAssemblyCategoryProperties(new FailureMechanismSectionAssemblyCategory(random.NextDouble(),
+ random.NextDouble(),
+ categoryGroup));
+
+ // Call
+ string result = properties.ToString();
+
+ // Assert
+ Assert.AreEqual(new EnumDisplayWrapper(categoryGroup).DisplayName,
+ result);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj
===================================================================
diff -u -r72ac518de9bbb165cdd1595cf6f460d8e0f760e3 -rab0620a9becf183f9796fd55ae83dcbf43ac86c4
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 72ac518de9bbb165cdd1595cf6f460d8e0f760e3)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision ab0620a9becf183f9796fd55ae83dcbf43ac86c4)
@@ -95,6 +95,8 @@
+
+