Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsSlipPlaneSettingsProperties.cs =================================================================== diff -u -r14504cbfd9e1f22ae5cc264f31bf6d85acc0bd12 -r72667b6d36efc661da0f8ec030b3292088d7651a --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsSlipPlaneSettingsProperties.cs (.../MacroStabilityInwardsSlipPlaneSettingsProperties.cs) (revision 14504cbfd9e1f22ae5cc264f31bf6d85acc0bd12) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsSlipPlaneSettingsProperties.cs (.../MacroStabilityInwardsSlipPlaneSettingsProperties.cs) (revision 72667b6d36efc661da0f8ec030b3292088d7651a) @@ -136,14 +136,14 @@ } [DynamicReadOnlyValidationMethod] - public bool DynamicReadOnlyValidationMethod(string param) + public bool DynamicReadOnlyValidationMethod(string propertyName) { - if (param == nameof(ZoningBoundariesDeterminationType)) + if (propertyName == nameof(ZoningBoundariesDeterminationType)) { return CreateZones == false; } - if (param == nameof(ZoneBoundaryLeft) || param == nameof(ZoneBoundaryRight)) + if (propertyName == nameof(ZoneBoundaryLeft) || propertyName == nameof(ZoneBoundaryRight)) { return CreateZones == false || ZoningBoundariesDeterminationType == MacroStabilityInwardsZoningBoundariesDeterminationType.Automatic; } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsSlipPlaneSettingsPropertiesTest.cs =================================================================== diff -u -r14504cbfd9e1f22ae5cc264f31bf6d85acc0bd12 -r72667b6d36efc661da0f8ec030b3292088d7651a --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsSlipPlaneSettingsPropertiesTest.cs (.../MacroStabilityInwardsSlipPlaneSettingsPropertiesTest.cs) (revision 14504cbfd9e1f22ae5cc264f31bf6d85acc0bd12) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsSlipPlaneSettingsPropertiesTest.cs (.../MacroStabilityInwardsSlipPlaneSettingsPropertiesTest.cs) (revision 72667b6d36efc661da0f8ec030b3292088d7651a) @@ -22,11 +22,13 @@ using System; using System.ComponentModel; using Core.Common.Base; +using Core.Common.Base.Data; using Core.Common.Gui.PropertyBag; using Core.Common.TestUtil; using Core.Common.Utils; using NUnit.Framework; using Rhino.Mocks; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.ChangeHandlers; using Ringtoets.Common.Forms.PropertyClasses; using Ringtoets.Common.Forms.TestUtil; @@ -94,14 +96,26 @@ } [Test] - public void Constructor_ValidData_PropertiesHaveExpectedAttributesValues() + [TestCase(true, MacroStabilityInwardsZoningBoundariesDeterminationType.Automatic, false, true)] + [TestCase(true, MacroStabilityInwardsZoningBoundariesDeterminationType.Manual, false, false)] + [TestCase(false, MacroStabilityInwardsZoningBoundariesDeterminationType.Automatic, true, true)] + [TestCase(false, MacroStabilityInwardsZoningBoundariesDeterminationType.Manual, true, true)] + public void Constructor_ValidData_PropertiesHaveExpectedAttributesValues( + bool createZones, + MacroStabilityInwardsZoningBoundariesDeterminationType zoningBoundariesDeterminationType, + bool expectedDeterminationTypeReadOnly, + bool expectedZoneBoundariesReadOnly) { // Setup var mocks = new MockRepository(); var changeHandler = mocks.Stub(); mocks.ReplayAll(); - var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties()); + var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties()) + { + CreateZones = createZones, + ZoningBoundariesDeterminationType = zoningBoundariesDeterminationType + }; // Call var properties = new MacroStabilityInwardsSlipPlaneSettingsProperties(input, changeHandler); @@ -126,23 +140,24 @@ zoningBoundariesDeterminationTypeProperty, category, "Methode", - "Zoneringsgrenzen automatisch bepalen of handmatig invoeren?"); + "Zoneringsgrenzen automatisch bepalen of handmatig invoeren?", + expectedDeterminationTypeReadOnly); PropertyDescriptor zoneBoundaryLeftProperty = dynamicProperties[expectedZoneBoundayrLeftPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( zoneBoundaryLeftProperty, category, "Zoneringsgrens links", "Linker grens voor bepaling intredepunt van het glijvlak.", - true); + expectedZoneBoundariesReadOnly); PropertyDescriptor zoneBoundaryRightProperty = dynamicProperties[expectedZoneBoundaryRightPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( zoneBoundaryRightProperty, category, "Zoneringsgrens rechts", "Rechter grens voor bepaling intredepunt van het glijvlak.", - true); + expectedZoneBoundariesReadOnly); mocks.VerifyAll(); } @@ -180,12 +195,21 @@ var random = new Random(21); bool createZones = random.NextBoolean(); + var determinationType = random.NextEnumValue(); + RoundedDouble boundaryLeft = random.NextRoundedDouble(); + RoundedDouble boundaryRight = random.NextRoundedDouble(); // When properties.CreateZones = createZones; + properties.ZoningBoundariesDeterminationType = determinationType; + properties.ZoneBoundaryLeft = boundaryLeft; + properties.ZoneBoundaryRight = boundaryRight; // Then Assert.AreEqual(createZones, input.CreateZones); + Assert.AreEqual(determinationType, input.ZoningBoundariesDeterminationType); + Assert.AreEqual(boundaryLeft, input.ZoneBoundaryLeft, input.ZoneBoundaryLeft.GetAccuracy()); + Assert.AreEqual(boundaryRight, input.ZoneBoundaryRight, input.ZoneBoundaryRight.GetAccuracy()); } [Test]