Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r1e9ee6964df3301ff52ce5a5c464228a7e407327 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1e9ee6964df3301ff52ce5a5c464228a7e407327) @@ -2267,6 +2267,15 @@ } /// + /// Looks up a localized string similar to De locatie van het bestand waaruit de kunstwerken zijn geïmporteerd.. + /// + public static string StructureCollection_SourcePath_Description { + get { + return ResourceManager.GetString("StructureCollection_SourcePath_Description", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Kunstwerken. /// public static string StructuresCollection_DisplayName { Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx =================================================================== diff -u -r2fbb7b54b29f25f69c4c53cdb40f3704dccf5620 -r1e9ee6964df3301ff52ce5a5c464228a7e407327 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 2fbb7b54b29f25f69c4c53cdb40f3704dccf5620) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 1e9ee6964df3301ff52ce5a5c464228a7e407327) @@ -932,4 +932,7 @@ Er zijn geen berekeningen om bij te werken. + + De locatie van het bestand waaruit de kunstwerken zijn geïmporteerd. + \ No newline at end of file Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructureCollectionProperties.cs =================================================================== diff -u --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructureCollectionProperties.cs (revision 0) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructureCollectionProperties.cs (revision 1e9ee6964df3301ff52ce5a5c464228a7e407327) @@ -0,0 +1,62 @@ +// 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 Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Ringtoets.Common.Data; +using Ringtoets.HeightStructures.Data; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.HeightStructures.Forms.PropertyClasses +{ + /// + /// ViewModel of for properties panel. + /// + public class HeightStructureCollectionProperties : ObjectProperties> + { + /// + /// Instantiates a . + /// + /// The collection for which the properties are shown. + /// Thrown when + /// is null. + public HeightStructureCollectionProperties(StructureCollection collection) + { + if (collection == null) + { + throw new ArgumentNullException(nameof(collection)); + } + data = collection; + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ObservableCollectionWithSourcePath_SourcePath_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.StructureCollection_SourcePath_Description))] + public string SourcePath + { + get + { + return data.SourcePath; + } + } + } +} \ No newline at end of file Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj =================================================================== diff -u -r570695e818fcf887563710ad6d26df301be56227 -r1e9ee6964df3301ff52ce5a5c464228a7e407327 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj (.../Ringtoets.HeightStructures.Forms.csproj) (revision 570695e818fcf887563710ad6d26df301be56227) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj (.../Ringtoets.HeightStructures.Forms.csproj) (revision 1e9ee6964df3301ff52ce5a5c464228a7e407327) @@ -48,6 +48,7 @@ + Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs =================================================================== diff -u -r20e9bfea15dfe132ee137283a9f24bc4c413ce4a -r1e9ee6964df3301ff52ce5a5c464228a7e407327 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision 20e9bfea15dfe132ee137283a9f24bc4c413ce4a) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision 1e9ee6964df3301ff52ce5a5c464228a7e407327) @@ -72,6 +72,10 @@ new FailureMechanismPropertyChangeHandler()) }; yield return new PropertyInfo(); + yield return new PropertyInfo + { + CreateInstance = context => new HeightStructureCollectionProperties(context.WrappedData) + }; yield return new PropertyInfo { CreateInstance = context => new HeightStructuresInputContextProperties( Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructureCollectionPropertiesTest.cs =================================================================== diff -u --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructureCollectionPropertiesTest.cs (revision 0) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructureCollectionPropertiesTest.cs (revision 1e9ee6964df3301ff52ce5a5c464228a7e407327) @@ -0,0 +1,87 @@ +// 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 System.Linq; +using Core.Common.Gui.PropertyBag; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Data; +using Ringtoets.HeightStructures.Data; +using Ringtoets.HeightStructures.Forms.PropertyClasses; + +namespace Ringtoets.HeightStructures.Forms.Test.PropertyClasses +{ + [TestFixture] + public class HeightStructureCollectionPropertiesTest + { + [Test] + public void Constructor_WithoutCollection_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new HeightStructureCollectionProperties(null); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("collection", paramName); + } + + [Test] + public void Constructor_WithData_ReturnExpectedValues() + { + // Setup + const string someFilePath = "location/to/a/file"; + var collection = new StructureCollection(); + collection.AddRange(Enumerable.Empty(), someFilePath); + + // Call + var properties = new HeightStructureCollectionProperties(collection); + + // Assert + Assert.IsInstanceOf>>(properties); + Assert.AreSame(collection, properties.Data); + Assert.AreEqual(someFilePath, properties.SourcePath); + } + + [Test] + public void Constructor_WithData_PropertiesHaveExpectedAttributesValues() + { + // Setup + var collection = new StructureCollection(); + + // Call + var properties = new HeightStructureCollectionProperties(collection); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(1, dynamicProperties.Count); + + PropertyDescriptor heightStructureCollectionSourcePathProperty = dynamicProperties[0]; + Assert.IsNotNull(heightStructureCollectionSourcePathProperty); + Assert.IsTrue(heightStructureCollectionSourcePathProperty.IsReadOnly); + Assert.AreEqual("Algemeen", heightStructureCollectionSourcePathProperty.Category); + Assert.AreEqual("Bronlocatie", heightStructureCollectionSourcePathProperty.DisplayName); + Assert.AreEqual("De locatie van het bestand waaruit de kunstwerken zijn geïmporteerd.", + heightStructureCollectionSourcePathProperty.Description); + } + } +} \ No newline at end of file Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj =================================================================== diff -u -r08b3bcba439831d547684b194ecdf903f2519700 -r1e9ee6964df3301ff52ce5a5c464228a7e407327 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj (.../Ringtoets.HeightStructures.Forms.Test.csproj) (revision 08b3bcba439831d547684b194ecdf903f2519700) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj (.../Ringtoets.HeightStructures.Forms.Test.csproj) (revision 1e9ee6964df3301ff52ce5a5c464228a7e407327) @@ -64,6 +64,7 @@ + @@ -93,11 +94,6 @@ {30e4c2ae-719e-4d70-9fa9-668a9767fbfa} Core.Common.Gui - - {f49bd8b2-332a-4c91-a196-8cce0a2c7d98} - Core.Common.Utils - True - {D749EE4C-CE50-4C17-BF01-9A953028C126} Core.Common.TestUtil Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/HeightStructuresPluginTest.cs =================================================================== diff -u -r4bf59bb3506b840b284efe0c0f4431b7876e0e5b -r1e9ee6964df3301ff52ce5a5c464228a7e407327 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/HeightStructuresPluginTest.cs (.../HeightStructuresPluginTest.cs) (revision 4bf59bb3506b840b284efe0c0f4431b7876e0e5b) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/HeightStructuresPluginTest.cs (.../HeightStructuresPluginTest.cs) (revision 1e9ee6964df3301ff52ce5a5c464228a7e407327) @@ -58,7 +58,7 @@ PropertyInfo[] propertyInfos = plugin.GetPropertyInfos().ToArray(); // Assert - Assert.AreEqual(3, propertyInfos.Length); + Assert.AreEqual(4, propertyInfos.Length); PluginTestHelper.AssertPropertyInfoDefined( propertyInfos, @@ -72,6 +72,11 @@ PluginTestHelper.AssertPropertyInfoDefined( propertyInfos, + typeof(HeightStructuresContext), + typeof(HeightStructureCollectionProperties)); + + PluginTestHelper.AssertPropertyInfoDefined( + propertyInfos, typeof(HeightStructuresInputContext), typeof(HeightStructuresInputContextProperties)); } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/PropertyInfos/HeightStructureCollectionPropertyInfoTest.cs =================================================================== diff -u --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/PropertyInfos/HeightStructureCollectionPropertyInfoTest.cs (revision 0) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/PropertyInfos/HeightStructureCollectionPropertyInfoTest.cs (revision 1e9ee6964df3301ff52ce5a5c464228a7e407327) @@ -0,0 +1,85 @@ +// 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.Linq; +using Core.Common.Gui.Plugin; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.HeightStructures.Data; +using Ringtoets.HeightStructures.Forms.PresentationObjects; +using Ringtoets.HeightStructures.Forms.PropertyClasses; + +namespace Ringtoets.HeightStructures.Plugin.Test.PropertyInfos +{ + [TestFixture] + public class HeightStructureCollectionPropertyInfoTest + { + private HeightStructuresPlugin plugin; + private PropertyInfo info; + + [SetUp] + public void SetUp() + { + plugin = new HeightStructuresPlugin(); + info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(HeightStructureCollectionProperties)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(HeightStructuresContext), info.DataType); + Assert.AreEqual(typeof(HeightStructureCollectionProperties), info.PropertyObjectType); + } + + [Test] + public void CreateInstance_Always_NewPropertiesWithContextAsData() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new HeightStructuresFailureMechanism(); + + var collection = new StructureCollection(); + var context = new HeightStructuresContext(collection, failureMechanism, assessmentSection); + + // Call + IObjectProperties objectProperties = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(collection, objectProperties.Data); + + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/Ringtoets.HeightStructures.Plugin.Test.csproj =================================================================== diff -u -ra70cb733eb761229173777b9f6cd1b977830b24b -r1e9ee6964df3301ff52ce5a5c464228a7e407327 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/Ringtoets.HeightStructures.Plugin.Test.csproj (.../Ringtoets.HeightStructures.Plugin.Test.csproj) (revision a70cb733eb761229173777b9f6cd1b977830b24b) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/Ringtoets.HeightStructures.Plugin.Test.csproj (.../Ringtoets.HeightStructures.Plugin.Test.csproj) (revision 1e9ee6964df3301ff52ce5a5c464228a7e407327) @@ -62,6 +62,7 @@ +