Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelCalculationsProperties.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelCalculationsProperties.cs (revision 0)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelCalculationsProperties.cs (revision 9a88ce53b48fd94075aeb7ce92b25d63cb8e8782)
@@ -0,0 +1,61 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets 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.Linq;
+using Core.Common.Base;
+using Core.Common.Gui.Converters;
+using Core.Common.Util.Attributes;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Forms.Properties;
+using Ringtoets.Common.Forms.PropertyClasses;
+using Ringtoets.GrassCoverErosionOutwards.Data;
+
+namespace Ringtoets.GrassCoverErosionOutwards.Forms.PropertyClasses
+{
+ ///
+ /// ViewModel of an enumeration of with a design water level
+ /// calculation result for properties panel of the .
+ ///
+ public class GrassCoverErosionOutwardsDesignWaterLevelCalculationsProperties : HydraulicBoundaryLocationsProperties
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The hydraulic boundary location calculations to set as data.
+ /// Thrown when is null.
+ public GrassCoverErosionOutwardsDesignWaterLevelCalculationsProperties(ObservableList hydraulicBoundaryLocationCalculations)
+ : base(hydraulicBoundaryLocationCalculations) {}
+
+ [TypeConverter(typeof(ExpandableArrayConverter))]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Locations_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Locations_Description))]
+ public GrassCoverErosionOutwardsDesignWaterLevelCalculationProperties[] Calculations
+ {
+ get
+ {
+ return data.Select(calculation => new GrassCoverErosionOutwardsDesignWaterLevelCalculationProperties(calculation)).ToArray();
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 9a88ce53b48fd94075aeb7ce92b25d63cb8e8782 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj
===================================================================
diff -u -r1808e62474dba5945462ff310b654d485008c3d6 -r9a88ce53b48fd94075aeb7ce92b25d63cb8e8782
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.csproj) (revision 1808e62474dba5945462ff310b654d485008c3d6)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.csproj) (revision 9a88ce53b48fd94075aeb7ce92b25d63cb8e8782)
@@ -37,7 +37,7 @@
-
+
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs
===================================================================
diff -u -r1808e62474dba5945462ff310b654d485008c3d6 -r9a88ce53b48fd94075aeb7ce92b25d63cb8e8782
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 1808e62474dba5945462ff310b654d485008c3d6)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 9a88ce53b48fd94075aeb7ce92b25d63cb8e8782)
@@ -79,15 +79,15 @@
context.WrappedData,
new GrassCoverErosionOutwardsFailureMechanismPropertyChangeHandler())
};
- yield return new PropertyInfo
+ yield return new PropertyInfo
{
CreateInstance = context =>
{
var hydraulicBoundaryLocationCalculations = new ObservableList();
hydraulicBoundaryLocationCalculations.AddRange(context.WrappedData.Select(loc => loc.DesignWaterLevelCalculation1));
- return new GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties(hydraulicBoundaryLocationCalculations);
+ return new GrassCoverErosionOutwardsDesignWaterLevelCalculationsProperties(hydraulicBoundaryLocationCalculations);
}
};
yield return new PropertyInfo
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelCalculationsPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelCalculationsPropertiesTest.cs (revision 0)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelCalculationsPropertiesTest.cs (revision 9a88ce53b48fd94075aeb7ce92b25d63cb8e8782)
@@ -0,0 +1,125 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets 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.ComponentModel;
+using Core.Common.Base;
+using Core.Common.Base.Data;
+using Core.Common.Gui.Converters;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.PropertyClasses;
+using Ringtoets.GrassCoverErosionOutwards.Forms.PropertyClasses;
+
+namespace Ringtoets.GrassCoverErosionOutwards.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class GrassCoverErosionOutwardsDesignWaterLevelCalculationsPropertiesTest
+ {
+ private const int requiredLocationsPropertyIndex = 0;
+
+ [Test]
+ public void Constructor_WithLocations_ExpectedValues()
+ {
+ // Setup
+ var hydraulicBoundaryLocationCalculations = new ObservableList();
+
+ // Call
+ var properties = new GrassCoverErosionOutwardsDesignWaterLevelCalculationsProperties(hydraulicBoundaryLocationCalculations);
+
+ // Assert
+ Assert.IsInstanceOf(properties);
+ Assert.AreSame(hydraulicBoundaryLocationCalculations, properties.Data);
+
+ var dynamicPropertyBag = new DynamicPropertyBag(properties);
+ const string expectedLocationsDisplayName = "Locaties";
+ const string expectedLocationsDescription = "Locaties uit de hydraulische randvoorwaardendatabase.";
+ const string expectedLocationsCategory = "Algemeen";
+ TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true);
+
+ PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties();
+ PropertyDescriptor locationsProperty = dynamicProperties.Find("Locations", false);
+
+ Assert.IsInstanceOf(classTypeConverter);
+ Assert.IsNotNull(locationsProperty);
+ Assert.IsInstanceOf(locationsProperty.Converter);
+ Assert.IsTrue(locationsProperty.IsReadOnly);
+ Assert.IsTrue(locationsProperty.IsBrowsable);
+ Assert.AreEqual(expectedLocationsDisplayName, locationsProperty.DisplayName);
+ Assert.AreEqual(expectedLocationsDescription, locationsProperty.Description);
+ Assert.AreEqual(expectedLocationsCategory, locationsProperty.Category);
+ }
+
+ [Test]
+ public void Constructor_Always_PropertiesHaveExpectedAttributesValues()
+ {
+ // Call
+ var properties = new GrassCoverErosionOutwardsDesignWaterLevelCalculationsProperties(new ObservableList());
+
+ // Assert
+ TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true);
+ Assert.IsInstanceOf(classTypeConverter);
+
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(1, dynamicProperties.Count);
+
+ PropertyDescriptor locationsProperty = dynamicProperties[requiredLocationsPropertyIndex];
+ Assert.IsInstanceOf(locationsProperty.Converter);
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(locationsProperty,
+ "Algemeen",
+ "Locaties",
+ "Locaties uit de hydraulische randvoorwaardendatabase.",
+ true);
+ }
+
+ [Test]
+ public void GetProperties_WithData_ReturnExpectedValues()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation();
+ var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation)
+ {
+ Output = new TestHydraulicBoundaryLocationOutput(1.5, CalculationConvergence.CalculatedConverged)
+ };
+
+ // Call
+ var properties = new GrassCoverErosionOutwardsDesignWaterLevelCalculationsProperties(new ObservableList
+ {
+ hydraulicBoundaryLocationCalculation
+ });
+
+ // Assert
+ Assert.AreEqual(1, properties.Calculations.Length);
+ TestHelper.AssertTypeConverter(
+ nameof(GrassCoverErosionOutwardsDesignWaterLevelCalculationsProperties.Calculations));
+ GrassCoverErosionOutwardsDesignWaterLevelCalculationProperties calculationProperties = properties.Calculations[0];
+ Assert.AreEqual(hydraulicBoundaryLocation.Name, calculationProperties.Name);
+ Assert.AreEqual(hydraulicBoundaryLocation.Id, calculationProperties.Id);
+ Assert.AreEqual(hydraulicBoundaryLocation.Location, calculationProperties.Location);
+
+ RoundedDouble designWaterLevel = hydraulicBoundaryLocationCalculation.Output.Result;
+ Assert.AreEqual(designWaterLevel, calculationProperties.DesignWaterLevel, designWaterLevel.GetAccuracy());
+ Assert.AreEqual("Ja", calculationProperties.Convergence);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 9a88ce53b48fd94075aeb7ce92b25d63cb8e8782 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationsPropertiesTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj
===================================================================
diff -u -r1808e62474dba5945462ff310b654d485008c3d6 -r9a88ce53b48fd94075aeb7ce92b25d63cb8e8782
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj) (revision 1808e62474dba5945462ff310b654d485008c3d6)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj) (revision 9a88ce53b48fd94075aeb7ce92b25d63cb8e8782)
@@ -40,7 +40,7 @@
-
+
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs
===================================================================
diff -u -r1808e62474dba5945462ff310b654d485008c3d6 -r9a88ce53b48fd94075aeb7ce92b25d63cb8e8782
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs (.../GrassCoverErosionOutwardsPluginTest.cs) (revision 1808e62474dba5945462ff310b654d485008c3d6)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs (.../GrassCoverErosionOutwardsPluginTest.cs) (revision 9a88ce53b48fd94075aeb7ce92b25d63cb8e8782)
@@ -129,7 +129,7 @@
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,
typeof(GrassCoverErosionOutwardsDesignWaterLevelLocationsContext),
- typeof(GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties));
+ typeof(GrassCoverErosionOutwardsDesignWaterLevelCalculationsProperties));
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/PropertyInfos/GrassCoverErosionOutwardsDesignWaterLevelLocationsContextPropertyInfoTest.cs
===================================================================
diff -u -ra5bf4f56dbf07e5cf48d0b874f5d46d7d02f0dba -r9a88ce53b48fd94075aeb7ce92b25d63cb8e8782
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/PropertyInfos/GrassCoverErosionOutwardsDesignWaterLevelLocationsContextPropertyInfoTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsContextPropertyInfoTest.cs) (revision a5bf4f56dbf07e5cf48d0b874f5d46d7d02f0dba)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/PropertyInfos/GrassCoverErosionOutwardsDesignWaterLevelLocationsContextPropertyInfoTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsContextPropertyInfoTest.cs) (revision 9a88ce53b48fd94075aeb7ce92b25d63cb8e8782)
@@ -47,7 +47,7 @@
// Assert
Assert.AreEqual(typeof(GrassCoverErosionOutwardsDesignWaterLevelLocationsContext), info.DataType);
- Assert.AreEqual(typeof(GrassCoverErosionOutwardsDesignWaterLevelLocationsProperties), info.PropertyObjectType);
+ Assert.AreEqual(typeof(GrassCoverErosionOutwardsDesignWaterLevelCalculationsProperties), info.PropertyObjectType);
}
}
@@ -72,7 +72,7 @@
IObjectProperties objectProperties = info.CreateInstance(context);
// Assert
- Assert.IsInstanceOf(objectProperties);
+ Assert.IsInstanceOf(objectProperties);
Assert.AreSame(hydraulicBoundaryLocations, objectProperties.Data);
}
mockRepository.VerifyAll();