Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r05f15dbef4e52da9f476beb11e4077df52a055d8 -r6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54 --- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 05f15dbef4e52da9f476beb11e4077df52a055d8) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54) @@ -1,4 +1,25 @@ -//------------------------------------------------------------------------------ +// Copyright (C) Stichting Deltares 2016. 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. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.34209 @@ -61,6 +82,15 @@ } /// + /// Looks up a localized string similar to Berekende waterstand. + /// + internal static string WaveConditionsOutput_WaterLevel_Description { + get { + return ResourceManager.GetString("WaveConditionsOutput_WaterLevel_Description", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Waterstand [m+NAP]. /// internal static string WaveConditionsOutput_WaterLevel_DisplayName { @@ -70,6 +100,15 @@ } /// + /// Looks up a localized string similar to Berekende golfrichting. + /// + internal static string WaveConditionsOutput_WaveAngle_Description { + get { + return ResourceManager.GetString("WaveConditionsOutput_WaveAngle_Description", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Golfrichting [°]. /// internal static string WaveConditionsOutput_WaveAngle_DisplayName { @@ -79,6 +118,15 @@ } /// + /// Looks up a localized string similar to Berekende golfhoogte. + /// + internal static string WaveConditionsOutput_WaveHeight_Description { + get { + return ResourceManager.GetString("WaveConditionsOutput_WaveHeight_Description", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Golfhoogte [m]. /// internal static string WaveConditionsOutput_WaveHeight_DisplayName { @@ -88,6 +136,15 @@ } /// + /// Looks up a localized string similar to Berekende golfperiode. + /// + internal static string WaveConditionsOutput_WavePeakPeriod_Description { + get { + return ResourceManager.GetString("WaveConditionsOutput_WavePeakPeriod_Description", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Golfperiode [s]. /// internal static string WaveConditionsOutput_WavePeakPeriod_DisplayName { Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.resx =================================================================== diff -u -r05f15dbef4e52da9f476beb11e4077df52a055d8 -r6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54 --- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.resx (.../Resources.resx) (revision 05f15dbef4e52da9f476beb11e4077df52a055d8) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.resx (.../Resources.resx) (revision 6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54) @@ -117,15 +117,27 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Berekende waterstand + Waterstand [m+NAP] + + Berekende golfrichting + Golfrichting [°] + + Berekende golfhoogte + Golfhoogte [m] + + Berekende golfperiode + Golfperiode [s] Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsOutputProperties.cs =================================================================== diff -u -r05f15dbef4e52da9f476beb11e4077df52a055d8 -r6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54 --- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsOutputProperties.cs (.../WaveConditionsOutputProperties.cs) (revision 05f15dbef4e52da9f476beb11e4077df52a055d8) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsOutputProperties.cs (.../WaveConditionsOutputProperties.cs) (revision 6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54) @@ -30,11 +30,16 @@ namespace Ringtoets.Revetment.Forms.PropertyClasses { + /// + /// ViewModel of for properties panel. + /// [TypeConverter(typeof(ExpandableObjectConverter))] public class WaveConditionsOutputProperties : ObjectProperties { [TypeConverter(typeof(NoValueRoundedDoubleConverter))] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_General")] [ResourcesDisplayName(typeof(Resources), "WaveConditionsOutput_WaterLevel_DisplayName")] + [ResourcesDescription(typeof(Resources), "WaveConditionsOutput_WaterLevel_Description")] public RoundedDouble WaterLevel { get @@ -44,7 +49,9 @@ } [TypeConverter(typeof(NoValueRoundedDoubleConverter))] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_General")] [ResourcesDisplayName(typeof(Resources), "WaveConditionsOutput_WaveHeight_DisplayName")] + [ResourcesDescription(typeof(Resources), "WaveConditionsOutput_WaveHeight_Description")] public RoundedDouble WaveHeight { get @@ -54,7 +61,9 @@ } [TypeConverter(typeof(NoValueRoundedDoubleConverter))] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_General")] [ResourcesDisplayName(typeof(Resources), "WaveConditionsOutput_WavePeakPeriod_DisplayName")] + [ResourcesDescription(typeof(Resources), "WaveConditionsOutput_WavePeakPeriod_Description")] public RoundedDouble WavePeakPeriod { get @@ -64,7 +73,9 @@ } [TypeConverter(typeof(NoValueRoundedDoubleConverter))] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_General")] [ResourcesDisplayName(typeof(Resources), "WaveConditionsOutput_WaveAngle_DisplayName")] + [ResourcesDescription(typeof(Resources), "WaveConditionsOutput_WaveAngle_Description")] public RoundedDouble WaveAngle { get Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsOutputPropertiesTest.cs =================================================================== diff -u -r05f15dbef4e52da9f476beb11e4077df52a055d8 -r6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54 --- Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsOutputPropertiesTest.cs (.../WaveConditionsOutputPropertiesTest.cs) (revision 05f15dbef4e52da9f476beb11e4077df52a055d8) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsOutputPropertiesTest.cs (.../WaveConditionsOutputPropertiesTest.cs) (revision 6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54) @@ -32,6 +32,11 @@ [TestFixture] public class WaveConditionsOutputPropertiesTest { + private const int requiredWaterLevelPropertyIndex = 0; + private const int requiredWaveHeightPropertyIndex = 1; + private const int requiredWavePeakPeriodPropertyIndex = 2; + private const int requiredWaveAnglePropertyIndex = 3; + [Test] public void GetProperties_ValidData_ReturnsExpectedValues() { @@ -63,11 +68,17 @@ const double wavePeakPeriod = 0.19435; const double waveAngle = 180.62353; + const string expectedCategory = "Algemeen"; const string expectedWaterLevelDisplayName = "Waterstand [m+NAP]"; const string expectedWaveHeightDisplayName = "Golfhoogte [m]"; const string expectedWavePeakPeriodDisplayName = "Golfperiode [s]"; const string expectedWaveAngleDisplayName = "Golfrichting [°]"; + const string expectedWaterLevelDescription = "Berekende waterstand"; + const string expectedWaveHeightDescription = "Berekende golfhoogte"; + const string expectedWavePeakPeriodDescription = "Berekende golfperiode"; + const string expectedWaveAngleDescription = "Berekende golfrichting"; + var properties = new WaveConditionsOutputProperties { Data = new WaveConditionsOutput(waterLevel, waveHeight, wavePeakPeriod, waveAngle) @@ -79,29 +90,41 @@ // Assert var propertyBag = new DynamicPropertyBag(properties); + PropertyDescriptorCollection dynamicProperties = propertyBag.GetProperties(new Attribute[] + { + new BrowsableAttribute(true) + }); + + Assert.AreEqual(4, dynamicProperties.Count); Assert.IsInstanceOf(classTypeConverter); - PropertyDescriptorCollection dynamicProperties = propertyBag.GetProperties(); - PropertyDescriptor waterLevelProperty = dynamicProperties.Find("WaterLevel", false); - PropertyDescriptor waveHeightProperty = dynamicProperties.Find("WaveHeight", false); - PropertyDescriptor wavePeakPeriodProperty = dynamicProperties.Find("WavePeakPeriod", false); - PropertyDescriptor waveAngleProperty = dynamicProperties.Find("WaveAngle", false); - + PropertyDescriptor waterLevelProperty = dynamicProperties[requiredWaterLevelPropertyIndex]; Assert.IsNotNull(waterLevelProperty); Assert.IsTrue(waterLevelProperty.IsReadOnly); + Assert.AreEqual(expectedCategory, waterLevelProperty.Category); Assert.AreEqual(expectedWaterLevelDisplayName, waterLevelProperty.DisplayName); + Assert.AreEqual(expectedWaterLevelDescription, waterLevelProperty.Description); + PropertyDescriptor waveHeightProperty = dynamicProperties[requiredWaveHeightPropertyIndex]; Assert.IsNotNull(waveHeightProperty); Assert.IsTrue(waveHeightProperty.IsReadOnly); + Assert.AreEqual(expectedCategory, waveHeightProperty.Category); Assert.AreEqual(expectedWaveHeightDisplayName, waveHeightProperty.DisplayName); - + Assert.AreEqual(expectedWaveHeightDescription, waveHeightProperty.Description); + + PropertyDescriptor wavePeakPeriodProperty = dynamicProperties[requiredWavePeakPeriodPropertyIndex]; Assert.IsNotNull(wavePeakPeriodProperty); Assert.IsTrue(wavePeakPeriodProperty.IsReadOnly); + Assert.AreEqual(expectedCategory, wavePeakPeriodProperty.Category); Assert.AreEqual(expectedWavePeakPeriodDisplayName, wavePeakPeriodProperty.DisplayName); - + Assert.AreEqual(expectedWavePeakPeriodDescription, wavePeakPeriodProperty.Description); + + PropertyDescriptor waveAngleProperty = dynamicProperties[requiredWaveAnglePropertyIndex]; Assert.IsNotNull(waveAngleProperty); Assert.IsTrue(waveAngleProperty.IsReadOnly); + Assert.AreEqual(expectedCategory, waveAngleProperty.Category); Assert.AreEqual(expectedWaveAngleDisplayName, waveAngleProperty.DisplayName); + Assert.AreEqual(expectedWaveAngleDescription, waveAngleProperty.Description); } } } \ No newline at end of file Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -rd4f6782b27a8e239562812f1482c1e8cb4843e64 -r6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54 --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d4f6782b27a8e239562812f1482c1e8cb4843e64) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54) @@ -22,7 +22,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Runtime Version:4.0.30319.34209 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -119,6 +119,24 @@ } /// + /// Looks up a localized string similar to Hydraulische randvoorwaardenlocatie. + /// + public static string StabilityStoneCoverHydraulicBoundaryLocationSelectionDialog_Location_Name { + get { + return ResourceManager.GetString("StabilityStoneCoverHydraulicBoundaryLocationSelectionDialog_Location_Name", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Gebruik. + /// + public static string StabilityStoneCoverHydraulicBoundaryLocationSelectionDialog_Select_Location { + get { + return ResourceManager.GetString("StabilityStoneCoverHydraulicBoundaryLocationSelectionDialog_Select_Location", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Ondergrens tot waaraan de bekleding loopt.. /// public static string StabilityStoneCoverWaveConditionsCalculationInput_LowerBoundaryRevetment_Description { @@ -273,38 +291,38 @@ } /// - /// Looks up a localized string similar to Blokken. + /// Looks up a localized string similar to Berekende resultaten voor blokken. /// - public static string WaveConditionsOutput_Blocks_DisplayName { + public static string StabilityStoneCoverWaveConditionsOutputProperties_Blocks_Description { get { - return ResourceManager.GetString("WaveConditionsOutput_Blocks_DisplayName", resourceCulture); + return ResourceManager.GetString("StabilityStoneCoverWaveConditionsOutputProperties_Blocks_Description", resourceCulture); } } /// - /// Looks up a localized string similar to Zuilen. + /// Looks up a localized string similar to Blokken. /// - public static string WaveConditionsOutput_Columns_DisplayName { + public static string StabilityStoneCoverWaveConditionsOutputProperties_Blocks_DisplayName { get { - return ResourceManager.GetString("WaveConditionsOutput_Columns_DisplayName", resourceCulture); + return ResourceManager.GetString("StabilityStoneCoverWaveConditionsOutputProperties_Blocks_DisplayName", resourceCulture); } } /// - /// Looks up a localized string similar to Hydraulische randvoorwaardenlocatie. + /// Looks up a localized string similar to Berekende resultaten voor zuilen. /// - public static string StabilityStoneCoverHydraulicBoundaryLocationSelectionDialog_Location_Name { + public static string StabilityStoneCoverWaveConditionsOutputProperties_Columns_Description { get { - return ResourceManager.GetString("StabilityStoneCoverHydraulicBoundaryLocationSelectionDialog_Location_Name", resourceCulture); + return ResourceManager.GetString("StabilityStoneCoverWaveConditionsOutputProperties_Columns_Description", resourceCulture); } } /// - /// Looks up a localized string similar to Gebruik. + /// Looks up a localized string similar to Zuilen. /// - public static string StabilityStoneCoverHydraulicBoundaryLocationSelectionDialog_Select_Location { + public static string StabilityStoneCoverWaveConditionsOutputProperties_Columns_DisplayName { get { - return ResourceManager.GetString("StabilityStoneCoverHydraulicBoundaryLocationSelectionDialog_Select_Location", resourceCulture); + return ResourceManager.GetString("StabilityStoneCoverWaveConditionsOutputProperties_Columns_DisplayName", resourceCulture); } } } Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Properties/Resources.resx =================================================================== diff -u -rd4f6782b27a8e239562812f1482c1e8cb4843e64 -r6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54 --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Properties/Resources.resx (.../Resources.resx) (revision d4f6782b27a8e239562812f1482c1e8cb4843e64) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Properties/Resources.resx (.../Resources.resx) (revision 6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54) @@ -178,10 +178,10 @@ Steen (blokken en zuilen) - + Blokken - + Zuilen @@ -190,4 +190,10 @@ Hydraulische randvoorwaardenlocatie + + Berekende resultaten voor blokken + + + Berekende resultaten voor zuilen + \ No newline at end of file Fisheye: Tag 6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54 refers to a dead (removed) revision in file `Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/PropertyClasses/StabilityStoneCoverWaveConditionsOutputContextProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/PropertyClasses/StabilityStoneCoverWaveConditionsOutputProperties.cs =================================================================== diff -u --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/PropertyClasses/StabilityStoneCoverWaveConditionsOutputProperties.cs (revision 0) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/PropertyClasses/StabilityStoneCoverWaveConditionsOutputProperties.cs (revision 6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54) @@ -0,0 +1,70 @@ +// Copyright (C) Stichting Deltares 2016. 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.ComponentModel; +using System.Linq; +using Core.Common.Gui.Converters; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Ringtoets.Revetment.Forms.PropertyClasses; +using Ringtoets.StabilityStoneCover.Data; +using Ringtoets.StabilityStoneCover.Forms.Properties; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.StabilityStoneCover.Forms.PropertyClasses +{ + /// + /// ViewModel of for properties panel. + /// + [TypeConverter(typeof(ExpandableObjectConverter))] + public class StabilityStoneCoverWaveConditionsOutputProperties : ObjectProperties + { + [TypeConverter(typeof(ExpandableArrayConverter))] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_Result")] + [ResourcesDisplayName(typeof(Resources), "StabilityStoneCoverWaveConditionsOutputProperties_Blocks_DisplayName")] + [ResourcesDescription(typeof(Resources), "StabilityStoneCoverWaveConditionsOutputProperties_Blocks_Description")] + public WaveConditionsOutputProperties[] Blocks + { + get + { + return data.BlocksOutput.Select(loc => new WaveConditionsOutputProperties + { + Data = loc + }).ToArray(); + } + } + + [TypeConverter(typeof(ExpandableArrayConverter))] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_Result")] + [ResourcesDisplayName(typeof(Resources), "StabilityStoneCoverWaveConditionsOutputProperties_Columns_DisplayName")] + [ResourcesDescription(typeof(Resources), "StabilityStoneCoverWaveConditionsOutputProperties_Columns_Description")] + public WaveConditionsOutputProperties[] Columns + { + get + { + return data.ColumnsOutput.Select(loc => new WaveConditionsOutputProperties + { + Data = loc + }).ToArray(); + } + } + } +} \ No newline at end of file Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Ringtoets.StabilityStoneCover.Forms.csproj =================================================================== diff -u -rf6585ba2acee5d6479f5387f40b24c796e92921b -r6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54 --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Ringtoets.StabilityStoneCover.Forms.csproj (.../Ringtoets.StabilityStoneCover.Forms.csproj) (revision f6585ba2acee5d6479f5387f40b24c796e92921b) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Ringtoets.StabilityStoneCover.Forms.csproj (.../Ringtoets.StabilityStoneCover.Forms.csproj) (revision 6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54) @@ -66,7 +66,7 @@ - + UserControl Fisheye: Tag 6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54 refers to a dead (removed) revision in file `Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PropertyClasses/StabilityStoneCoverWaveConditionsOutputContextPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PropertyClasses/StabilityStoneCoverWaveConditionsOutputPropertiesTest.cs =================================================================== diff -u --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PropertyClasses/StabilityStoneCoverWaveConditionsOutputPropertiesTest.cs (revision 0) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PropertyClasses/StabilityStoneCoverWaveConditionsOutputPropertiesTest.cs (revision 6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54) @@ -0,0 +1,145 @@ +// Copyright (C) Stichting Deltares 2016. 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.Converters; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Ringtoets.Revetment.Data; +using Ringtoets.Revetment.Forms.PropertyClasses; +using Ringtoets.StabilityStoneCover.Data; +using Ringtoets.StabilityStoneCover.Forms.PropertyClasses; + +namespace Ringtoets.StabilityStoneCover.Forms.Test.PropertyClasses +{ + [TestFixture] + public class StabilityStoneCoverWaveConditionsOutputPropertiesTest + { + private readonly int requiredBlockPropertyIndex = 0; + private readonly int requiredColumnPropertyIndex = 1; + + [Test] + public void Data_WithBlocksAndColumns_ReturnsExpectedValues() + { + // Call + var properties = new StabilityStoneCoverWaveConditionsOutputProperties(); + + //Assert + Assert.IsInstanceOf>(properties); + Assert.IsNull(properties.Data); + } + + [Test] + public void GetColumnProperties_WithData_ReturnExpectedValues() + { + // Setup + var blocksOutput = new[] + { + new WaveConditionsOutput(6, 2, 9, 4), + }; + + var columnsOutput = new[] + { + new WaveConditionsOutput(1, 0, 3, 5), + }; + + var stabilityStoneCoverWaveConditionsOutput = new StabilityStoneCoverWaveConditionsOutput(columnsOutput, blocksOutput); + + // Call + var properties = new StabilityStoneCoverWaveConditionsOutputProperties() + { + Data = stabilityStoneCoverWaveConditionsOutput + }; + + //Assert + CollectionAssert.AllItemsAreInstancesOfType(properties.Blocks, typeof(WaveConditionsOutputProperties)); + Assert.AreEqual(blocksOutput.Length, properties.Blocks.Length); + Assert.AreEqual(blocksOutput[0].WaterLevel, properties.Blocks[0].WaterLevel); + Assert.AreEqual(blocksOutput[0].WaveHeight, properties.Blocks[0].WaveHeight); + Assert.AreEqual(blocksOutput[0].WavePeakPeriod, properties.Blocks[0].WavePeakPeriod); + Assert.AreEqual(blocksOutput[0].WaveAngle, properties.Blocks[0].WaveAngle); + + CollectionAssert.AllItemsAreInstancesOfType(properties.Columns, typeof(WaveConditionsOutputProperties)); + Assert.AreEqual(columnsOutput.Length, properties.Columns.Length); + Assert.AreEqual(columnsOutput[0].WaterLevel, properties.Columns[0].WaterLevel); + Assert.AreEqual(columnsOutput[0].WaveHeight, properties.Columns[0].WaveHeight); + Assert.AreEqual(columnsOutput[0].WavePeakPeriod, properties.Columns[0].WavePeakPeriod); + Assert.AreEqual(columnsOutput[0].WaveAngle, properties.Columns[0].WaveAngle); + } + + [Test] + public void PropertyAttributes_ReturnExpectedValues() + { + // Setup + var blocksOutput = new[] + { + new WaveConditionsOutput(6, 2, 9, 4), + }; + + var columnsOutput = new[] + { + new WaveConditionsOutput(1, 0, 3, 5), + }; + + const string expectedColumnDisplayName = "Zuilen"; + const string expectedBlockDisplayName = "Blokken"; + const string expectedColumnDescription = "Berekende resultaten voor zuilen"; + const string expectedBlockDescription = "Berekende resultaten voor blokken"; + const string expectedCategory = "Resultaat"; + + var stabilityStoneCoverWaveConditionsOutput = new StabilityStoneCoverWaveConditionsOutput(columnsOutput, blocksOutput); + var properties = new StabilityStoneCoverWaveConditionsOutputProperties() + { + Data = stabilityStoneCoverWaveConditionsOutput + }; + + // Call + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + Assert.IsInstanceOf(classTypeConverter); + + // Asssert + var propertyBag = new DynamicPropertyBag(properties); + PropertyDescriptorCollection dynamicProperties = propertyBag.GetProperties(new Attribute[] + { + new BrowsableAttribute(true) + }); + + Assert.AreEqual(2, dynamicProperties.Count); + + PropertyDescriptor blocksProperty = dynamicProperties[requiredBlockPropertyIndex]; + Assert.IsNotNull(expectedBlockDisplayName); + Assert.IsTrue(blocksProperty.IsReadOnly); + Assert.IsInstanceOf(blocksProperty.Converter); + Assert.AreEqual(expectedCategory, blocksProperty.Category); + Assert.AreEqual(expectedBlockDisplayName, blocksProperty.DisplayName); + Assert.AreEqual(expectedBlockDescription, blocksProperty.Description); + + PropertyDescriptor columnsProperty = dynamicProperties[requiredColumnPropertyIndex]; + Assert.IsNotNull(columnsProperty); + Assert.IsTrue(columnsProperty.IsReadOnly); + Assert.IsInstanceOf(columnsProperty.Converter); + Assert.AreEqual(expectedCategory, columnsProperty.Category); + Assert.AreEqual(expectedColumnDisplayName, columnsProperty.DisplayName); + Assert.AreEqual(expectedColumnDescription, columnsProperty.Description); + } + } +} \ No newline at end of file Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Ringtoets.StabilityStoneCover.Forms.Test.csproj =================================================================== diff -u -rf6585ba2acee5d6479f5387f40b24c796e92921b -r6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Ringtoets.StabilityStoneCover.Forms.Test.csproj (.../Ringtoets.StabilityStoneCover.Forms.Test.csproj) (revision f6585ba2acee5d6479f5387f40b24c796e92921b) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Ringtoets.StabilityStoneCover.Forms.Test.csproj (.../Ringtoets.StabilityStoneCover.Forms.Test.csproj) (revision 6300c24a20d2bc8bf9d2e66b727d8fc8e5d2ff54) @@ -79,7 +79,7 @@ - +