Index: Riskeer/Common/test/Riskeer.Common.Data.Test/Hydraulics/HydraulicLocationConfigurationDatabaseTest.cs =================================================================== diff -u -r582c0f62bf91c503b3fa230bcb6c9e15fd3ced27 -r91e53e03e68cf1f0902c4226c6421256ef2e81ee --- Riskeer/Common/test/Riskeer.Common.Data.Test/Hydraulics/HydraulicLocationConfigurationDatabaseTest.cs (.../HydraulicLocationConfigurationDatabaseTest.cs) (revision 582c0f62bf91c503b3fa230bcb6c9e15fd3ced27) +++ Riskeer/Common/test/Riskeer.Common.Data.Test/Hydraulics/HydraulicLocationConfigurationDatabaseTest.cs (.../HydraulicLocationConfigurationDatabaseTest.cs) (revision 91e53e03e68cf1f0902c4226c6421256ef2e81ee) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using Core.Common.Base; using NUnit.Framework; using Riskeer.Common.Data.Hydraulics; @@ -34,6 +35,7 @@ var hydraulicLocationConfigurationDatabase = new HydraulicLocationConfigurationDatabase(); // Assert + Assert.IsInstanceOf(hydraulicLocationConfigurationDatabase); Assert.IsNull(hydraulicLocationConfigurationDatabase.FilePath); Assert.IsNull(hydraulicLocationConfigurationDatabase.ScenarioName); Assert.AreEqual(0, hydraulicLocationConfigurationDatabase.Year); Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r8dcecbf5c47c2ef985851d491d16176b58d372a4 -r91e53e03e68cf1f0902c4226c6421256ef2e81ee --- Riskeer/Integration/src/Riskeer.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8dcecbf5c47c2ef985851d491d16176b58d372a4) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 91e53e03e68cf1f0902c4226c6421256ef2e81ee) @@ -608,6 +608,24 @@ } /// + /// Looks up a localized string similar to Locatie van de bestandsmap.. + /// + public static string HydraulicBoundaryData_WorkingDirectory_Description { + get { + return ResourceManager.GetString("HydraulicBoundaryData_WorkingDirectory_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Bestandsmap. + /// + public static string HydraulicBoundaryData_WorkingDirectory_DisplayName { + get { + return ResourceManager.GetString("HydraulicBoundaryData_WorkingDirectory_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Gebruik de preprocessor sluitregime database bij het uitvoeren van een berekening.. /// public static string HydraulicBoundaryDatabase_UsePreprocessorClosure_Description { @@ -644,24 +662,6 @@ } /// - /// Looks up a localized string similar to Locatie van de bestandsmap.. - /// - public static string HydraulicDatabase_WorkingDirectory_Description { - get { - return ResourceManager.GetString("HydraulicDatabase_WorkingDirectory_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Bestandsmap. - /// - public static string HydraulicDatabase_WorkingDirectory_DisplayName { - get { - return ResourceManager.GetString("HydraulicDatabase_WorkingDirectory_DisplayName", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Overige informatie.. /// public static string HydraulicLocationConfigurationDatabase_Comment_Description { Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Properties/Resources.resx =================================================================== diff -u -r8dcecbf5c47c2ef985851d491d16176b58d372a4 -r91e53e03e68cf1f0902c4226c6421256ef2e81ee --- Riskeer/Integration/src/Riskeer.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 8dcecbf5c47c2ef985851d491d16176b58d372a4) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 91e53e03e68cf1f0902c4226c6421256ef2e81ee) @@ -288,10 +288,10 @@ Overig - + Locatie van de bestandsmap. - + Bestandsmap Index: Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/HydraulicBoundaryDataProperties.cs =================================================================== diff -u -rcadba68313ad5f71832405d3956a9ef7d36e33e6 -r91e53e03e68cf1f0902c4226c6421256ef2e81ee --- Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/HydraulicBoundaryDataProperties.cs (.../HydraulicBoundaryDataProperties.cs) (revision cadba68313ad5f71832405d3956a9ef7d36e33e6) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/HydraulicBoundaryDataProperties.cs (.../HydraulicBoundaryDataProperties.cs) (revision 91e53e03e68cf1f0902c4226c6421256ef2e81ee) @@ -38,10 +38,10 @@ private const int workingDirectoryPropertyIndex = 0; /// - /// Creates a new instance of . + /// Creates a new instance of . /// - /// The hydraulic boundary database to show the properties for. - /// Thrown when is null. + /// The hydraulic boundary data node to show the properties for. + /// Thrown when is null. public HydraulicBoundaryDataProperties(HydraulicBoundaryData hydraulicBoundaryData) { if (hydraulicBoundaryData == null) @@ -54,13 +54,15 @@ [PropertyOrder(workingDirectoryPropertyIndex)] [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))] - [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicDatabase_WorkingDirectory_DisplayName))] - [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicDatabase_WorkingDirectory_Description))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryData_WorkingDirectory_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryData_WorkingDirectory_Description))] public string WorkingDirectory { get { - return Path.GetDirectoryName(data.HydraulicLocationConfigurationDatabase.FilePath); + return !string.IsNullOrWhiteSpace(data.HydraulicLocationConfigurationDatabase.FilePath) + ? Path.GetDirectoryName(data.HydraulicLocationConfigurationDatabase.FilePath) + : string.Empty; } } } Index: Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs =================================================================== diff -u -ra01e9c71dc1ba55131e7d2ab35f082e8b9f3803e -r91e53e03e68cf1f0902c4226c6421256ef2e81ee --- Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision a01e9c71dc1ba55131e7d2ab35f082e8b9f3803e) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision 91e53e03e68cf1f0902c4226c6421256ef2e81ee) @@ -26,14 +26,12 @@ using Core.Gui.Attributes; using Core.Gui.PropertyBag; using Riskeer.Common.Data.Hydraulics; -using Riskeer.Common.Forms.Properties; +using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources; -// using Riskeer.Integration.Forms.Properties; - namespace Riskeer.Integration.Forms.PropertyClasses { /// - /// ViewModel of for properties panel. + /// ViewModel of for properties panel. /// [TypeConverter(typeof(ExpandableObjectConverter))] public class HydraulicBoundaryLocationProperties : ObjectProperties @@ -58,9 +56,9 @@ } [PropertyOrder(namePropertyIndex)] - [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))] - [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Name_DisplayName))] - [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Name_Description))] + [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.HydraulicBoundaryDatabase_Location_Name_DisplayName))] + [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.HydraulicBoundaryDatabase_Location_Name_Description))] public string Name { get @@ -70,9 +68,9 @@ } [PropertyOrder(idPropertyIndex)] - [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))] - [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Id_DisplayName))] - [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Id_Description))] + [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.HydraulicBoundaryDatabase_Location_Id_DisplayName))] + [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.HydraulicBoundaryDatabase_Location_Id_Description))] public long Id { get @@ -82,9 +80,9 @@ } [PropertyOrder(locationPropertyIndex)] - [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))] - [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Coordinates_DisplayName))] - [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Coordinates_Description))] + [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.HydraulicBoundaryDatabase_Location_Coordinates_DisplayName))] + [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.HydraulicBoundaryDatabase_Location_Coordinates_Description))] public Point2D Location { get Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDataPropertiesTest.cs =================================================================== diff -u -rcadba68313ad5f71832405d3956a9ef7d36e33e6 -r91e53e03e68cf1f0902c4226c6421256ef2e81ee --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDataPropertiesTest.cs (.../HydraulicBoundaryDataPropertiesTest.cs) (revision cadba68313ad5f71832405d3956a9ef7d36e33e6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDataPropertiesTest.cs (.../HydraulicBoundaryDataPropertiesTest.cs) (revision 91e53e03e68cf1f0902c4226c6421256ef2e81ee) @@ -21,7 +21,6 @@ using System; using System.ComponentModel; -using System.IO; using Core.Gui.PropertyBag; using Core.Gui.TestUtil; using NUnit.Framework; @@ -68,32 +67,45 @@ { HydraulicLocationConfigurationDatabase = { - FilePath = "test/path/test.test" + FilePath = @"test\path\test.test" } }; // Call var properties = new HydraulicBoundaryDataProperties(hydraulicBoundaryData); // Assert - Assert.AreEqual(Path.GetDirectoryName(hydraulicBoundaryData.HydraulicLocationConfigurationDatabase.FilePath), properties.WorkingDirectory); + Assert.AreEqual(@"test\path", properties.WorkingDirectory); } - + [Test] - public void Constructor_WithData_PropertiesHaveExpectedAttributesValues() + public void GetProperties_WithoutData_ReturnsExpectedValues() { + // Setup var hydraulicBoundaryData = new HydraulicBoundaryData { HydraulicLocationConfigurationDatabase = { - FilePath = "test/path/test.test" + FilePath = string.Empty } }; // Call var properties = new HydraulicBoundaryDataProperties(hydraulicBoundaryData); // Assert + Assert.AreEqual("", properties.WorkingDirectory); + } + + [Test] + public void Constructor_WithData_PropertiesHaveExpectedAttributesValues() + { + var hydraulicBoundaryData = new HydraulicBoundaryData(); + + // Call + var properties = new HydraulicBoundaryDataProperties(hydraulicBoundaryData); + + // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(1, dynamicProperties.Count); Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDatabasePropertiesTest.cs =================================================================== diff -u -r8dcecbf5c47c2ef985851d491d16176b58d372a4 -r91e53e03e68cf1f0902c4226c6421256ef2e81ee --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDatabasePropertiesTest.cs (.../HydraulicBoundaryDatabasePropertiesTest.cs) (revision 8dcecbf5c47c2ef985851d491d16176b58d372a4) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDatabasePropertiesTest.cs (.../HydraulicBoundaryDatabasePropertiesTest.cs) (revision 91e53e03e68cf1f0902c4226c6421256ef2e81ee) @@ -21,6 +21,7 @@ using System; using System.ComponentModel; +using System.Linq; using Core.Common.TestUtil; using Core.Gui.PropertyBag; using Core.Gui.TestUtil; @@ -86,10 +87,7 @@ // Assert Assert.AreEqual(hydraulicBoundaryDatabase.UsePreprocessorClosure, properties.UsePreprocessorClosure); Assert.AreEqual(hydraulicBoundaryDatabase.Version, properties.Version); - for (var i = 0; i < hydraulicBoundaryDatabase.Locations.Count; i++) - { - Assert.AreEqual(hydraulicBoundaryDatabase.Locations[i].Location, properties.Locations[i].Location); - } + CollectionAssert.AreEqual(hydraulicBoundaryDatabase.Locations, properties.Locations.Select(p => p.Data)); } [Test] Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs =================================================================== diff -u -ra01e9c71dc1ba55131e7d2ab35f082e8b9f3803e -r91e53e03e68cf1f0902c4226c6421256ef2e81ee --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs (.../HydraulicBoundaryLocationPropertiesTest.cs) (revision a01e9c71dc1ba55131e7d2ab35f082e8b9f3803e) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs (.../HydraulicBoundaryLocationPropertiesTest.cs) (revision 91e53e03e68cf1f0902c4226c6421256ef2e81ee) @@ -37,14 +37,14 @@ private const int locationPropertyIndex = 2; [Test] - public void Constructor_HydraulicBoundaryDatabaseNull_ThrowsArgumentNullException() + public void Constructor_HydraulicBoundaryLocationNull_ThrowsArgumentNullException() { // Call - void Call() => new HydraulicBoundaryDatabaseProperties(null); + void Call() => new HydraulicBoundaryLocationProperties(null); // Assert var exception = Assert.Throws(Call); - Assert.AreEqual("hydraulicBoundaryDatabase", exception.ParamName); + Assert.AreEqual("hydraulicBoundaryLocation", exception.ParamName); } [Test] Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/PropertyInfos/HydraulicBoundaryDataPropertyInfoTest.cs =================================================================== diff -u -ra01e9c71dc1ba55131e7d2ab35f082e8b9f3803e -r91e53e03e68cf1f0902c4226c6421256ef2e81ee --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/PropertyInfos/HydraulicBoundaryDataPropertyInfoTest.cs (.../HydraulicBoundaryDataPropertyInfoTest.cs) (revision a01e9c71dc1ba55131e7d2ab35f082e8b9f3803e) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/PropertyInfos/HydraulicBoundaryDataPropertyInfoTest.cs (.../HydraulicBoundaryDataPropertyInfoTest.cs) (revision 91e53e03e68cf1f0902c4226c6421256ef2e81ee) @@ -58,17 +58,12 @@ } [Test] - public void CreateInstance_WithContext_ReturnHydraulicBoundaryDataContextProperties() + public void CreateInstance_WithContext_ReturnHydraulicBoundaryDataProperties() { - var hydraulicBoundaryData = new HydraulicBoundaryData - { - HydraulicLocationConfigurationDatabase = - { - FilePath = "test/path/test.test" - } - }; - // Setup + var hydraulicBoundaryData = new HydraulicBoundaryData(); + + var context = new HydraulicBoundaryDataContext(hydraulicBoundaryData, new AssessmentSection(AssessmentSectionComposition.Dike)); // Call