Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryDatabaseProperties.cs =================================================================== diff -u -r2723d371eb87ca14a89ab6a24564f2b466ccbe4e -r9ead47485da24bde64c9c99609ac922b3bc52bf4 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryDatabaseProperties.cs (.../HydraulicBoundaryDatabaseProperties.cs) (revision 2723d371eb87ca14a89ab6a24564f2b466ccbe4e) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryDatabaseProperties.cs (.../HydraulicBoundaryDatabaseProperties.cs) (revision 9ead47485da24bde64c9c99609ac922b3bc52bf4) @@ -89,10 +89,11 @@ } [PropertyOrder(hlcdFilePathPropertyIndex)] + [DynamicVisible] [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_FilePath_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_FilePath_Description))] - [Editor(typeof(FolderNameEditor), typeof(UITypeEditor))] + [Editor(typeof(FileNameEditor), typeof(UITypeEditor))] public string HlcdFilePath { get @@ -105,6 +106,19 @@ } } + [PropertyOrder(hlcdFilePathPropertyIndex)] + [DynamicVisible] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_FilePath_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_FilePath_Description))] + public string HlcdFilePathReadOnly + { + get + { + return data.HydraulicLocationConfigurationSettings.FilePath ?? string.Empty; + } + } + [PropertyOrder(scenarioNamePropertyIndex)] [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_ScenarioName_DisplayName))] @@ -282,6 +296,16 @@ return false; } + if (propertyName.Equals(nameof(HlcdFilePath)) && !data.IsLinked()) + { + return false; + } + + if (propertyName.Equals(nameof(HlcdFilePathReadOnly)) && data.IsLinked()) + { + return false; + } + return true; } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDatabasePropertiesTest.cs =================================================================== diff -u -r2723d371eb87ca14a89ab6a24564f2b466ccbe4e -r9ead47485da24bde64c9c99609ac922b3bc52bf4 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDatabasePropertiesTest.cs (.../HydraulicBoundaryDatabasePropertiesTest.cs) (revision 2723d371eb87ca14a89ab6a24564f2b466ccbe4e) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDatabasePropertiesTest.cs (.../HydraulicBoundaryDatabasePropertiesTest.cs) (revision 9ead47485da24bde64c9c99609ac922b3bc52bf4) @@ -145,6 +145,7 @@ // Assert Assert.IsEmpty(properties.HrdFilePath); Assert.IsEmpty(properties.HlcdFilePath); + Assert.IsEmpty(properties.HlcdFilePathReadOnly); Assert.IsEmpty(properties.ScenarioName); Assert.AreEqual(0, properties.Year); Assert.IsEmpty(properties.Scope); @@ -178,6 +179,7 @@ HydraulicLocationConfigurationSettings configurationSettings = hydraulicBoundaryDatabase.HydraulicLocationConfigurationSettings; Assert.AreEqual(configurationSettings.FilePath, properties.HlcdFilePath); + Assert.AreEqual(configurationSettings.FilePath, properties.HlcdFilePathReadOnly); Assert.AreEqual(configurationSettings.ScenarioName, properties.ScenarioName); Assert.AreEqual(configurationSettings.Year, properties.Year); Assert.AreEqual(configurationSettings.Scope, properties.Scope); @@ -407,6 +409,106 @@ [Test] [TestCase(true)] [TestCase(false)] + public void Constructor_WithVariousLinkedDatabaseStatuses_HlcdFilePathHaveExpectedAttributeValue(bool isLinked) + { + // Setup + var mocks = new MockRepository(); + var importHandler = mocks.Stub(); + mocks.ReplayAll(); + + HydraulicBoundaryDatabase hydraulicBoundaryDatabase = isLinked + ? CreateLinkedHydraulicBoundaryDatabase() + : new HydraulicBoundaryDatabase(); + + // Call + var properties = new HydraulicBoundaryDatabaseProperties(hydraulicBoundaryDatabase, importHandler); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(11, dynamicProperties.Count); + + const string expectedCategory = "Algemeen"; + PropertyDescriptor hrdFilePathProperty = dynamicProperties[hrdFilePathPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(hrdFilePathProperty, + expectedCategory, + "HRD database locatie", + "Locatie van het HRD bestand.", + true); + + PropertyDescriptor hlcdFilePathProperty = dynamicProperties[hlcdFilePathPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(hlcdFilePathProperty, + expectedCategory, + "HLCD database locatie", + "Locatie van het HLCD bestand.", + !isLinked); + + PropertyDescriptor scenarioNameProperty = dynamicProperties[scenarioNamePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(scenarioNameProperty, + expectedCategory, + "Klimaatscenario", + "Algemene naam van het klimaatscenario.", + true); + + PropertyDescriptor yearProperty = dynamicProperties[yearPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(yearProperty, + expectedCategory, + "Zichtjaar", + "Jaartal van het jaar waarop de statistiek van toepassing is.", + true); + + PropertyDescriptor scopeProperty = dynamicProperties[scopePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(scopeProperty, + expectedCategory, + "Toepassingskader", + "Projectkader waarin de statistiek bedoeld is te gebruiken.", + true); + + PropertyDescriptor seaLevelProperty = dynamicProperties[seaLevelPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(seaLevelProperty, + expectedCategory, + "Zeewaterstand", + "Klimaatinformatie met betrekking tot de zeewaterstand.", + true); + + PropertyDescriptor riverDischargeProperty = dynamicProperties[riverDischargePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(riverDischargeProperty, + expectedCategory, + "Rivierafvoer", + "Klimaatinformatie met betrekking tot de rivierafvoer.", + true); + + PropertyDescriptor lakeLevelProperty = dynamicProperties[lakeLevelPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(lakeLevelProperty, + expectedCategory, + "Meerpeil", + "Klimaatinformatie met betrekking tot het meerpeil/de meerpeilen.", + true); + + PropertyDescriptor windDirectionProperty = dynamicProperties[windDirectionPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windDirectionProperty, + expectedCategory, + "Windrichting", + "Klimaatinformatie met betrekking tot de windrichting.", + true); + + PropertyDescriptor windSpeedProperty = dynamicProperties[windSpeedPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windSpeedProperty, + expectedCategory, + "Windsnelheid", + "Klimaatinformatie met betrekking tot de windsnelheid.", + true); + + PropertyDescriptor commentProperty = dynamicProperties[commentPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(commentProperty, + expectedCategory, + "Overig", + "Overige informatie.", + true); + } + + [Test] + [TestCase(true)] + [TestCase(false)] public void UsePreprocessor_SetNewValue_ValueSetToHydraulicBoundaryDatabaseAndObserversNotified(bool usePreprocessor) { // Setup