Fisheye: Tag 0b522a31f55a06325a2f4ec7bf4055b12d5a93fe refers to a dead (removed) revision in file `Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/AssemblyGroupProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 0b522a31f55a06325a2f4ec7bf4055b12d5a93fe refers to a dead (removed) revision in file `Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/AssemblyGroupsProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/FailureMechanismSectionAssemblyGroupProperties.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/FailureMechanismSectionAssemblyGroupProperties.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/FailureMechanismSectionAssemblyGroupProperties.cs (revision 0b522a31f55a06325a2f4ec7bf4055b12d5a93fe) @@ -0,0 +1,103 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer 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.Util; +using Core.Common.Util.Attributes; +using Core.Gui.Attributes; +using Core.Gui.PropertyBag; +using Riskeer.AssemblyTool.Data; +using Riskeer.AssemblyTool.Forms; +using Riskeer.Common.Forms.TypeConverters; +using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources; + +namespace Riskeer.Integration.Forms.PropertyClasses +{ + /// + /// ViewModel of a for properties panel. + /// + [TypeConverter(typeof(ExpandableObjectConverter))] + public class FailureMechanismSectionAssemblyGroupProperties : ObjectProperties + { + private const int groupPropertyIndex = 1; + private const int lowerBoundaryPropertyIndex = 2; + private const int upperBoundaryPropertyIndex = 3; + + /// + /// Creates a new instance of . + /// + /// Thrown when is null. + public FailureMechanismSectionAssemblyGroupProperties(FailureMechanismSectionAssemblyGroupBoundaries assemblyGroupBoundaries) + { + if (assemblyGroupBoundaries == null) + { + throw new ArgumentNullException(nameof(assemblyGroupBoundaries)); + } + + Data = assemblyGroupBoundaries; + } + + [PropertyOrder(groupPropertyIndex)] + [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.AssemblyGroup_Name_DisplayName))] + [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.AssemblyGroup_Name_Description))] + [TypeConverter(typeof(EnumTypeConverter))] + public DisplayFailureMechanismSectionAssemblyGroup Group + { + get + { + return DisplayFailureMechanismSectionAssemblyGroupConverter.Convert(data.Group); + } + } + + [PropertyOrder(lowerBoundaryPropertyIndex)] + [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.AssemblyGroup_LowerBoundary_DisplayName))] + [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.AssemblyCategory_LowerBoundary_Description))] + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double LowerBoundary + { + get + { + return data.LowerBoundary; + } + } + + [PropertyOrder(upperBoundaryPropertyIndex)] + [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.AssemblyGroup_UpperBoundary_DisplayName))] + [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.AssemblyCategory_UpperBoundary_Description))] + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double UpperBoundary + { + get + { + return data.UpperBoundary; + } + } + + public override string ToString() + { + return new EnumDisplayWrapper(Group).DisplayName; + } + } +} \ No newline at end of file Index: Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/FailureMechanismSectionAssemblyGroupsProperties.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/FailureMechanismSectionAssemblyGroupsProperties.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/FailureMechanismSectionAssemblyGroupsProperties.cs (revision 0b522a31f55a06325a2f4ec7bf4055b12d5a93fe) @@ -0,0 +1,83 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer 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 System.Linq; +using Core.Common.Util.Attributes; +using Core.Gui.Attributes; +using Core.Gui.Converters; +using Core.Gui.PropertyBag; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Data.AssemblyTool; +using Riskeer.Integration.Data; +using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources; + +namespace Riskeer.Integration.Forms.PropertyClasses +{ + /// + /// ViewModel of a collection of for properties panel. + /// + public class FailureMechanismSectionAssemblyGroupsProperties : ObjectProperties + { + private const int failureMechanismSectionAssemblyCategoryPropertyIndex = 1; + + /// + /// Creates a new instance of . + /// + /// The . + /// Thrown when is null. + public FailureMechanismSectionAssemblyGroupsProperties(AssessmentSection assessmentSection) + { + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + Data = assessmentSection; + } + + [PropertyOrder(failureMechanismSectionAssemblyCategoryPropertyIndex)] + [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.AssemblyGroups_DisplayName))] + [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.AssemblyGroups_Description))] + [TypeConverter(typeof(ExpandableArrayConverter))] + public FailureMechanismSectionAssemblyGroupProperties[] FailureMechanismAssemblyGroups + { + get + { + return GetFailureMechanismAssemblyGroups(); + } + } + + private FailureMechanismSectionAssemblyGroupProperties[] GetFailureMechanismAssemblyGroups() + { + if (Data is AssessmentSection assessmentSection) + { + return AssemblyToolGroupBoundariesFactory.CreateFailureMechanismSectionAssemblyGroupBoundaries( + assessmentSection.FailureMechanismContribution.SignalingNorm, assessmentSection.FailureMechanismContribution.LowerLimitNorm) + .Select(category => new FailureMechanismSectionAssemblyGroupProperties(category)).ToArray(); + } + + return Array.Empty(); + } + } +} \ No newline at end of file Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs =================================================================== diff -u -rfe9341e7ae13efa1b66bfe42c11e53824c28981a -r0b522a31f55a06325a2f4ec7bf4055b12d5a93fe --- Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision fe9341e7ae13efa1b66bfe42c11e53824c28981a) +++ Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 0b522a31f55a06325a2f4ec7bf4055b12d5a93fe) @@ -319,9 +319,9 @@ CreateInstance = context => new StructuresOutputProperties(context.WrappedData.Output) }; - yield return new PropertyInfo + yield return new PropertyInfo { - CreateInstance = context => new AssemblyGroupsProperties(context.WrappedData) + CreateInstance = context => new FailureMechanismSectionAssemblyGroupsProperties(context.WrappedData) }; } Fisheye: Tag 0b522a31f55a06325a2f4ec7bf4055b12d5a93fe refers to a dead (removed) revision in file `Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/AssemblyGroupPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 0b522a31f55a06325a2f4ec7bf4055b12d5a93fe refers to a dead (removed) revision in file `Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/AssemblyGroupsPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/FailureMechanismSectionAssemblyGroupPropertiesTest.cs =================================================================== diff -u --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/FailureMechanismSectionAssemblyGroupPropertiesTest.cs (revision 0) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/FailureMechanismSectionAssemblyGroupPropertiesTest.cs (revision 0b522a31f55a06325a2f4ec7bf4055b12d5a93fe) @@ -0,0 +1,128 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer 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.TestUtil; +using Core.Common.Util; +using Core.Gui.PropertyBag; +using Core.Gui.TestUtil; +using NUnit.Framework; +using Riskeer.AssemblyTool.Data; +using Riskeer.AssemblyTool.Forms; +using Riskeer.Integration.Forms.PropertyClasses; + +namespace Riskeer.Integration.Forms.Test.PropertyClasses +{ + [TestFixture] + public class FailureMechanismSectionAssemblyGroupPropertiesTest + { + [Test] + public void Constructor_AssemblyGroupBoundariesNull_ThrowsArgumentNullException() + { + // Call + void Call() => new FailureMechanismSectionAssemblyGroupProperties(null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("assemblyGroupBoundaries", exception.ParamName); + } + + [Test] + public void Constructor_ValidParameters_ExpectedValues() + { + // Setup + var random = new Random(39); + var assemblyCategory = new FailureMechanismSectionAssemblyGroupBoundaries(random.NextEnumValue(), + random.NextDouble(), + random.NextDouble()); + + // Call + var properties = new FailureMechanismSectionAssemblyGroupProperties(assemblyCategory); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.AreSame(assemblyCategory, properties.Data); + TestHelper.AssertTypeConverter(); + + Assert.AreEqual(DisplayFailureMechanismSectionAssemblyGroupConverter.Convert(assemblyCategory.Group), properties.Group); + Assert.AreEqual(assemblyCategory.LowerBoundary, properties.LowerBoundary); + Assert.AreEqual(assemblyCategory.UpperBoundary, properties.UpperBoundary); + } + + [Test] + public void Constructor_Always_PropertiesHaveExpectedAttributeValues() + { + // Setup + var random = new Random(39); + var assemblyCategory = new FailureMechanismSectionAssemblyGroupBoundaries(random.NextEnumValue(), + random.NextDouble(), + random.NextDouble()); + + // Call + var properties = new FailureMechanismSectionAssemblyGroupProperties(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 duidingsklasse.", + true); + + PropertyDescriptor lowerBoundaryProperty = dynamicProperties[1]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(lowerBoundaryProperty, + generalCategoryName, + "Ondergrens [1/jaar]", + "Ondergrens van de duidingsklasse.", + true); + + PropertyDescriptor upperBoundaryProperty = dynamicProperties[2]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(upperBoundaryProperty, + generalCategoryName, + "Bovengrens [1/jaar]", + "Bovengrens van de duidingsklasse.", + true); + } + + [Test] + public void ToString_Always_ReturnsAssemblyGroupDisplayName() + { + // Setup + var random = new Random(39); + var categoryGroup = random.NextEnumValue(); + var properties = new FailureMechanismSectionAssemblyGroupProperties(new FailureMechanismSectionAssemblyGroupBoundaries(categoryGroup, + random.NextDouble(), + random.NextDouble())); + + // Call + var result = properties.ToString(); + + // Assert + Assert.AreEqual(new EnumDisplayWrapper( + DisplayFailureMechanismSectionAssemblyGroupConverter.Convert(categoryGroup)).DisplayName, result); + } + } +} \ No newline at end of file Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/FailureMechanismSectionAssemblyGroupsPropertiesTest.cs =================================================================== diff -u --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/FailureMechanismSectionAssemblyGroupsPropertiesTest.cs (revision 0) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/FailureMechanismSectionAssemblyGroupsPropertiesTest.cs (revision 0b522a31f55a06325a2f4ec7bf4055b12d5a93fe) @@ -0,0 +1,84 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer 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.TestUtil; +using Core.Gui.Converters; +using Core.Gui.TestUtil; +using NUnit.Framework; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Integration.Data; +using Riskeer.Integration.Forms.PropertyClasses; + +namespace Riskeer.Integration.Forms.Test.PropertyClasses +{ + [TestFixture] + public class FailureMechanismSectionAssemblyGroupsPropertiesTest + { + [Test] + public void Constructor_assessmentSectionNull_ThrowsArgumentNullException() + { + // Call + void Call() => new FailureMechanismSectionAssemblyGroupsProperties(null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("assessmentSection", exception.ParamName); + } + + [Test] + public void Constructor_ValidParameters_ExpectedValues() + { + // Setup + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); + + // Call + var properties = new FailureMechanismSectionAssemblyGroupsProperties(assessmentSection); + + // Assert + Assert.IsInstanceOf(properties); + Assert.AreSame(assessmentSection, properties.Data); + TestHelper.AssertTypeConverter( + nameof(FailureMechanismSectionAssemblyGroupsProperties.FailureMechanismAssemblyGroups)); + } + + [Test] + public void Constructor_Always_PropertiesHaveExpectedAttributesValues() + { + // Call + var properties = new FailureMechanismSectionAssemblyGroupsProperties(new AssessmentSection(AssessmentSectionComposition.Dike)); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(1, dynamicProperties.Count); + + const string generalCategoryName = "Algemeen"; + + PropertyDescriptor failureMechanismSectionCategoriesProperty = dynamicProperties[0]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(failureMechanismSectionCategoriesProperty, + generalCategoryName, + "Duidingsklassen", + "De duidingsklassen per vak voor dit toetsspoor.", + true); + } + } +} \ No newline at end of file Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/PropertyInfos/FailureMechanismSectionAssemblyGroupsContextPropertyInfoTest.cs =================================================================== diff -u -re3707b3ce2e92905286dd070c4eb0445d62aff94 -r0b522a31f55a06325a2f4ec7bf4055b12d5a93fe --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/PropertyInfos/FailureMechanismSectionAssemblyGroupsContextPropertyInfoTest.cs (.../FailureMechanismSectionAssemblyGroupsContextPropertyInfoTest.cs) (revision e3707b3ce2e92905286dd070c4eb0445d62aff94) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/PropertyInfos/FailureMechanismSectionAssemblyGroupsContextPropertyInfoTest.cs (.../FailureMechanismSectionAssemblyGroupsContextPropertyInfoTest.cs) (revision 0b522a31f55a06325a2f4ec7bf4055b12d5a93fe) @@ -62,7 +62,7 @@ { // Assert Assert.AreEqual(typeof(FailureMechanismSectionAssemblyGroupsContext), info.DataType); - Assert.AreEqual(typeof(AssemblyGroupsProperties), info.PropertyObjectType); + Assert.AreEqual(typeof(FailureMechanismSectionAssemblyGroupsProperties), info.PropertyObjectType); } [Test] @@ -90,15 +90,15 @@ IObjectProperties objectProperties = info.CreateInstance(context); // Assert - Assert.IsInstanceOf(objectProperties); + Assert.IsInstanceOf(objectProperties); - var properties = (AssemblyGroupsProperties) objectProperties; + var properties = (FailureMechanismSectionAssemblyGroupsProperties) objectProperties; Assert.AreEqual(calculator.FailureMechanismSectionAssemblyGroupBoundariesOutput.Count(), properties.FailureMechanismAssemblyGroups.Length); for (var i = 0; i < calculator.FailureMechanismSectionAssemblyGroupBoundariesOutput.Count(); i++) { FailureMechanismSectionAssemblyGroupBoundaries category = calculator.FailureMechanismSectionAssemblyGroupBoundariesOutput.ElementAt(i); - AssemblyGroupProperties property = properties.FailureMechanismAssemblyGroups[i]; + FailureMechanismSectionAssemblyGroupProperties property = properties.FailureMechanismAssemblyGroups[i]; Assert.AreEqual(DisplayFailureMechanismSectionAssemblyGroupConverter.Convert(category.Group), property.Group); Assert.AreEqual(category.UpperBoundary, property.UpperBoundary); Assert.AreEqual(category.LowerBoundary, property.LowerBoundary); Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs =================================================================== diff -u -r7cb3697fc3a68528de71e393b62e64e88da574a2 -r0b522a31f55a06325a2f4ec7bf4055b12d5a93fe --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs (.../RiskeerPluginTest.cs) (revision 7cb3697fc3a68528de71e393b62e64e88da574a2) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs (.../RiskeerPluginTest.cs) (revision 0b522a31f55a06325a2f4ec7bf4055b12d5a93fe) @@ -336,7 +336,7 @@ PluginTestHelper.AssertPropertyInfoDefined( propertyInfos, typeof(FailureMechanismSectionAssemblyGroupsContext), - typeof(AssemblyGroupsProperties)); + typeof(FailureMechanismSectionAssemblyGroupsProperties)); } }