Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -rc6719f7c61c39cbeda54d041a604c98cc4a83970 -re0797d05e1922d42790cc9f5eb41b923c23f763c --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision c6719f7c61c39cbeda54d041a604c98cc4a83970) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision e0797d05e1922d42790cc9f5eb41b923c23f763c) @@ -1191,6 +1191,24 @@ } /// + /// Looks up a localized string similar to Het aantal tangentlijnen dat bepaald moet worden.. + /// + public static string TangentLineNumber_Description { + get { + return ResourceManager.GetString("TangentLineNumber_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Aantal tangentlijnen. + /// + public static string TangentLineNumber_DisplayName { + get { + return ResourceManager.GetString("TangentLineNumber_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Verticale coördinaat van de onderste raaklijn.. /// public static string TangentLineZBottom_Description { Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx =================================================================== diff -u -rc6719f7c61c39cbeda54d041a604c98cc4a83970 -re0797d05e1922d42790cc9f5eb41b923c23f763c --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision c6719f7c61c39cbeda54d041a604c98cc4a83970) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision e0797d05e1922d42790cc9f5eb41b923c23f763c) @@ -466,6 +466,12 @@ Tangentlijn Z-boven [m+NAP] + + Het aantal tangentlijnen dat bepaald moet worden. + + + Aantal tangentlijnen + Horizontale coördinaat van de linker kant van het rekengrid. Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsGridSettingsProperties.cs =================================================================== diff -u -r80453e2dd117acdee9dd3f57a4374516b828c1ea -re0797d05e1922d42790cc9f5eb41b923c23f763c --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsGridSettingsProperties.cs (.../MacroStabilityInwardsGridSettingsProperties.cs) (revision 80453e2dd117acdee9dd3f57a4374516b828c1ea) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsGridSettingsProperties.cs (.../MacroStabilityInwardsGridSettingsProperties.cs) (revision e0797d05e1922d42790cc9f5eb41b923c23f763c) @@ -44,8 +44,9 @@ private const int tangentLineDeterminationTypePropertyIndex = 3; private const int tangentLineZTopPropertyIndex = 4; private const int tangentLineZBottomPropertyIndex = 5; - private const int leftGridPropertyIndex = 6; - private const int rightGridPropertyIndex = 7; + private const int tangentLineNumberPropertyIndex = 6; + private const int leftGridPropertyIndex = 7; + private const int rightGridPropertyIndex = 8; private readonly IObservablePropertyChangeHandler propertyChangeHandler; @@ -154,6 +155,23 @@ } } + [PropertyOrder(tangentLineNumberPropertyIndex)] + [DynamicReadOnly] + [ResourcesCategory(typeof(Resources), nameof(Resources.GridSettings_DisplayName))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.TangentLineNumber_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.TangentLineNumber_Description))] + public int TangentLineNumber + { + get + { + return data.TangentLineNumber; + } + set + { + PropertyChangeHelper.ChangePropertyAndNotify(() => data.TangentLineNumber = value, propertyChangeHandler); + } + } + [PropertyOrder(leftGridPropertyIndex)] [ResourcesCategory(typeof(Resources), nameof(Resources.GridSettings_DisplayName))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.LeftGrid_DisplayName))] @@ -183,7 +201,7 @@ [DynamicReadOnlyValidationMethod] public bool DynamicReadOnlyValidationMethod(string propertyName) { - if (propertyName == nameof(TangentLineZTop) || propertyName == nameof(TangentLineZBottom)) + if (propertyName == nameof(TangentLineZTop) || propertyName == nameof(TangentLineZBottom) || propertyName == nameof(TangentLineNumber)) { return data.TangentLineDeterminationType == MacroStabilityInwardsTangentLineDeterminationType.LayerSeparated || AreGridSettingsReadOnly(); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsGridSettingsPropertiesTest.cs =================================================================== diff -u -r55f1926dba5945d7b2ef8adabb2ba3c8ad6c21ce -re0797d05e1922d42790cc9f5eb41b923c23f763c --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsGridSettingsPropertiesTest.cs (.../MacroStabilityInwardsGridSettingsPropertiesTest.cs) (revision 55f1926dba5945d7b2ef8adabb2ba3c8ad6c21ce) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsGridSettingsPropertiesTest.cs (.../MacroStabilityInwardsGridSettingsPropertiesTest.cs) (revision e0797d05e1922d42790cc9f5eb41b923c23f763c) @@ -45,8 +45,9 @@ private const int expectedTangentLineDeterminationTypePropertyIndex = 2; private const int expectedTangentLineZTopPropertyIndex = 3; private const int expectedTangentLineZBottomPropertyIndex = 4; - private const int expectedLeftGridPropertyIndex = 5; - private const int expectedRightGridPropertyIndex = 6; + private const int expectedTangentLineNumberPropertyIndex = 5; + private const int expectedLeftGridPropertyIndex = 6; + private const int expectedRightGridPropertyIndex = 7; [Test] public void Constructor_ExpectedValues() @@ -112,7 +113,7 @@ // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); - Assert.AreEqual(7, dynamicProperties.Count); + Assert.AreEqual(8, dynamicProperties.Count); const string calculationGridsCategory = "Rekengrids"; @@ -156,6 +157,14 @@ "Verticale coördinaat van de onderste raaklijn.", true); + PropertyDescriptor tangentLineNumberProperty = dynamicProperties[expectedTangentLineNumberPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( + tangentLineNumberProperty, + calculationGridsCategory, + "Aantal tangentlijnen", + "Het aantal tangentlijnen dat bepaald moet worden.", + true); + PropertyDescriptor leftGridProperty = dynamicProperties[expectedLeftGridPropertyIndex]; TestHelper.AssertTypeConverter(nameof(properties.LeftGrid)); PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( @@ -202,6 +211,7 @@ Assert.AreEqual(input.TangentLineDeterminationType, properties.TangentLineDeterminationType); Assert.AreEqual(input.TangentLineZTop, properties.TangentLineZTop); Assert.AreEqual(input.TangentLineZBottom, properties.TangentLineZBottom); + Assert.AreEqual(input.TangentLineNumber, properties.TangentLineNumber); bool gridIsReadOnly = gridDeterminationType == MacroStabilityInwardsGridDeterminationType.Automatic; Assert.AreSame(input.LeftGrid, properties.LeftGrid.Data); @@ -225,22 +235,25 @@ bool moveGrid = random.NextBoolean(); var gridDeterminationType = random.NextEnumValue(); var tangentLineDeterminationType = random.NextEnumValue(); - double tangentLineZTop = random.Next(); - double tangentLineZBottom = random.Next(); + double tangentLineZTop = random.NextDouble(); + double tangentLineZBottom = random.NextDouble(); + int tangentLineNumber = random.Next(1, 51); // When properties.MoveGrid = moveGrid; properties.GridDeterminationType = gridDeterminationType; properties.TangentLineDeterminationType = tangentLineDeterminationType; properties.TangentLineZTop = (RoundedDouble) tangentLineZTop; properties.TangentLineZBottom = (RoundedDouble) tangentLineZBottom; + properties.TangentLineNumber = tangentLineNumber; // Then Assert.AreEqual(moveGrid, input.MoveGrid); Assert.AreEqual(gridDeterminationType, input.GridDeterminationType); Assert.AreEqual(tangentLineDeterminationType, input.TangentLineDeterminationType); Assert.AreEqual(tangentLineZTop, input.TangentLineZTop, input.TangentLineZTop.GetAccuracy()); Assert.AreEqual(tangentLineZBottom, input.TangentLineZBottom, input.TangentLineZBottom.GetAccuracy()); + Assert.AreEqual(tangentLineNumber, input.TangentLineNumber); } [Test] @@ -294,6 +307,16 @@ } [Test] + public void TangentLineNumber_SetValidValue_SetsValueAndUpdatesObservers() + { + // Setup + var calculation = new MacroStabilityInwardsCalculationScenario(); + + // Call & Assert + SetPropertyAndVerifyNotifcationsForCalculation(properties => properties.TangentLineNumber = 10, calculation); + } + + [Test] public void ToString_Always_ReturnEmptyString() { // Setup @@ -324,8 +347,8 @@ var input = new MacroStabilityInwardsInput { GridDeterminationType = isGridDeterminationTypeAutomatic - ? MacroStabilityInwardsGridDeterminationType.Automatic - : MacroStabilityInwardsGridDeterminationType.Manual + ? MacroStabilityInwardsGridDeterminationType.Automatic + : MacroStabilityInwardsGridDeterminationType.Manual }; var properties = new MacroStabilityInwardsGridSettingsProperties(input, changeHandler); @@ -343,7 +366,8 @@ [Values(true, false)] bool isTangentlineDeterminationTypeLayerSeparated, [Values(true, false)] bool isGridDeterminationTypeAutomatic, [Values(nameof(MacroStabilityInwardsGridSettingsProperties.TangentLineZTop), - nameof(MacroStabilityInwardsGridSettingsProperties.TangentLineZBottom))] string propertyName) + nameof(MacroStabilityInwardsGridSettingsProperties.TangentLineZBottom), + nameof(MacroStabilityInwardsGridSettingsProperties.TangentLineNumber))] string propertyName) { // Setup var mocks = new MockRepository();