Index: Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/HydraulicBoundaryDataProperties.cs
===================================================================
diff -u
--- Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/HydraulicBoundaryDataProperties.cs (revision 0)
+++ Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/HydraulicBoundaryDataProperties.cs (revision 6a263ea3b762067b9c56c3996c37e23d9f62af13)
@@ -0,0 +1,333 @@
+// Copyright (C) Stichting Deltares 2022. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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 System.Drawing.Design;
+using System.Windows.Forms.Design;
+using Core.Common.Util.Attributes;
+using Core.Gui.Attributes;
+using Core.Gui.PropertyBag;
+using Riskeer.Common.Data.Hydraulics;
+using Riskeer.Integration.Forms.Editors;
+using Riskeer.Integration.Forms.Properties;
+using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources;
+
+namespace Riskeer.Integration.Forms.PropertyClasses
+{
+ ///
+ /// ViewModel of for properties panel.
+ ///
+ public class HydraulicBoundaryDataProperties : ObjectProperties
+ {
+ private const int hrdFilePathPropertyIndex = 0;
+ private const int hlcdFilePathPropertyIndex = 1;
+ private const int usePreprocessorClosurePropertyIndex = 2;
+ private const int scenarioNamePropertyIndex = 3;
+ private const int yearPropertyIndex = 4;
+ private const int scopePropertyIndex = 5;
+ private const int seaLevelPropertyIndex = 6;
+ private const int riverDischargePropertyIndex = 7;
+ private const int lakeLevelPropertyIndex = 8;
+ private const int windDirectionPropertyIndex = 9;
+ private const int windSpeedPropertyIndex = 10;
+ private const int commentPropertyIndex = 11;
+ private const int usePreprocessorPropertyIndex = 12;
+ private const int preprocessorDirectoryPropertyIndex = 13;
+
+ private readonly IHydraulicLocationConfigurationDatabaseImportHandler hydraulicLocationConfigurationDatabaseImportHandler;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The hydraulic boundary data to show the properties for.
+ /// The handler to update the hydraulic location configuration settings.
+ /// Thrown when any parameter is null.
+ public HydraulicBoundaryDataProperties(HydraulicBoundaryData hydraulicBoundaryData,
+ IHydraulicLocationConfigurationDatabaseImportHandler hydraulicLocationConfigurationDatabaseImportHandler)
+ {
+ if (hydraulicBoundaryData == null)
+ {
+ throw new ArgumentNullException(nameof(hydraulicBoundaryData));
+ }
+
+ if (hydraulicLocationConfigurationDatabaseImportHandler == null)
+ {
+ throw new ArgumentNullException(nameof(hydraulicLocationConfigurationDatabaseImportHandler));
+ }
+
+ this.hydraulicLocationConfigurationDatabaseImportHandler = hydraulicLocationConfigurationDatabaseImportHandler;
+ Data = hydraulicBoundaryData;
+ }
+
+ [PropertyOrder(hrdFilePathPropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_FilePath_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_FilePath_Description))]
+ public string HrdFilePath
+ {
+ get
+ {
+ return data.IsLinked() ? data.FilePath : string.Empty;
+ }
+ }
+
+ [PropertyOrder(hlcdFilePathPropertyIndex)]
+ [DynamicVisible]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_FilePath_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_FilePath_Description))]
+ [Editor(typeof(HlcdFileNameEditor), typeof(UITypeEditor))]
+ public string HlcdFilePath
+ {
+ get
+ {
+ return data.IsLinked() ? data.HydraulicLocationConfigurationSettings.FilePath : string.Empty;
+ }
+ set
+ {
+ hydraulicLocationConfigurationDatabaseImportHandler.ImportHydraulicLocationConfigurationSettings(
+ data.HydraulicLocationConfigurationSettings, value);
+ }
+ }
+
+ [PropertyOrder(hlcdFilePathPropertyIndex)]
+ [DynamicVisible]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_FilePath_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_FilePath_Description))]
+ public string HlcdFilePathReadOnly
+ {
+ get
+ {
+ return data.IsLinked() ? data.HydraulicLocationConfigurationSettings.FilePath : string.Empty;
+ }
+ }
+
+ [PropertyOrder(usePreprocessorClosurePropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_UsePreprocessorClosure_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_UsePreprocessorClosure_Description))]
+ public bool UsePreprocessorClosure
+ {
+ get
+ {
+ return data.HydraulicLocationConfigurationSettings.UsePreprocessorClosure;
+ }
+ }
+
+ [PropertyOrder(scenarioNamePropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_ScenarioName_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_ScenarioName_Description))]
+ public string ScenarioName
+ {
+ get
+ {
+ return data.IsLinked() ? data.HydraulicLocationConfigurationSettings.ScenarioName : string.Empty;
+ }
+ }
+
+ [PropertyOrder(yearPropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_Year_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_Year_Description))]
+ public string Year
+ {
+ get
+ {
+ return data.IsLinked() ? data.HydraulicLocationConfigurationSettings.Year.ToString() : string.Empty;
+ }
+ }
+
+ [PropertyOrder(scopePropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_Scope_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_Scope_Description))]
+ public string Scope
+ {
+ get
+ {
+ return data.IsLinked() ? data.HydraulicLocationConfigurationSettings.Scope : string.Empty;
+ }
+ }
+
+ [PropertyOrder(seaLevelPropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_SeaLevel_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_SeaLevel_Description))]
+ public string SeaLevel
+ {
+ get
+ {
+ string seaLevel = data.HydraulicLocationConfigurationSettings.SeaLevel;
+ return data.IsLinked() && seaLevel != null ? seaLevel : string.Empty;
+ }
+ }
+
+ [PropertyOrder(riverDischargePropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_RiverDischarge_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_RiverDischarge_Description))]
+ public string RiverDischarge
+ {
+ get
+ {
+ string riverDischarge = data.HydraulicLocationConfigurationSettings.RiverDischarge;
+ return data.IsLinked() && riverDischarge != null ? riverDischarge : string.Empty;
+ }
+ }
+
+ [PropertyOrder(lakeLevelPropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_LakeLevel_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_LakeLevel_Description))]
+ public string LakeLevel
+ {
+ get
+ {
+ string lakeLevel = data.HydraulicLocationConfigurationSettings.LakeLevel;
+ return data.IsLinked() && lakeLevel != null ? lakeLevel : string.Empty;
+ }
+ }
+
+ [PropertyOrder(windDirectionPropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_WindDirection_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_WindDirection_Description))]
+ public string WindDirection
+ {
+ get
+ {
+ string windDirection = data.HydraulicLocationConfigurationSettings.WindDirection;
+ return data.IsLinked() && windDirection != null ? windDirection : string.Empty;
+ }
+ }
+
+ [PropertyOrder(windSpeedPropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_WindSpeed_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_WindSpeed_Description))]
+ public string WindSpeed
+ {
+ get
+ {
+ string windSpeed = data.HydraulicLocationConfigurationSettings.WindSpeed;
+ return data.IsLinked() && windSpeed != null ? windSpeed : string.Empty;
+ }
+ }
+
+ [PropertyOrder(commentPropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_Comment_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicLocationConfigurationSettings_Comment_Description))]
+ public string Comment
+ {
+ get
+ {
+ string comment = data.HydraulicLocationConfigurationSettings.Comment;
+ return data.IsLinked() && comment != null ? comment : string.Empty;
+ }
+ }
+
+ [PropertyOrder(usePreprocessorPropertyIndex)]
+ [DynamicVisible]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_UsePreprocessor_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_UsePreprocessor_Description))]
+ public bool UsePreprocessor
+ {
+ get
+ {
+ return data.HydraulicLocationConfigurationSettings.UsePreprocessor;
+ }
+ set
+ {
+ data.HydraulicLocationConfigurationSettings.UsePreprocessor = value;
+ data.NotifyObservers();
+ }
+ }
+
+ [PropertyOrder(preprocessorDirectoryPropertyIndex)]
+ [DynamicVisible]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_PreprocessorDirectory_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_PreprocessorDirectory_Description))]
+ [Editor(typeof(FolderNameEditor), typeof(UITypeEditor))]
+ public string PreprocessorDirectory
+ {
+ get
+ {
+ return data.HydraulicLocationConfigurationSettings.PreprocessorDirectory;
+ }
+ set
+ {
+ data.HydraulicLocationConfigurationSettings.PreprocessorDirectory = value;
+ }
+ }
+
+ [PropertyOrder(preprocessorDirectoryPropertyIndex)]
+ [DynamicVisible]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_PreprocessorDirectory_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_PreprocessorDirectory_Description))]
+ public string PreprocessorDirectoryReadOnly
+ {
+ get
+ {
+ return data.HydraulicLocationConfigurationSettings.PreprocessorDirectory;
+ }
+ }
+
+ [DynamicVisibleValidationMethod]
+ public bool DynamicVisibleValidationMethod(string propertyName)
+ {
+ bool canUsePreprocessor = data.HydraulicLocationConfigurationSettings.CanUsePreprocessor;
+
+ if (propertyName.Equals(nameof(UsePreprocessor)) && !canUsePreprocessor)
+ {
+ return false;
+ }
+
+ if (propertyName.Equals(nameof(PreprocessorDirectory)) && (!canUsePreprocessor || !UsePreprocessor))
+ {
+ return false;
+ }
+
+ if (propertyName.Equals(nameof(PreprocessorDirectoryReadOnly)) && (!canUsePreprocessor || UsePreprocessor))
+ {
+ return false;
+ }
+
+ if (propertyName.Equals(nameof(HlcdFilePath)) && !data.IsLinked())
+ {
+ return false;
+ }
+
+ if (propertyName.Equals(nameof(HlcdFilePathReadOnly)) && data.IsLinked())
+ {
+ return false;
+ }
+
+ return true;
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 6a263ea3b762067b9c56c3996c37e23d9f62af13 refers to a dead (removed) revision in file `Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/HydraulicBoundaryDatabaseProperties.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs
===================================================================
diff -u -r48727c54a1ff6a81a910dca143daeba5530a84a2 -r6a263ea3b762067b9c56c3996c37e23d9f62af13
--- Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 48727c54a1ff6a81a910dca143daeba5530a84a2)
+++ Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 6a263ea3b762067b9c56c3996c37e23d9f62af13)
@@ -237,9 +237,9 @@
{
CreateInstance = data => new BackgroundDataProperties(data)
};
- yield return new PropertyInfo
+ yield return new PropertyInfo
{
- CreateInstance = context => new HydraulicBoundaryDatabaseProperties(
+ CreateInstance = context => new HydraulicBoundaryDataProperties(
context.WrappedData,
new HydraulicLocationConfigurationDatabaseImportHandler(
Gui.MainWindow,
Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDataPropertiesTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDataPropertiesTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDataPropertiesTest.cs (revision 6a263ea3b762067b9c56c3996c37e23d9f62af13)
@@ -0,0 +1,733 @@
+// Copyright (C) Stichting Deltares 2022. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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 System.Drawing.Design;
+using Core.Common.Base;
+using Core.Gui.PropertyBag;
+using Core.Gui.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.Common.Data.Hydraulics;
+using Riskeer.Integration.Forms.Editors;
+using Riskeer.Integration.Forms.PropertyClasses;
+
+namespace Riskeer.Integration.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class HydraulicBoundaryDataPropertiesTest
+ {
+ private const int hrdFilePathPropertyIndex = 0;
+ private const int hlcdFilePathPropertyIndex = 1;
+ private const int usePreprocessorClosurePropertyIndex = 2;
+ private const int scenarioNamePropertyIndex = 3;
+ private const int yearPropertyIndex = 4;
+ private const int scopePropertyIndex = 5;
+ private const int seaLevelPropertyIndex = 6;
+ private const int riverDischargePropertyIndex = 7;
+ private const int lakeLevelPropertyIndex = 8;
+ private const int windDirectionPropertyIndex = 9;
+ private const int windSpeedPropertyIndex = 10;
+ private const int commentPropertyIndex = 11;
+ private const int usePreprocessorPropertyIndex = 12;
+ private const int preprocessorDirectoryPropertyIndex = 13;
+
+ [Test]
+ public void Constructor_HydraulicBoundaryDataNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var importHandler = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ void Call() => new HydraulicBoundaryDataProperties(null, importHandler);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("hydraulicBoundaryData", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_HydraulicLocationConfigurationDatabaseImportHandlerNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var hydraulicBoundaryData = new HydraulicBoundaryData();
+
+ // Call
+ void Call() => new HydraulicBoundaryDataProperties(hydraulicBoundaryData, null);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("hydraulicLocationConfigurationDatabaseImportHandler", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var importHandler = mocks.Stub();
+ mocks.ReplayAll();
+
+ var hydraulicBoundaryData = new HydraulicBoundaryData();
+
+ // Call
+ var properties = new HydraulicBoundaryDataProperties(hydraulicBoundaryData, importHandler);
+
+ // Assert
+ Assert.IsInstanceOf>(properties);
+ Assert.AreSame(hydraulicBoundaryData, properties.Data);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetProperties_WithHydraulicBoundaryDataWithPreprocessorData_ReturnExpectedValues()
+ {
+ // Setup
+ const bool usePreprocessor = true;
+ const string preprocessorDirectory = @"C:\preprocessor";
+
+ var mocks = new MockRepository();
+ var importHandler = mocks.Stub();
+ mocks.ReplayAll();
+
+ var hydraulicBoundaryData = new HydraulicBoundaryData
+ {
+ HydraulicLocationConfigurationSettings =
+ {
+ CanUsePreprocessor = true,
+ UsePreprocessor = usePreprocessor,
+ PreprocessorDirectory = preprocessorDirectory
+ }
+ };
+
+ // Call
+ var properties = new HydraulicBoundaryDataProperties(hydraulicBoundaryData, importHandler);
+
+ // Assert
+ Assert.AreEqual(usePreprocessor, properties.UsePreprocessor);
+ Assert.AreEqual(preprocessorDirectory, properties.PreprocessorDirectory);
+ Assert.AreEqual(preprocessorDirectory, properties.PreprocessorDirectoryReadOnly);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetProperties_WithUnlinkedHydraulicBoundaryDatabase_ReturnsExpectedValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var importHandler = mocks.Stub();
+ mocks.ReplayAll();
+
+ var hydraulicBoundaryData = new HydraulicBoundaryData();
+
+ // Precondition
+ Assert.IsFalse(hydraulicBoundaryData.IsLinked());
+
+ // Call
+ var properties = new HydraulicBoundaryDataProperties(hydraulicBoundaryData, importHandler);
+
+ // Assert
+ Assert.IsEmpty(properties.HrdFilePath);
+ Assert.IsEmpty(properties.HlcdFilePath);
+ Assert.IsEmpty(properties.HlcdFilePathReadOnly);
+ Assert.IsFalse(properties.UsePreprocessorClosure);
+ Assert.IsEmpty(properties.ScenarioName);
+ Assert.IsEmpty(properties.Year);
+ Assert.IsEmpty(properties.Scope);
+ Assert.IsEmpty(properties.SeaLevel);
+ Assert.IsEmpty(properties.RiverDischarge);
+ Assert.IsEmpty(properties.LakeLevel);
+ Assert.IsEmpty(properties.WindDirection);
+ Assert.IsEmpty(properties.WindSpeed);
+ Assert.IsEmpty(properties.Comment);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetProperties_WithLinkedHydraulicBoundaryDatabase_ReturnsExpectedValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var importHandler = mocks.Stub();
+ mocks.ReplayAll();
+
+ HydraulicBoundaryData hydraulicBoundaryData = CreateLinkedHydraulicBoundaryData();
+
+ // Precondition
+ Assert.IsTrue(hydraulicBoundaryData.IsLinked());
+
+ // Call
+ var properties = new HydraulicBoundaryDataProperties(hydraulicBoundaryData, importHandler);
+
+ // Assert
+ Assert.AreEqual(hydraulicBoundaryData.FilePath, properties.HrdFilePath);
+
+ HydraulicLocationConfigurationSettings configurationSettings = hydraulicBoundaryData.HydraulicLocationConfigurationSettings;
+ Assert.AreEqual(configurationSettings.FilePath, properties.HlcdFilePath);
+ Assert.AreEqual(configurationSettings.FilePath, properties.HlcdFilePathReadOnly);
+ Assert.AreEqual(configurationSettings.UsePreprocessorClosure, properties.UsePreprocessorClosure);
+ Assert.AreEqual(configurationSettings.ScenarioName, properties.ScenarioName);
+ Assert.AreEqual(configurationSettings.Year.ToString(), properties.Year);
+ Assert.AreEqual(configurationSettings.Scope, properties.Scope);
+ Assert.AreEqual(configurationSettings.SeaLevel, properties.SeaLevel);
+ Assert.AreEqual(configurationSettings.RiverDischarge, properties.RiverDischarge);
+ Assert.AreEqual(configurationSettings.LakeLevel, properties.LakeLevel);
+ Assert.AreEqual(configurationSettings.WindDirection, properties.WindDirection);
+ Assert.AreEqual(configurationSettings.WindSpeed, properties.WindSpeed);
+ Assert.AreEqual(configurationSettings.Comment, properties.Comment);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Constructor_CanUsePreprocessorTrue_PropertiesHaveExpectedAttributesValues(bool usePreprocessor)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var importHandler = mocks.Stub();
+ mocks.ReplayAll();
+
+ var hydraulicBoundaryData = new HydraulicBoundaryData
+ {
+ HydraulicLocationConfigurationSettings =
+ {
+ CanUsePreprocessor = true,
+ UsePreprocessor = usePreprocessor,
+ PreprocessorDirectory = "Preprocessor"
+ }
+ };
+
+ // Call
+ var properties = new HydraulicBoundaryDataProperties(hydraulicBoundaryData, importHandler);
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(14, dynamicProperties.Count);
+
+ const string expectedCategory = "Algemeen";
+ PropertyDescriptor hrdFilePathProperty = dynamicProperties[hrdFilePathPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(hrdFilePathProperty,
+ expectedCategory,
+ "HRD bestandslocatie",
+ "Locatie van het HRD bestand.",
+ true);
+
+ PropertyDescriptor hlcdFilePathProperty = dynamicProperties[hlcdFilePathPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(hlcdFilePathProperty,
+ expectedCategory,
+ "HLCD bestandslocatie",
+ "Locatie van het HLCD bestand.",
+ true);
+
+ PropertyDescriptor usePreprocessorClosureProperty = dynamicProperties[usePreprocessorClosurePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(usePreprocessorClosureProperty,
+ expectedCategory,
+ "Gebruik preprocessor sluitregime database",
+ "Gebruik de preprocessor sluitregime database bij het uitvoeren van een berekening.",
+ true);
+
+ 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);
+
+ PropertyDescriptor usePreprocessorProperty = dynamicProperties[usePreprocessorPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(usePreprocessorProperty,
+ expectedCategory,
+ "Gebruik preprocessor",
+ "Gebruik de preprocessor bij het uitvoeren van een berekening.");
+
+ PropertyDescriptor preprocessorDirectoryProperty = dynamicProperties[preprocessorDirectoryPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(preprocessorDirectoryProperty,
+ expectedCategory,
+ "Locatie preprocessor bestanden",
+ "Locatie waar de preprocessor bestanden opslaat.",
+ !usePreprocessor);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_CanUsePreprocessorFalse_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var importHandler = mocks.Stub();
+ mocks.ReplayAll();
+
+ var hydraulicBoundaryData = new HydraulicBoundaryData();
+
+ // Call
+ var properties = new HydraulicBoundaryDataProperties(hydraulicBoundaryData, importHandler);
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(12, dynamicProperties.Count);
+
+ const string expectedCategory = "Algemeen";
+ PropertyDescriptor hrdFilePathProperty = dynamicProperties[hrdFilePathPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(hrdFilePathProperty,
+ expectedCategory,
+ "HRD bestandslocatie",
+ "Locatie van het HRD bestand.",
+ true);
+
+ PropertyDescriptor hlcdFilePathProperty = dynamicProperties[hlcdFilePathPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(hlcdFilePathProperty,
+ expectedCategory,
+ "HLCD bestandslocatie",
+ "Locatie van het HLCD bestand.",
+ true);
+
+ PropertyDescriptor usePreprocessorClosureProperty = dynamicProperties[usePreprocessorClosurePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(usePreprocessorClosureProperty,
+ expectedCategory,
+ "Gebruik preprocessor sluitregime database",
+ "Gebruik de preprocessor sluitregime database bij het uitvoeren van een berekening.",
+ true);
+
+ 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);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Constructor_WithLinkedDatabaseStatus_HlcdFilePathHaveExpectedAttributeValue(bool isLinked)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var importHandler = mocks.Stub();
+ mocks.ReplayAll();
+
+ HydraulicBoundaryData hydraulicBoundaryData = isLinked
+ ? CreateLinkedHydraulicBoundaryData()
+ : new HydraulicBoundaryData();
+
+ // Call
+ var properties = new HydraulicBoundaryDataProperties(hydraulicBoundaryData, importHandler);
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(12, dynamicProperties.Count);
+
+ const string expectedCategory = "Algemeen";
+ PropertyDescriptor hrdFilePathProperty = dynamicProperties[hrdFilePathPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(hrdFilePathProperty,
+ expectedCategory,
+ "HRD bestandslocatie",
+ "Locatie van het HRD bestand.",
+ true);
+
+ PropertyDescriptor hlcdFilePathProperty = dynamicProperties[hlcdFilePathPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(hlcdFilePathProperty,
+ expectedCategory,
+ "HLCD bestandslocatie",
+ "Locatie van het HLCD bestand.",
+ !isLinked);
+ if (isLinked)
+ {
+ object hlcdFilePathEditor = hlcdFilePathProperty.GetEditor(typeof(UITypeEditor));
+ Assert.IsInstanceOf(hlcdFilePathEditor);
+ }
+
+ PropertyDescriptor usePreprocessorClosureProperty = dynamicProperties[usePreprocessorClosurePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(usePreprocessorClosureProperty,
+ expectedCategory,
+ "Gebruik preprocessor sluitregime database",
+ "Gebruik de preprocessor sluitregime database bij het uitvoeren van een berekening.",
+ true);
+
+ 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_ValueSetToHydraulicBoundaryDataAndObserversNotified(bool usePreprocessor)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var importHandler = mocks.Stub();
+ var observer = mocks.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ mocks.ReplayAll();
+
+ var hydraulicBoundaryData = new HydraulicBoundaryData
+ {
+ HydraulicLocationConfigurationSettings =
+ {
+ CanUsePreprocessor = true,
+ UsePreprocessor = !usePreprocessor,
+ PreprocessorDirectory = "Preprocessor"
+ }
+ };
+
+ var properties = new HydraulicBoundaryDataProperties(hydraulicBoundaryData, importHandler);
+
+ hydraulicBoundaryData.Attach(observer);
+
+ // Call
+ properties.UsePreprocessor = usePreprocessor;
+
+ // Assert
+ Assert.AreEqual(usePreprocessor, hydraulicBoundaryData.HydraulicLocationConfigurationSettings.UsePreprocessor);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void PreprocessorDirectory_SetNewValue_ValueSetToHydraulicBoundaryData()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var importHandler = mocks.Stub();
+ mocks.ReplayAll();
+
+ const string newPreprocessorDirectory = @"C:/path";
+ var hydraulicBoundaryData = new HydraulicBoundaryData
+ {
+ HydraulicLocationConfigurationSettings =
+ {
+ CanUsePreprocessor = true,
+ UsePreprocessor = true,
+ PreprocessorDirectory = "Preprocessor"
+ }
+ };
+
+ var properties = new HydraulicBoundaryDataProperties(hydraulicBoundaryData, importHandler);
+
+ // Call
+ properties.PreprocessorDirectory = newPreprocessorDirectory;
+
+ // Assert
+ Assert.AreEqual(newPreprocessorDirectory, hydraulicBoundaryData.HydraulicLocationConfigurationSettings.PreprocessorDirectory);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void HlcdFilePath_SetNewValue_CallsHydraulicLocationConfigurationDatabaseImportHandler()
+ {
+ // Setup
+ const string hlcdFilePath = @"C:/path/HlcdFilePath";
+ var hydraulicBoundaryData = new HydraulicBoundaryData();
+
+ var mocks = new MockRepository();
+ var importHandler = mocks.StrictMock();
+ importHandler.Expect(ih => ih.ImportHydraulicLocationConfigurationSettings(hydraulicBoundaryData.HydraulicLocationConfigurationSettings,
+ hlcdFilePath));
+ mocks.ReplayAll();
+
+ var properties = new HydraulicBoundaryDataProperties(hydraulicBoundaryData, importHandler);
+
+ // Call
+ properties.HlcdFilePath = hlcdFilePath;
+
+ // Assert
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [Combinatorial]
+ public void DynamicVisibleValidationMethod_DependingOnCanUsePreprocessorAndUsePreprocessor_ReturnExpectedVisibility(
+ [Values(true, false)] bool canUsePreprocessor,
+ [Values(true, false)] bool usePreprocessor)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var importHandler = mocks.Stub();
+ mocks.ReplayAll();
+
+ var hydraulicBoundaryData = new HydraulicBoundaryData();
+
+ if (canUsePreprocessor)
+ {
+ hydraulicBoundaryData.HydraulicLocationConfigurationSettings.CanUsePreprocessor = true;
+ hydraulicBoundaryData.HydraulicLocationConfigurationSettings.UsePreprocessor = usePreprocessor;
+ hydraulicBoundaryData.HydraulicLocationConfigurationSettings.PreprocessorDirectory = "Preprocessor";
+ }
+
+ // Call
+ var properties = new HydraulicBoundaryDataProperties(hydraulicBoundaryData, importHandler);
+
+ // Assert
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.HrdFilePath)));
+ Assert.AreEqual(canUsePreprocessor, properties.DynamicVisibleValidationMethod(nameof(properties.UsePreprocessor)));
+ Assert.AreEqual(canUsePreprocessor && usePreprocessor, properties.DynamicVisibleValidationMethod(nameof(properties.PreprocessorDirectory)));
+ Assert.AreEqual(canUsePreprocessor && !usePreprocessor, properties.DynamicVisibleValidationMethod(nameof(properties.PreprocessorDirectoryReadOnly)));
+
+ Assert.IsFalse(properties.DynamicVisibleValidationMethod(nameof(properties.HlcdFilePath)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.HlcdFilePathReadOnly)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.ScenarioName)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.Year)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.Scope)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.SeaLevel)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.RiverDischarge)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.LakeLevel)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.WindDirection)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.WindSpeed)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.Comment)));
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void DynamicVisibleValidationMethod_DependingOnHydraulicDataLinkStatus_ReturnsExpectedVisibility(bool isHydraulicBoundaryDataLinked)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var importHandler = mocks.Stub();
+ mocks.ReplayAll();
+
+ HydraulicBoundaryData hydraulicBoundaryData = isHydraulicBoundaryDataLinked
+ ? CreateLinkedHydraulicBoundaryData()
+ : new HydraulicBoundaryData();
+
+ // Call
+ var properties = new HydraulicBoundaryDataProperties(hydraulicBoundaryData, importHandler);
+
+ // Assert
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.HrdFilePath)));
+ Assert.IsFalse(properties.DynamicVisibleValidationMethod(nameof(properties.UsePreprocessor)));
+ Assert.IsFalse(properties.DynamicVisibleValidationMethod(nameof(properties.PreprocessorDirectory)));
+ Assert.IsFalse(properties.DynamicVisibleValidationMethod(nameof(properties.PreprocessorDirectoryReadOnly)));
+
+ Assert.AreEqual(isHydraulicBoundaryDataLinked, properties.DynamicVisibleValidationMethod(nameof(properties.HlcdFilePath)));
+ Assert.AreEqual(!isHydraulicBoundaryDataLinked, properties.DynamicVisibleValidationMethod(nameof(properties.HlcdFilePathReadOnly)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.ScenarioName)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.Year)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.Scope)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.SeaLevel)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.RiverDischarge)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.LakeLevel)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.WindDirection)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.WindSpeed)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.Comment)));
+ mocks.VerifyAll();
+ }
+
+ private static HydraulicBoundaryData CreateLinkedHydraulicBoundaryData()
+ {
+ var hydraulicBoundaryData = new HydraulicBoundaryData
+ {
+ FilePath = @"C:\file.sqlite"
+ };
+
+ hydraulicBoundaryData.HydraulicLocationConfigurationSettings.SetValues("FilePath",
+ "ScenarioName",
+ 10,
+ "Scope",
+ false,
+ "SeaLevel",
+ "RiverDischarge",
+ "LakeLevel",
+ "WindDirection",
+ "WindSpeed",
+ "Comment");
+
+ return hydraulicBoundaryData;
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 6a263ea3b762067b9c56c3996c37e23d9f62af13 refers to a dead (removed) revision in file `Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDatabasePropertiesTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/PropertyInfos/HydraulicBoundaryDataPropertyInfoTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/PropertyInfos/HydraulicBoundaryDataPropertyInfoTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/PropertyInfos/HydraulicBoundaryDataPropertyInfoTest.cs (revision 6a263ea3b762067b9c56c3996c37e23d9f62af13)
@@ -0,0 +1,86 @@
+// Copyright (C) Stichting Deltares 2022. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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.Linq;
+using Core.Gui;
+using Core.Gui.Forms.Main;
+using Core.Gui.Plugin;
+using Core.Gui.PropertyBag;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Plugin.TestUtil;
+using Riskeer.Integration.Data;
+using Riskeer.Integration.Forms.PresentationObjects;
+using Riskeer.Integration.Forms.PropertyClasses;
+
+namespace Riskeer.Integration.Plugin.Test.PropertyInfos
+{
+ [TestFixture]
+ public class HydraulicBoundaryDataPropertyInfoTest
+ {
+ private RiskeerPlugin plugin;
+ private PropertyInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ plugin = new RiskeerPlugin();
+ info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(HydraulicBoundaryDataProperties));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(HydraulicBoundaryDataContext), info.DataType);
+ }
+
+ [Test]
+ public void CreateInstance_WithContext_ReturnHydraulicBoundaryDataProperties()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var mainWindow = mocks.Stub();
+ IGui gui = StubFactory.CreateGuiStub(mocks);
+ gui.Stub(g => g.MainWindow).Return(mainWindow);
+ mocks.ReplayAll();
+
+ plugin.Gui = gui;
+
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
+ var context = new HydraulicBoundaryDataContext(assessmentSection.HydraulicBoundaryData, assessmentSection);
+
+ // Call
+ IObjectProperties objectProperties = info.CreateInstance(context);
+
+ // Assert
+ Assert.IsInstanceOf(objectProperties);
+ Assert.AreSame(context.WrappedData, objectProperties.Data);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 6a263ea3b762067b9c56c3996c37e23d9f62af13 refers to a dead (removed) revision in file `Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/PropertyInfos/HydraulicBoundaryDatabasePropertyInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs
===================================================================
diff -u -r48727c54a1ff6a81a910dca143daeba5530a84a2 -r6a263ea3b762067b9c56c3996c37e23d9f62af13
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs (.../RiskeerPluginTest.cs) (revision 48727c54a1ff6a81a910dca143daeba5530a84a2)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs (.../RiskeerPluginTest.cs) (revision 6a263ea3b762067b9c56c3996c37e23d9f62af13)
@@ -235,7 +235,7 @@
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,
typeof(HydraulicBoundaryDataContext),
- typeof(HydraulicBoundaryDatabaseProperties));
+ typeof(HydraulicBoundaryDataProperties));
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,