Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r79f417a64ad7845136da14dc776b14503797347e -r5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 79f417a64ad7845136da14dc776b14503797347e) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f) @@ -97,7 +97,7 @@ } /// - /// Looks up a localized string similar to Beschrijving van een havendam.. + /// Looks up a localized string similar to Eigenschappen van de havendam.. /// public static string BreakWaterProperties_Description { get { @@ -197,7 +197,7 @@ } /// - /// Looks up a localized string similar to Coordinaten [m]. + /// Looks up a localized string similar to Coördinaten [m]. /// public static string DikeGeometry_Coordinates_DisplayName { get { @@ -224,7 +224,7 @@ } /// - /// Looks up a localized string similar to Beschrijving van de dijkgeometrie.. + /// Looks up a localized string similar to Eigenschappen van de dijkgeometrie.. /// public static string DikeGeometryProperties_Description { get { @@ -251,7 +251,7 @@ } /// - /// Looks up a localized string similar to Dijkhoogte. + /// Looks up a localized string similar to Dijkhoogte [m+NAP]. /// public static string DikeHeight_DisplayName { get { @@ -296,7 +296,7 @@ } /// - /// Looks up a localized string similar to Beschrijving van het voorland.. + /// Looks up a localized string similar to Eigenschappen van het voorland.. /// public static string ForeshoreProperties_Description { get { @@ -371,8 +371,80 @@ } /// - /// Looks up a localized string similar to De parameter 'N' die gebruikt wordt voor het lengte effect in berekening.. + /// Looks up a localized string similar to De parameter 'fb' die gebruikt wordt in de berekening.. /// + public static string GrassCoverErosionInwardsInput_Fb_Description { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsInput_Fb_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to fb [-]. + /// + public static string GrassCoverErosionInwardsInput_Fb_DisplayName { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsInput_Fb_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De parameter 'fn' die gebruikt wordt in de berekening.. + /// + public static string GrassCoverErosionInwardsInput_Fn_Description { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsInput_Fn_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to fn [-]. + /// + public static string GrassCoverErosionInwardsInput_Fn_DisplayName { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsInput_Fn_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De parameter 'f ondiep' die gebruikt wordt in de berekening.. + /// + public static string GrassCoverErosionInwardsInput_Fshallow_Description { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsInput_Fshallow_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to f ondiep [-]. + /// + public static string GrassCoverErosionInwardsInput_Fshallow_DisplayName { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsInput_Fshallow_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De parameter 'mz2' die gebruikt wordt in de berekening.. + /// + public static string GrassCoverErosionInwardsInput_Mz2_Description { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsInput_Mz2_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to mz2 [-]. + /// + public static string GrassCoverErosionInwardsInput_Mz2_DisplayName { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsInput_Mz2_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De parameter 'N' die gebruikt wordt voor het lengte effect in de berekening.. + /// public static string GrassCoverErosionInwardsInput_N_Description { get { return ResourceManager.GetString("GrassCoverErosionInwardsInput_N_Description", resourceCulture); Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx =================================================================== diff -u -r79f417a64ad7845136da14dc776b14503797347e -r5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 79f417a64ad7845136da14dc776b14503797347e) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f) @@ -152,7 +152,7 @@ Naam - De parameter 'N' die gebruikt wordt voor het lengte effect in berekening. + De parameter 'N' die gebruikt wordt voor het lengte effect in de berekening. N @@ -182,7 +182,7 @@ Havendam hoogte - Beschrijving van een havendam. + Eigenschappen van de havendam. Havendam @@ -200,7 +200,7 @@ Aanwezig - Beschrijving van de dijkgeometrie. + Eigenschappen van de dijkgeometrie. Dijkgeometrie @@ -209,7 +209,7 @@ Lijst met geometrie punten. - Coordinaten [m] + Coördinaten [m] Lijst met ruwheden per sectie. @@ -221,10 +221,10 @@ De hoogte van de dijk [m+NAP]. - Dijkhoogte + Dijkhoogte [m+NAP] - Beschrijving van het voorland. + Eigenschappen van het voorland. Voorland @@ -247,4 +247,28 @@ Oriëntatie [º] + + De parameter 'fb' die gebruikt wordt in de berekening. + + + fb [-] + + + De parameter 'fn' die gebruikt wordt in de berekening. + + + fn [-] + + + De parameter 'f ondiep' die gebruikt wordt in de berekening. + + + f ondiep [-] + + + De parameter 'mz2' die gebruikt wordt in de berekening. + + + mz2 [-] + \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/ForeshoreProperties.cs =================================================================== diff -u -rf04ce53e4b0000f7bb1e29220b4fbd8887a47530 -r5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/ForeshoreProperties.cs (.../ForeshoreProperties.cs) (revision f04ce53e4b0000f7bb1e29220b4fbd8887a47530) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/ForeshoreProperties.cs (.../ForeshoreProperties.cs) (revision 5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f) @@ -32,7 +32,10 @@ [TypeConverter(typeof(ExpandableObjectConverter))] public class ForeshoreProperties : ObjectProperties { - [PropertyOrder(1)] + private const int foreshorePresentPropertyIndex = 1; + private const int numberOfCoordinatesPropertyIndex = 2; + + [PropertyOrder(foreshorePresentPropertyIndex)] [ResourcesDisplayName(typeof(Resources), "Foreshore_ForeshorePresent_DisplayName")] [ResourcesDescription(typeof(Resources), "Foreshore_ForeshorePresent_Discription")] public bool ForeshorePresent @@ -48,7 +51,7 @@ } } - [PropertyOrder(2)] + [PropertyOrder(numberOfCoordinatesPropertyIndex)] [ResourcesDisplayName(typeof(Resources), "Foreshore_NumberOfCoordinates_DisplayName")] [ResourcesDescription(typeof(Resources), "Foreshore_NumberOfCoordinates_Discription")] public int NumberOfCoordinates Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsCalculationContextProperties.cs =================================================================== diff -u -r79f417a64ad7845136da14dc776b14503797347e -r5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsCalculationContextProperties.cs (.../GrassCoverErosionInwardsCalculationContextProperties.cs) (revision 79f417a64ad7845136da14dc776b14503797347e) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsCalculationContextProperties.cs (.../GrassCoverErosionInwardsCalculationContextProperties.cs) (revision 5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f) @@ -34,7 +34,13 @@ /// public class GrassCoverErosionInwardsCalculationContextProperties : ObjectProperties { - [PropertyOrder(1)] + private const int dikeGeometryPropertyIndex = 1; + private const int dikeHeightPropertyIndex = 2; + private const int foreshorePropertyIndex = 3; + private const int orientationPropertyIndex = 4; + private const int breakWaterPropertyIndex = 5; + + [PropertyOrder(dikeGeometryPropertyIndex)] [ResourcesCategory(typeof(Resources), "Categories_Schematisation")] [ResourcesDisplayName(typeof(Resources), "DikeGeometryProperties_DisplayName")] [ResourcesDescription(typeof(Resources), "DikeGeometryProperties_Description")] @@ -49,7 +55,7 @@ } } - [PropertyOrder(2)] + [PropertyOrder(dikeHeightPropertyIndex)] [ResourcesCategory(typeof(Resources), "Categories_Schematisation")] [ResourcesDisplayName(typeof(Resources), "DikeHeight_DisplayName")] [ResourcesDescription(typeof(Resources), "DikeHeight_Description")] @@ -66,7 +72,7 @@ } } - [PropertyOrder(3)] + [PropertyOrder(foreshorePropertyIndex)] [ResourcesCategory(typeof(Resources), "Categories_Schematisation")] [ResourcesDisplayName(typeof(Resources), "ForeshoreProperties_DisplayName")] [ResourcesDescription(typeof(Resources), "ForeshoreProperties_Description")] @@ -81,7 +87,7 @@ } } - [PropertyOrder(4)] + [PropertyOrder(orientationPropertyIndex)] [ResourcesCategory(typeof(Resources), "Categories_Schematisation")] [ResourcesDisplayName(typeof(Resources), "Orientation_DisplayName")] [ResourcesDescription(typeof(Resources), "Orientation_Description")] @@ -98,7 +104,7 @@ } } - [PropertyOrder(5)] + [PropertyOrder(breakWaterPropertyIndex)] [ResourcesCategory(typeof(Resources), "Categories_Schematisation")] [ResourcesDisplayName(typeof(Resources), "BreakWaterProperties_DisplayName")] [ResourcesDescription(typeof(Resources), "BreakWaterProperties_Description")] Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextProperties.cs =================================================================== diff -u -r0a3c7987645ee1993be6c16b26125355994ab1ff -r5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextProperties.cs (.../GrassCoverErosionInwardsFailureMechanismContextProperties.cs) (revision 0a3c7987645ee1993be6c16b26125355994ab1ff) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextProperties.cs (.../GrassCoverErosionInwardsFailureMechanismContextProperties.cs) (revision 5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f) @@ -22,6 +22,7 @@ using Core.Common.Gui.Attributes; using Core.Common.Gui.PropertyBag; using Core.Common.Utils.Attributes; +using Ringtoets.Common.Data.Probabilistics; using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects; using Ringtoets.GrassCoverErosionInwards.Forms.Properties; @@ -32,9 +33,17 @@ /// public class GrassCoverErosionInwardsFailureMechanismContextProperties : ObjectProperties { + private const int namePropertyIndex = 1; + private const int codePropertyIndex = 2; + private const int lengthEffectPropertyIndex = 3; + private const int mz2PropertyIndex = 4; + private const int fbPropertyIndex = 5; + private const int fnPropertyIndex = 6; + private const int fshallowPropertyIndex = 7; + #region Lengte effect parameters - [PropertyOrder(3)] + [PropertyOrder(lengthEffectPropertyIndex)] [ResourcesCategory(typeof(Resources), "Categories_LengthEffect")] [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionInwardsInput_N_DisplayName")] [ResourcesDescription(typeof(Resources), "GrassCoverErosionInwardsInput_N_Description")] @@ -55,7 +64,7 @@ #region General - [PropertyOrder(1)] + [PropertyOrder(namePropertyIndex)] [ResourcesCategory(typeof(Resources), "Categories_General")] [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionInwardsInput_Name_DisplayName")] [ResourcesDescription(typeof(Resources), "GrassCoverErosionInwardsInput_Name_Description")] @@ -67,7 +76,7 @@ } } - [PropertyOrder(2)] + [PropertyOrder(codePropertyIndex)] [ResourcesCategory(typeof(Resources), "Categories_General")] [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionInwardsInput_Code_DisplayName")] [ResourcesDescription(typeof(Resources), "GrassCoverErosionInwardsInput_Code_Description")] @@ -80,5 +89,57 @@ } #endregion + + #region Model settings + + [PropertyOrder(mz2PropertyIndex)] + [ResourcesCategory(typeof(Resources), "Categories_ModelSettings")] + [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionInwardsInput_Mz2_DisplayName")] + [ResourcesDescription(typeof(Resources), "GrassCoverErosionInwardsInput_Mz2_Description")] + public NormalDistribution Mz2 + { + get + { + return data.WrappedData.GeneralInput.Mz2; + } + } + + [PropertyOrder(fbPropertyIndex)] + [ResourcesCategory(typeof(Resources), "Categories_ModelSettings")] + [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionInwardsInput_Fb_DisplayName")] + [ResourcesDescription(typeof(Resources), "GrassCoverErosionInwardsInput_Fb_Description")] + public NormalDistribution Fb + { + get + { + return data.WrappedData.GeneralInput.Fb; + } + } + + [PropertyOrder(fnPropertyIndex)] + [ResourcesCategory(typeof(Resources), "Categories_ModelSettings")] + [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionInwardsInput_Fn_DisplayName")] + [ResourcesDescription(typeof(Resources), "GrassCoverErosionInwardsInput_Fn_Description")] + public NormalDistribution Fn + { + get + { + return data.WrappedData.GeneralInput.Fn; + } + } + + [PropertyOrder(fshallowPropertyIndex)] + [ResourcesCategory(typeof(Resources), "Categories_ModelSettings")] + [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionInwardsInput_Fshallow_DisplayName")] + [ResourcesDescription(typeof(Resources), "GrassCoverErosionInwardsInput_Fshallow_Description")] + public NormalDistribution Fshallow + { + get + { + return data.WrappedData.GeneralInput.Fshallow; + } + } + + #endregion } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DikeGeometryPropertiesTest.cs =================================================================== diff -u -r392c4a63ebfaee062d8dc611ecf41881ac1fe3a5 -r5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DikeGeometryPropertiesTest.cs (.../DikeGeometryPropertiesTest.cs) (revision 392c4a63ebfaee062d8dc611ecf41881ac1fe3a5) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DikeGeometryPropertiesTest.cs (.../DikeGeometryPropertiesTest.cs) (revision 5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f) @@ -20,6 +20,7 @@ // All rights reserved. using System.Collections.Generic; +using System.ComponentModel; using System.Globalization; using System.Linq; using Core.Common.Base.Data; @@ -80,6 +81,46 @@ mockRepository.VerifyAll(); } + [Test] + public void PropertyAttributes_ReturnExpectedValues() + { + // Setup + var assessmentSectionMock = mockRepository.StrictMock(); + var failureMechanismMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + var calculation = new GrassCoverErosionInwardsCalculation(new GeneralGrassCoverErosionInwardsInput()); + + // Call + var properties = new DikeGeometryProperties + { + Data = new GrassCoverErosionInwardsCalculationContext(calculation, failureMechanismMock, assessmentSectionMock) + }; + + // Assert + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + Assert.IsInstanceOf(classTypeConverter); + + var dynamicPropertyBag = new DynamicPropertyBag(properties); + PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); + Assert.AreEqual(3, dynamicProperties.Count); + + PropertyDescriptor coordinatesProperty = dynamicProperties[coordinatesPropertyIndex]; + Assert.IsNotNull(coordinatesProperty); + Assert.IsTrue(coordinatesProperty.IsReadOnly); + Assert.AreEqual("Coördinaten [m]", coordinatesProperty.DisplayName); + Assert.AreEqual("Lijst met geometrie punten.", coordinatesProperty.Description); + + PropertyDescriptor numberOfCoordinatesDikeHeightProperty = dynamicProperties[numberOfCoordinatesDikeHeightPropertyIndex]; + Assert.IsNotNull(numberOfCoordinatesDikeHeightProperty); + Assert.IsTrue(numberOfCoordinatesDikeHeightProperty.IsReadOnly); + Assert.AreEqual("Ruwheden [-]", numberOfCoordinatesDikeHeightProperty.DisplayName); + Assert.AreEqual("Lijst met ruwheden per sectie.", numberOfCoordinatesDikeHeightProperty.Description); + } + + private const int coordinatesPropertyIndex = 0; + private const int numberOfCoordinatesDikeHeightPropertyIndex = 1; + private static IEnumerable GetRoughness(GrassCoverErosionInwardsCalculation calculation) { var roughnesses = calculation.InputParameters.DikeGeometry.Select(d => d.Roughness); Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/ForeshorePropertiesTest.cs =================================================================== diff -u -r392c4a63ebfaee062d8dc611ecf41881ac1fe3a5 -r5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/ForeshorePropertiesTest.cs (.../ForeshorePropertiesTest.cs) (revision 392c4a63ebfaee062d8dc611ecf41881ac1fe3a5) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/ForeshorePropertiesTest.cs (.../ForeshorePropertiesTest.cs) (revision 5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.ComponentModel; using Core.Common.Base; using Core.Common.Gui.PropertyBag; using NUnit.Framework; @@ -99,5 +100,45 @@ Assert.IsFalse(calculation.InputParameters.UseForeshore); mockRepository.VerifyAll(); } + + [Test] + public void PropertyAttributes_ReturnExpectedValues() + { + // Setup + var assessmentSectionMock = mockRepository.StrictMock(); + var failureMechanismMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + var calculation = new GrassCoverErosionInwardsCalculation(new GeneralGrassCoverErosionInwardsInput()); + + // Call + var properties = new ForeshoreProperties + { + Data = new GrassCoverErosionInwardsCalculationContext(calculation, failureMechanismMock, assessmentSectionMock) + }; + + // Assert + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + Assert.IsInstanceOf(classTypeConverter); + + var dynamicPropertyBag = new DynamicPropertyBag(properties); + PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); + Assert.AreEqual(3, dynamicProperties.Count); + + PropertyDescriptor foreshorePresentProperty = dynamicProperties[foreshorePresentPropertyIndex]; + Assert.IsNotNull(foreshorePresentProperty); + Assert.IsFalse(foreshorePresentProperty.IsReadOnly); + Assert.AreEqual("Aanwezig", foreshorePresentProperty.DisplayName); + Assert.AreEqual("Is er een voorland aanwezig?", foreshorePresentProperty.Description); + + PropertyDescriptor numberOfCoordinatesProperty = dynamicProperties[ForeshorePropertiesTest.numberOfCoordinatesDikeHeightProperty]; + Assert.IsNotNull(numberOfCoordinatesProperty); + Assert.IsTrue(numberOfCoordinatesProperty.IsReadOnly); + Assert.AreEqual("Aantal", numberOfCoordinatesProperty.DisplayName); + Assert.AreEqual("Aantal coordinaten tot de teen van de dijk.", numberOfCoordinatesProperty.Description); + } + + private const int foreshorePresentPropertyIndex = 0; + private const int numberOfCoordinatesDikeHeightProperty = 1; } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsCalculationContextPropertiesTest.cs =================================================================== diff -u -r392c4a63ebfaee062d8dc611ecf41881ac1fe3a5 -r5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsCalculationContextPropertiesTest.cs (.../GrassCoverErosionInwardsCalculationContextPropertiesTest.cs) (revision 392c4a63ebfaee062d8dc611ecf41881ac1fe3a5) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsCalculationContextPropertiesTest.cs (.../GrassCoverErosionInwardsCalculationContextPropertiesTest.cs) (revision 5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.ComponentModel; using System.Globalization; using Core.Common.Base; using Core.Common.Base.Data; @@ -130,5 +131,63 @@ Assert.AreEqual(newOrientation, calculation.InputParameters.Orientation); mockRepository.VerifyAll(); } + + [Test] + public void PropertyAttributes_ReturnExpectedValues() + { + // Setup + var assessmentSectionMock = mockRepository.StrictMock(); + var failureMechanismMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + var calculation = new GrassCoverErosionInwardsCalculation(new GeneralGrassCoverErosionInwardsInput()); + + // Call + var properties = new GrassCoverErosionInwardsCalculationContextProperties + { + Data = new GrassCoverErosionInwardsCalculationContext(calculation, failureMechanismMock, assessmentSectionMock) + }; + + // Assert + var dynamicPropertyBag = new DynamicPropertyBag(properties); + PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); + Assert.AreEqual(6, dynamicProperties.Count); + + PropertyDescriptor dikeGeometryProperty = dynamicProperties[dikeGeometryPropertyIndex]; + Assert.IsNotNull(dikeGeometryProperty); + Assert.IsTrue(dikeGeometryProperty.IsReadOnly); + Assert.AreEqual("Dijkgeometrie", dikeGeometryProperty.DisplayName); + Assert.AreEqual("Eigenschappen van de dijkgeometrie.", dikeGeometryProperty.Description); + + PropertyDescriptor dikeHeightProperty = dynamicProperties[dikeHeightPropertyIndex]; + Assert.IsNotNull(dikeHeightProperty); + Assert.IsFalse(dikeHeightProperty.IsReadOnly); + Assert.AreEqual("Dijkhoogte [m+NAP]", dikeHeightProperty.DisplayName); + Assert.AreEqual("De hoogte van de dijk [m+NAP].", dikeHeightProperty.Description); + + PropertyDescriptor foreshoreProperty = dynamicProperties[foreshorePropertyIndex]; + Assert.IsNotNull(foreshoreProperty); + Assert.IsTrue(foreshoreProperty.IsReadOnly); + Assert.AreEqual("Voorland", foreshoreProperty.DisplayName); + Assert.AreEqual("Eigenschappen van het voorland.", foreshoreProperty.Description); + + PropertyDescriptor orientationProperty = dynamicProperties[orientationPropertyIndex]; + Assert.IsNotNull(orientationProperty); + Assert.IsFalse(orientationProperty.IsReadOnly); + Assert.AreEqual("Oriëntatie [º]", orientationProperty.DisplayName); + Assert.AreEqual("Oriëntatie van de dijk.", orientationProperty.Description); + + PropertyDescriptor breakWaterProperty = dynamicProperties[breakWaterPropertyIndex]; + Assert.IsNotNull(breakWaterProperty); + Assert.IsTrue(breakWaterProperty.IsReadOnly); + Assert.AreEqual("Havendam", breakWaterProperty.DisplayName); + Assert.AreEqual("Eigenschappen van de havendam.", breakWaterProperty.Description); + } + + private const int dikeGeometryPropertyIndex = 0; + private const int dikeHeightPropertyIndex = 1; + private const int foreshorePropertyIndex = 2; + private const int orientationPropertyIndex = 3; + private const int breakWaterPropertyIndex = 4; } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs =================================================================== diff -u -r79f417a64ad7845136da14dc776b14503797347e -r5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs) (revision 79f417a64ad7845136da14dc776b14503797347e) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs) (revision 5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.ComponentModel; using Core.Common.Base; using Core.Common.Gui.PropertyBag; using NUnit.Framework; @@ -34,6 +35,14 @@ [TestFixture] public class GrassCoverErosionInwardsFailureMechanismContextPropertiesTest { + private MockRepository mockRepository; + + [SetUp] + public void SetUp() + { + mockRepository = new MockRepository(); + } + [Test] public void Constructor_ExpectedValues() { @@ -49,7 +58,6 @@ public void Data_SetNewFailureMechanismContextInstance_ReturnCorrectPropertyValues() { // Setup - var mockRepository = new MockRepository(); var assessmentSectionMock = mockRepository.StrictMock(); mockRepository.ReplayAll(); @@ -70,7 +78,6 @@ public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers() { // Setup - var mockRepository = new MockRepository(); var observerMock = mockRepository.StrictMock(); int numberProperties = 1; observerMock.Expect(o => o.UpdateObserver()).Repeat.Times(numberProperties); @@ -92,5 +99,76 @@ Assert.AreEqual(newLengthEffect, failureMechanism.NormProbabilityInput.N); mockRepository.VerifyAll(); } + + [Test] + public void PropertyAttributes_ReturnExpectedValues() + { + // Setup + var assessmentSectionMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); + + // Call + var properties = new GrassCoverErosionInwardsFailureMechanismContextProperties + { + Data = new GrassCoverErosionInwardsFailureMechanismContext(failureMechanism, assessmentSectionMock) + }; + + // Assert + var dynamicPropertyBag = new DynamicPropertyBag(properties); + PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); + Assert.AreEqual(8, dynamicProperties.Count); + + PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex]; + Assert.IsNotNull(nameProperty); + Assert.IsTrue(nameProperty.IsReadOnly); + Assert.AreEqual("Naam", nameProperty.DisplayName); + Assert.AreEqual("De naam van het toetsspoor.", nameProperty.Description); + + PropertyDescriptor codeProperty = dynamicProperties[codePropertyIndex]; + Assert.IsNotNull(codeProperty); + Assert.IsTrue(codeProperty.IsReadOnly); + Assert.AreEqual("Label", codeProperty.DisplayName); + Assert.AreEqual("Het label van het toetsspoor.", codeProperty.Description); + + PropertyDescriptor lengthEffectProperty = dynamicProperties[lengthEffectPropertyIndex]; + Assert.IsNotNull(lengthEffectProperty); + Assert.IsFalse(lengthEffectProperty.IsReadOnly); + Assert.AreEqual("N", lengthEffectProperty.DisplayName); + Assert.AreEqual("De parameter 'N' die gebruikt wordt voor het lengte effect in de berekening.", lengthEffectProperty.Description); + + PropertyDescriptor mz2Property = dynamicProperties[mz2PropertyIndex]; + Assert.IsNotNull(mz2Property); + Assert.IsTrue(mz2Property.IsReadOnly); + Assert.AreEqual("mz2 [-]", mz2Property.DisplayName); + Assert.AreEqual("De parameter 'mz2' die gebruikt wordt in de berekening.", mz2Property.Description); + + PropertyDescriptor fbProperty = dynamicProperties[fbPropertyIndex]; + Assert.IsNotNull(fbProperty); + Assert.IsTrue(fbProperty.IsReadOnly); + Assert.AreEqual("fb [-]", fbProperty.DisplayName); + Assert.AreEqual("De parameter 'fb' die gebruikt wordt in de berekening.", fbProperty.Description); + + PropertyDescriptor fnProperty = dynamicProperties[fnPropertyIndex]; + Assert.IsNotNull(fnProperty); + Assert.IsTrue(fnProperty.IsReadOnly); + Assert.AreEqual("fn [-]", fnProperty.DisplayName); + Assert.AreEqual("De parameter 'fn' die gebruikt wordt in de berekening.", fnProperty.Description); + + PropertyDescriptor fshallowProperty = dynamicProperties[fshallowPropertyIndex]; + Assert.IsNotNull(fshallowProperty); + Assert.IsTrue(fshallowProperty.IsReadOnly); + Assert.AreEqual("f ondiep [-]", fshallowProperty.DisplayName); + Assert.AreEqual("De parameter 'f ondiep' die gebruikt wordt in de berekening.", fshallowProperty.Description); + } + + private const int namePropertyIndex = 0; + private const int codePropertyIndex = 1; + private const int lengthEffectPropertyIndex = 2; + private const int mz2PropertyIndex = 3; + private const int fbPropertyIndex = 4; + private const int fnPropertyIndex = 5; + private const int fshallowPropertyIndex = 6; } } \ No newline at end of file