Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs =================================================================== diff -u -r1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57 -r0fc08c66887f3e02384f9de25436d937461cdc0c --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 0fc08c66887f3e02384f9de25436d937461cdc0c) @@ -110,6 +110,32 @@ { CreateInstance = context => new WaveHeightCalculationProperties(context.WrappedData) }; + + yield return new PropertyInfo + { + CreateInstance = context => + { + IEnumerable>> calculationsPerCategoryBoundary = + DesignWaterLevelCalculationsGroupContextChildNodeObjects(context) + .Cast() + .Select(childContext => new Tuple>(childContext.CategoryBoundaryName, + childContext.WrappedData)); + return new DesignWaterLevelCalculationsGroupProperties(context.WrappedData, calculationsPerCategoryBoundary); + } + }; + + yield return new PropertyInfo + { + CreateInstance = context => + { + IEnumerable>> calculationsPerCategoryBoundary = + WaveHeightCalculationsGroupContextChildNodeObjects(context) + .Cast() + .Select(childContext => new Tuple>(childContext.CategoryBoundaryName, + childContext.WrappedData)); + return new WaveHeightCalculationsGroupProperties(context.WrappedData, calculationsPerCategoryBoundary); + } + }; } public override IEnumerable GetImportInfos() Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs =================================================================== diff -u -r1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57 -r0fc08c66887f3e02384f9de25436d937461cdc0c --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs (.../GrassCoverErosionOutwardsPluginTest.cs) (revision 1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs (.../GrassCoverErosionOutwardsPluginTest.cs) (revision 0fc08c66887f3e02384f9de25436d937461cdc0c) @@ -132,7 +132,7 @@ PropertyInfo[] propertyInfos = plugin.GetPropertyInfos().ToArray(); // Assert - Assert.AreEqual(7, propertyInfos.Length); + Assert.AreEqual(9, propertyInfos.Length); PluginTestHelper.AssertPropertyInfoDefined( propertyInfos, @@ -168,6 +168,16 @@ propertyInfos, typeof(GrassCoverErosionOutwardsWaveHeightCalculationContext), typeof(WaveHeightCalculationProperties)); + + PluginTestHelper.AssertPropertyInfoDefined( + propertyInfos, + typeof(GrassCoverErosionOutwardsDesignWaterLevelCalculationsGroupContext), + typeof(DesignWaterLevelCalculationsGroupProperties)); + + PluginTestHelper.AssertPropertyInfoDefined( + propertyInfos, + typeof(GrassCoverErosionOutwardsWaveHeightCalculationsGroupContext), + typeof(WaveHeightCalculationsGroupProperties)); } } Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/PropertyInfos/GrassCoverErosionOutwardsDesignWaterLevelCalculationsGroupContextPropertyInfoTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/PropertyInfos/GrassCoverErosionOutwardsDesignWaterLevelCalculationsGroupContextPropertyInfoTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/PropertyInfos/GrassCoverErosionOutwardsDesignWaterLevelCalculationsGroupContextPropertyInfoTest.cs (revision 0fc08c66887f3e02384f9de25436d937461cdc0c) @@ -0,0 +1,80 @@ +// 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.Base; +using Core.Common.Gui.Plugin; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.PropertyClasses; +using Ringtoets.GrassCoverErosionOutwards.Data; +using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; + +namespace Ringtoets.GrassCoverErosionOutwards.Plugin.Test.PropertyInfos +{ + [TestFixture] + public class GrassCoverErosionOutwardsDesignWaterLevelCalculationsGroupContextPropertyInfoTest + { + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + using (var plugin = new GrassCoverErosionOutwardsPlugin()) + { + // Call + PropertyInfo info = GetInfo(plugin); + + // Assert + Assert.AreEqual(typeof(GrassCoverErosionOutwardsDesignWaterLevelCalculationsGroupContext), info.DataType); + Assert.AreEqual(typeof(DesignWaterLevelCalculationsGroupProperties), info.PropertyObjectType); + } + } + + [Test] + public void CreateInstance_WithContext_SetsDataCorrectly() + { + // Setup + var locations = new ObservableList(); + var context = new GrassCoverErosionOutwardsDesignWaterLevelCalculationsGroupContext(locations, + new GrassCoverErosionOutwardsFailureMechanism(), + new AssessmentSectionStub()); + + using (var plugin = new GrassCoverErosionOutwardsPlugin()) + { + PropertyInfo info = GetInfo(plugin); + + // Call + IObjectProperties objectProperties = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(locations, objectProperties.Data); + } + } + + private static PropertyInfo GetInfo(GrassCoverErosionOutwardsPlugin plugin) + { + return plugin.GetPropertyInfos().First(pi => pi.DataType == typeof(GrassCoverErosionOutwardsDesignWaterLevelCalculationsGroupContext)); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/PropertyInfos/GrassCoverErosionOutwardsWaveHeightCalculationsGroupContextPropertyInfoTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/PropertyInfos/GrassCoverErosionOutwardsWaveHeightCalculationsGroupContextPropertyInfoTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/PropertyInfos/GrassCoverErosionOutwardsWaveHeightCalculationsGroupContextPropertyInfoTest.cs (revision 0fc08c66887f3e02384f9de25436d937461cdc0c) @@ -0,0 +1,80 @@ +// 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.Base; +using Core.Common.Gui.Plugin; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.PropertyClasses; +using Ringtoets.GrassCoverErosionOutwards.Data; +using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; + +namespace Ringtoets.GrassCoverErosionOutwards.Plugin.Test.PropertyInfos +{ + [TestFixture] + public class GrassCoverErosionOutwardsWaveHeightCalculationsGroupContextPropertyInfoTest + { + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + using (var plugin = new GrassCoverErosionOutwardsPlugin()) + { + // Call + PropertyInfo info = GetInfo(plugin); + + // Assert + Assert.AreEqual(typeof(GrassCoverErosionOutwardsWaveHeightCalculationsGroupContext), info.DataType); + Assert.AreEqual(typeof(WaveHeightCalculationsGroupProperties), info.PropertyObjectType); + } + } + + [Test] + public void CreateInstance_WithContext_SetsDataCorrectly() + { + // Setup + var locations = new ObservableList(); + var context = new GrassCoverErosionOutwardsWaveHeightCalculationsGroupContext(locations, + new GrassCoverErosionOutwardsFailureMechanism(), + new AssessmentSectionStub()); + + using (var plugin = new GrassCoverErosionOutwardsPlugin()) + { + PropertyInfo info = GetInfo(plugin); + + // Call + IObjectProperties objectProperties = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(locations, objectProperties.Data); + } + } + + private static PropertyInfo GetInfo(GrassCoverErosionOutwardsPlugin plugin) + { + return plugin.GetPropertyInfos().First(pi => pi.DataType == typeof(GrassCoverErosionOutwardsWaveHeightCalculationsGroupContext)); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj =================================================================== diff -u -rdf515d3faf8f4db7a4b3358ad9d69092e5e9a8e3 -r0fc08c66887f3e02384f9de25436d937461cdc0c --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj) (revision df515d3faf8f4db7a4b3358ad9d69092e5e9a8e3) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj) (revision 0fc08c66887f3e02384f9de25436d937461cdc0c) @@ -34,12 +34,14 @@ + + Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -r1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57 -r0fc08c66887f3e02384f9de25436d937461cdc0c --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 0fc08c66887f3e02384f9de25436d937461cdc0c) @@ -385,8 +385,28 @@ }; yield return new PropertyInfo { - CreateInstance = context => new DesignWaterLevelCalculationsGroupProperties(context.WrappedData) + CreateInstance = context => + { + IEnumerable>> calculationsPerCategoryBoundary = + DesignWaterLevelCalculationsGroupContextChildNodeObjects(context) + .Cast() + .Select(childContext => new Tuple>(childContext.CategoryBoundaryName, + childContext.WrappedData)); + return new DesignWaterLevelCalculationsGroupProperties(context.WrappedData, calculationsPerCategoryBoundary); + } }; + yield return new PropertyInfo + { + CreateInstance = context => + { + IEnumerable>> calculationsPerCategoryBoundary = + WaveHeightCalculationsGroupContextChildNodeObjects(context) + .Cast() + .Select(childContext => new Tuple>(childContext.CategoryBoundaryName, + childContext.WrappedData)); + return new WaveHeightCalculationsGroupProperties(context.WrappedData, calculationsPerCategoryBoundary); + } + }; } /// Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/DesignWaterLevelCalculationsGroupContextPropertyInfoTest.cs =================================================================== diff -u -r1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57 -r0fc08c66887f3e02384f9de25436d937461cdc0c --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/DesignWaterLevelCalculationsGroupContextPropertyInfoTest.cs (.../DesignWaterLevelCalculationsGroupContextPropertyInfoTest.cs) (revision 1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/DesignWaterLevelCalculationsGroupContextPropertyInfoTest.cs (.../DesignWaterLevelCalculationsGroupContextPropertyInfoTest.cs) (revision 0fc08c66887f3e02384f9de25436d937461cdc0c) @@ -24,12 +24,10 @@ using Core.Common.Gui.Plugin; using Core.Common.Gui.PropertyBag; using NUnit.Framework; -using Rhino.Mocks; -using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Common.Forms.PropertyClasses; -using Ringtoets.Integration.Forms.PropertyClasses; namespace Ringtoets.Integration.Plugin.Test.PropertyInfos { @@ -55,14 +53,9 @@ public void CreateInstance_WithContext_SetsDataCorrectly() { // Setup - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); - var locations = new ObservableList(); + var context = new DesignWaterLevelCalculationsGroupContext(locations, new AssessmentSectionStub()); - var context = new DesignWaterLevelCalculationsGroupContext(locations, assessmentSection); - using (var plugin = new RingtoetsPlugin()) { PropertyInfo info = GetInfo(plugin); @@ -74,8 +67,6 @@ Assert.IsInstanceOf(objectProperties); Assert.AreSame(locations, objectProperties.Data); } - - mockRepository.VerifyAll(); } private static PropertyInfo GetInfo(RingtoetsPlugin plugin) Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/WaveHeightCalculationsGroupContextPropertyInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/WaveHeightCalculationsGroupContextPropertyInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/WaveHeightCalculationsGroupContextPropertyInfoTest.cs (revision 0fc08c66887f3e02384f9de25436d937461cdc0c) @@ -0,0 +1,77 @@ +// 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.Base; +using Core.Common.Gui.Plugin; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Integration.Plugin.Test.PropertyInfos +{ + [TestFixture] + public class WaveHeightCalculationsGroupContextPropertyInfoTest + { + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + using (var plugin = new RingtoetsPlugin()) + { + // Call + PropertyInfo info = GetInfo(plugin); + + // Assert + Assert.AreEqual(typeof(WaveHeightCalculationsGroupContext), info.DataType); + Assert.AreEqual(typeof(WaveHeightCalculationsGroupProperties), info.PropertyObjectType); + } + } + + [Test] + public void CreateInstance_WithContext_SetsDataCorrectly() + { + // Setup + var locations = new ObservableList(); + var context = new WaveHeightCalculationsGroupContext(locations, new AssessmentSectionStub()); + + using (var plugin = new RingtoetsPlugin()) + { + PropertyInfo info = GetInfo(plugin); + + // Call + IObjectProperties objectProperties = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(locations, objectProperties.Data); + } + } + + private static PropertyInfo GetInfo(RingtoetsPlugin plugin) + { + return plugin.GetPropertyInfos().First(pi => pi.DataType == typeof(WaveHeightCalculationsGroupContext)); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj =================================================================== diff -u -rdbf85f8af33717398f517d8e1602fe58e023e369 -r0fc08c66887f3e02384f9de25436d937461cdc0c --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision dbf85f8af33717398f517d8e1602fe58e023e369) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 0fc08c66887f3e02384f9de25436d937461cdc0c) @@ -48,6 +48,7 @@ + Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs =================================================================== diff -u -rdbf85f8af33717398f517d8e1602fe58e023e369 -r0fc08c66887f3e02384f9de25436d937461cdc0c --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision dbf85f8af33717398f517d8e1602fe58e023e369) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 0fc08c66887f3e02384f9de25436d937461cdc0c) @@ -221,7 +221,7 @@ PropertyInfo[] propertyInfos = plugin.GetPropertyInfos().ToArray(); // Assert - Assert.AreEqual(25, propertyInfos.Length); + Assert.AreEqual(26, propertyInfos.Length); PluginTestHelper.AssertPropertyInfoDefined( propertyInfos, @@ -347,6 +347,11 @@ propertyInfos, typeof(DesignWaterLevelCalculationsGroupContext), typeof(DesignWaterLevelCalculationsGroupProperties)); + + PluginTestHelper.AssertPropertyInfoDefined( + propertyInfos, + typeof(WaveHeightCalculationsGroupContext), + typeof(WaveHeightCalculationsGroupProperties)); } }