Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/PropertyClasses/DuneLocationCalculationProperties.cs =================================================================== diff -u --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/PropertyClasses/DuneLocationCalculationProperties.cs (revision 0) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/PropertyClasses/DuneLocationCalculationProperties.cs (revision 1a1c79792a4f6e4ef9f79dce6017a0582f994559) @@ -0,0 +1,231 @@ +// 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.Globalization; +using Core.Common.Base.Data; +using Core.Common.Base.Geometry; +using Core.Common.Gui.PropertyBag; +using Core.Common.Util; +using Core.Common.Util.Attributes; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Forms.TypeConverters; +using Ringtoets.DuneErosion.Data; +using Ringtoets.DuneErosion.Forms.Properties; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; +using DuneErosionDataResources = Ringtoets.DuneErosion.Data.Properties.Resources; + +namespace Ringtoets.DuneErosion.Forms.PropertyClasses +{ + /// + /// ViewModel of for the properties panel. + /// + [TypeConverter(typeof(ExpandableObjectConverter))] + public class DuneLocationCalculationProperties : ObjectProperties + { + /// + /// Creates a new instance of . + /// + /// The dune location calculation at stake. + /// Thrown when any input parameter is null. + public DuneLocationCalculationProperties(DuneLocationCalculation calculation) + { + if (calculation == null) + { + throw new ArgumentNullException(nameof(calculation)); + } + + Data = calculation; + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Id_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Id_Description))] + public long Id + { + get + { + return data.DuneLocation.Id; + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Name_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Name_Description))] + public string Name + { + get + { + return data.DuneLocation.Name; + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.DuneLocation_CoastalAreaId_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.DuneLocation_CoastalAreaId_Description))] + public int CoastalAreaId + { + get + { + return data.DuneLocation.CoastalAreaId; + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.DuneLocation_Offset_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.DuneLocation_Offset_Description))] + public string Offset + { + get + { + return data.DuneLocation.Offset + .ToString(DuneErosionDataResources.DuneLocation_Offset_format, + CultureInfo.InvariantCulture); + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Coordinates_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Coordinates_Description))] + public Point2D Location + { + get + { + return data.DuneLocation.Location; + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.DuneLocation_WaterLevel_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.DuneLocation_WaterLevel_Description))] + [TypeConverter(typeof(NoValueRoundedDoubleConverter))] + public RoundedDouble WaterLevel + { + get + { + return data.Output?.WaterLevel ?? RoundedDouble.NaN; + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.DuneLocation_WaveHeight_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.DuneLocation_WaveHeight_Description))] + [TypeConverter(typeof(NoValueRoundedDoubleConverter))] + public RoundedDouble WaveHeight + { + get + { + return data.Output?.WaveHeight ?? RoundedDouble.NaN; + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.DuneLocation_WavePeriod_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.DuneLocation_WavePeriod_Description))] + [TypeConverter(typeof(NoValueRoundedDoubleConverter))] + public RoundedDouble WavePeriod + { + get + { + return data.Output?.WavePeriod ?? RoundedDouble.NaN; + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.DuneLocation_D50_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.DuneLocation_D50_Description))] + [TypeConverter(typeof(NoValueRoundedDoubleConverter))] + public RoundedDouble D50 + { + get + { + return data.DuneLocation.D50; + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_TargetProbability_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_TargetProbability_Description))] + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double TargetProbability + { + get + { + return data.Output?.TargetProbability ?? double.NaN; + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_TargetReliability_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_TargetReliability_Description))] + [TypeConverter(typeof(NoValueRoundedDoubleConverter))] + public RoundedDouble TargetReliability + { + get + { + return data.Output?.TargetReliability ?? RoundedDouble.NaN; + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_CalculatedProbability_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_CalculatedProbability_Description))] + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double CalculatedProbability + { + get + { + return data.Output?.CalculatedProbability ?? double.NaN; + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_CalculatedReliability_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_CalculatedReliability_Description))] + [TypeConverter(typeof(NoValueRoundedDoubleConverter))] + public RoundedDouble CalculatedReliability + { + get + { + return data.Output?.CalculatedReliability ?? RoundedDouble.NaN; + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_Convergence_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.DuneLocation_Convergence_Description))] + public string Convergence + { + get + { + CalculationConvergence convergence = data.Output?.CalculationConvergence ?? CalculationConvergence.NotCalculated; + + return new EnumDisplayWrapper(convergence).DisplayName; + } + } + + public override string ToString() + { + return $"{Name} {Location}"; + } + } +} \ No newline at end of file Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/PropertyClasses/DuneLocationCalculationsProperties.cs =================================================================== diff -u -rca1ede3f782e2d868bd15ba69694c1234a96c64e -r1a1c79792a4f6e4ef9f79dce6017a0582f994559 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/PropertyClasses/DuneLocationCalculationsProperties.cs (.../DuneLocationCalculationsProperties.cs) (revision ca1ede3f782e2d868bd15ba69694c1234a96c64e) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/PropertyClasses/DuneLocationCalculationsProperties.cs (.../DuneLocationCalculationsProperties.cs) (revision 1a1c79792a4f6e4ef9f79dce6017a0582f994559) @@ -62,11 +62,11 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Locations_DisplayName))] [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Locations_Description))] - public DuneLocationProperties[] Locations + public DuneLocationCalculationProperties[] Calculations { get { - return data.Select(calculation => new DuneLocationProperties(calculation)).ToArray(); + return data.Select(calculation => new DuneLocationCalculationProperties(calculation)).ToArray(); } } Fisheye: Tag 1a1c79792a4f6e4ef9f79dce6017a0582f994559 refers to a dead (removed) revision in file `Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/PropertyClasses/DuneLocationProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Ringtoets.DuneErosion.Forms.csproj =================================================================== diff -u -rb4166249e5330682bae1f5d4cb02b3cd05a75647 -r1a1c79792a4f6e4ef9f79dce6017a0582f994559 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Ringtoets.DuneErosion.Forms.csproj (.../Ringtoets.DuneErosion.Forms.csproj) (revision b4166249e5330682bae1f5d4cb02b3cd05a75647) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Ringtoets.DuneErosion.Forms.csproj (.../Ringtoets.DuneErosion.Forms.csproj) (revision 1a1c79792a4f6e4ef9f79dce6017a0582f994559) @@ -24,7 +24,7 @@ - + True True Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs =================================================================== diff -u -rca1ede3f782e2d868bd15ba69694c1234a96c64e -r1a1c79792a4f6e4ef9f79dce6017a0582f994559 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs (.../DuneErosionPlugin.cs) (revision ca1ede3f782e2d868bd15ba69694c1234a96c64e) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs (.../DuneErosionPlugin.cs) (revision 1a1c79792a4f6e4ef9f79dce6017a0582f994559) @@ -66,9 +66,9 @@ CreateInstance = context => new DuneLocationCalculationsProperties(context.WrappedData) }; - yield return new PropertyInfo + yield return new PropertyInfo { - CreateInstance = location => new DuneLocationProperties(location.Calculation) + CreateInstance = location => new DuneLocationCalculationProperties(location.Calculation) }; } Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/PropertyClasses/DuneLocationCalculationPropertiesTest.cs =================================================================== diff -u --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/PropertyClasses/DuneLocationCalculationPropertiesTest.cs (revision 0) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/PropertyClasses/DuneLocationCalculationPropertiesTest.cs (revision 1a1c79792a4f6e4ef9f79dce6017a0582f994559) @@ -0,0 +1,329 @@ +// 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.Globalization; +using Core.Common.Base.Geometry; +using Core.Common.TestUtil; +using Core.Common.Util; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; +using Ringtoets.DuneErosion.Data; +using Ringtoets.DuneErosion.Data.TestUtil; +using Ringtoets.DuneErosion.Forms.PropertyClasses; + +namespace Ringtoets.DuneErosion.Forms.Test.PropertyClasses +{ + [TestFixture] + public class DuneLocationCalculationPropertiesTest + { + private const int requiredIdPropertyIndex = 0; + private const int requiredNamePropertyIndex = 1; + private const int requiredCoastalAreaIdPropertyIndex = 2; + private const int requiredOffSetPropertyIndex = 3; + private const int requiredLocationPropertyIndex = 4; + + private const int requiredWaterLevelPropertyIndex = 5; + private const int requiredWaveHeightPropertyIndex = 6; + private const int requiredWavePeriodPropertyIndex = 7; + private const int requiredD50PropertyIndex = 8; + private const int requiredTargetProbabilityPropertyIndex = 9; + private const int requiredTargetReliabilityPropertyIndex = 10; + private const int requiredCalculatedProbabilityPropertyIndex = 11; + private const int requiredCalculatedReliabilityPropertyIndex = 12; + private const int requiredConvergencePropertyIndex = 13; + + [Test] + public void Constructor_DuneLocationCalculationNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new DuneLocationCalculationProperties(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("calculation", exception.ParamName); + } + + [Test] + public void GetProperties_ValidData_ReturnsExpectedValues() + { + // Setup + var duneLocation = new TestDuneLocation(); + var duneLocationCalculation = new DuneLocationCalculation(duneLocation); + + // Call + var properties = new DuneLocationCalculationProperties(duneLocationCalculation); + + // Assert + Assert.AreEqual(duneLocation.Id, properties.Id); + Assert.AreEqual(duneLocation.Name, properties.Name); + Assert.AreEqual(duneLocation.CoastalAreaId, properties.CoastalAreaId); + Assert.AreEqual(duneLocation.Offset.ToString("0.#", CultureInfo.InvariantCulture), properties.Offset); + Assert.AreEqual(duneLocation.Location, properties.Location); + + Assert.IsNaN(properties.WaterLevel); + Assert.IsNaN(properties.WaveHeight); + Assert.IsNaN(properties.WavePeriod); + + Assert.IsNaN(properties.TargetProbability); + TestHelper.AssertTypeConverter( + nameof(DuneLocationCalculationProperties.TargetProbability)); + Assert.IsNaN(properties.TargetReliability); + TestHelper.AssertTypeConverter( + nameof(DuneLocationCalculationProperties.TargetReliability)); + + Assert.IsNaN(properties.CalculatedProbability); + TestHelper.AssertTypeConverter( + nameof(DuneLocationCalculationProperties.CalculatedProbability)); + Assert.IsNaN(properties.CalculatedReliability); + TestHelper.AssertTypeConverter( + nameof(DuneLocationCalculationProperties.CalculatedReliability)); + + string convergenceValue = new EnumDisplayWrapper(CalculationConvergence.NotCalculated).DisplayName; + Assert.AreEqual(convergenceValue, properties.Convergence); + } + + [Test] + public void GetProperties_ValidDesignWaterLevel_ReturnsExpectedValues() + { + // Setup + const long id = 1234L; + const double x = 567.0; + const double y = 890.0; + const string name = ""; + + var random = new Random(); + int coastalAreaId = random.Next(); + var convergence = random.NextEnumValue(); + double offset = random.NextDouble(); + double orientation = random.NextDouble(); + double d50 = random.NextDouble(); + double waterLevel = random.NextDouble(); + double waveHeight = random.NextDouble(); + double wavePeriod = random.NextDouble(); + double targetProbability = random.NextDouble(); + double targetReliability = random.NextDouble(); + double calculatedProbability = random.NextDouble(); + double calculatedReliability = random.NextDouble(); + + var output = new DuneLocationOutput( + convergence, + new DuneLocationOutput.ConstructionProperties + { + WaterLevel = waterLevel, + WaveHeight = waveHeight, + WavePeriod = wavePeriod, + TargetProbability = targetProbability, + TargetReliability = targetReliability, + CalculatedProbability = calculatedProbability, + CalculatedReliability = calculatedReliability + }); + var duneLocation = new DuneLocation(id, name, new Point2D(x, y), + new DuneLocation.ConstructionProperties + { + CoastalAreaId = coastalAreaId, + Offset = offset, + Orientation = orientation, + D50 = d50 + }); + var duneLocationCalculation = new DuneLocationCalculation(duneLocation) + { + Output = output + }; + + // Call + var properties = new DuneLocationCalculationProperties(duneLocationCalculation); + + // Assert + Assert.AreEqual(id, properties.Id); + Assert.AreEqual(name, properties.Name); + Assert.AreEqual(coastalAreaId, properties.CoastalAreaId); + Assert.AreEqual(duneLocation.Offset.ToString("0.#", CultureInfo.InvariantCulture), properties.Offset); + var expectedLocation = new Point2D(x, y); + Assert.AreEqual(expectedLocation, properties.Location); + + Assert.AreEqual(waterLevel, properties.WaterLevel, properties.WaterLevel.GetAccuracy()); + Assert.AreEqual(waveHeight, properties.WaveHeight, properties.WaveHeight.GetAccuracy()); + Assert.AreEqual(wavePeriod, properties.WavePeriod, properties.WavePeriod.GetAccuracy()); + Assert.AreEqual(d50, properties.D50, properties.D50.GetAccuracy()); + + Assert.AreEqual(targetProbability, properties.TargetProbability); + Assert.AreEqual(targetReliability, properties.TargetReliability, properties.TargetReliability.GetAccuracy()); + Assert.AreEqual(calculatedProbability, properties.CalculatedProbability, properties.CalculatedProbability); + Assert.AreEqual(calculatedReliability, properties.CalculatedReliability, properties.CalculatedReliability.GetAccuracy()); + + string convergenceValue = new EnumDisplayWrapper(convergence).DisplayName; + Assert.AreEqual(convergenceValue, properties.Convergence); + } + + [Test] + public void Constructor_Always_PropertiesHaveExpectedAttributesValues() + { + // Setup + var duneLocationCalculation = new DuneLocationCalculation(new TestDuneLocation()); + + // Call + var properties = new DuneLocationCalculationProperties(duneLocationCalculation); + + // Assert + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(14, dynamicProperties.Count); + Assert.IsInstanceOf(classTypeConverter); + + PropertyDescriptor idProperty = dynamicProperties[requiredIdPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(idProperty, + "Algemeen", + "ID", + "ID van de hydraulische randvoorwaardenlocatie in de database.", + true); + + PropertyDescriptor nameProperty = dynamicProperties[requiredNamePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty, + "Algemeen", + "Naam", + "Naam van de hydraulische randvoorwaardenlocatie.", + true); + + PropertyDescriptor coastalAreaIdProperty = dynamicProperties[requiredCoastalAreaIdPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(coastalAreaIdProperty, + "Algemeen", + "Kustvaknummer", + "Nummer van het kustvak waar de locatie onderdeel van uitmaakt.", + true); + + PropertyDescriptor offsetProperty = dynamicProperties[requiredOffSetPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(offsetProperty, + "Algemeen", + "Metrering [dam]", + "Metrering van de locatie binnen het kustvak waar het onderdeel van uitmaakt.", + true); + + PropertyDescriptor locationProperty = dynamicProperties[requiredLocationPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(locationProperty, + "Algemeen", + "Coördinaten [m]", + "Coördinaten van de hydraulische randvoorwaardenlocatie.", + true); + + PropertyDescriptor waterLevelProperty = dynamicProperties[requiredWaterLevelPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(waterLevelProperty, + "Resultaat", + "Rekenwaarde waterstand [m+NAP]", + "Berekende rekenwaarde voor de waterstand voor het uitvoeren van een sterkteberekening voor het toetsspoor duinen.", + true); + + PropertyDescriptor waveHeightProperty = dynamicProperties[requiredWaveHeightPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(waveHeightProperty, + "Resultaat", + "Rekenwaarde Hs [m]", + "Berekende rekenwaarde voor de significante golfhoogte voor het uitvoeren van een sterkteberekening voor het toetsspoor duinen.", + true); + + PropertyDescriptor wavePeriodProperty = dynamicProperties[requiredWavePeriodPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(wavePeriodProperty, + "Resultaat", + "Rekenwaarde Tp [s]", + "Berekende rekenwaarde voor de piekperiode van de golven voor het uitvoeren van een sterkteberekening voor het toetsspoor duinen.", + true); + + PropertyDescriptor d50Property = dynamicProperties[requiredD50PropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(d50Property, + "Resultaat", + "Rekenwaarde d50 [m]", + "Rekenwaarde voor de d50 voor het uitvoeren van een sterkteberekening voor het toetsspoor duinen.", + true); + + PropertyDescriptor targetProbabilityProperty = dynamicProperties[requiredTargetProbabilityPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetProbabilityProperty, + "Resultaat", + "Doelkans [1/jaar]", + "De ingevoerde kans waarvoor het resultaat moet worden berekend.", + true); + + PropertyDescriptor targetReliabilityProperty = dynamicProperties[requiredTargetReliabilityPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetReliabilityProperty, + "Resultaat", + "Betrouwbaarheidsindex doelkans [-]", + "Betrouwbaarheidsindex van de ingevoerde kans waarvoor het resultaat moet worden berekend.", + true); + + PropertyDescriptor calculatedProbabilityProperty = dynamicProperties[requiredCalculatedProbabilityPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedProbabilityProperty, + "Resultaat", + "Berekende kans [1/jaar]", + "De berekende kans van voorkomen van het berekende resultaat.", + true); + + PropertyDescriptor calculatedReliabilityProperty = dynamicProperties[requiredCalculatedReliabilityPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedReliabilityProperty, + "Resultaat", + "Betrouwbaarheidsindex berekende kans [-]", + "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.", + true); + + PropertyDescriptor convergenceProperty = dynamicProperties[requiredConvergencePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(convergenceProperty, + "Resultaat", + "Convergentie", + "Is convergentie bereikt in de berekening voor de hydraulische randvoorwaarden van de duinlocatie?", + true); + } + + [Test] + [TestCase(3.0, "3")] + [TestCase(3.1, "3.1")] + public void Offset_Always_FormatToString(double offset, string expectedPropertyValue) + { + var duneLocation = new DuneLocation(1, "test", new Point2D(0, 0), + new DuneLocation.ConstructionProperties + { + Offset = offset + }); + var duneLocationCalculation = new DuneLocationCalculation(duneLocation); + + // Call + var properties = new DuneLocationCalculationProperties(duneLocationCalculation); + + // Assert + Assert.AreEqual(expectedPropertyValue, properties.Offset); + } + + [Test] + public void ToString_Always_ExpectedValue() + { + // Setup + var duneLocation = new DuneLocation(1, "Name", new Point2D(0.0, 1.1), new DuneLocation.ConstructionProperties()); + var duneLocationCalculation = new DuneLocationCalculation(duneLocation); + var properties = new DuneLocationCalculationProperties(duneLocationCalculation); + + // Call + string result = properties.ToString(); + + // Assert + Assert.AreEqual($"{duneLocation.Name} {duneLocation.Location}", result); + } + } +} \ No newline at end of file Fisheye: Tag 1a1c79792a4f6e4ef9f79dce6017a0582f994559 refers to a dead (removed) revision in file `Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/PropertyClasses/DuneLocationPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Ringtoets.DuneErosion.Forms.Test.csproj =================================================================== diff -u -rb4166249e5330682bae1f5d4cb02b3cd05a75647 -r1a1c79792a4f6e4ef9f79dce6017a0582f994559 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Ringtoets.DuneErosion.Forms.Test.csproj (.../Ringtoets.DuneErosion.Forms.Test.csproj) (revision b4166249e5330682bae1f5d4cb02b3cd05a75647) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Ringtoets.DuneErosion.Forms.Test.csproj (.../Ringtoets.DuneErosion.Forms.Test.csproj) (revision 1a1c79792a4f6e4ef9f79dce6017a0582f994559) @@ -30,7 +30,7 @@ - + Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/DuneErosionPluginTest.cs =================================================================== diff -u -rb4166249e5330682bae1f5d4cb02b3cd05a75647 -r1a1c79792a4f6e4ef9f79dce6017a0582f994559 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/DuneErosionPluginTest.cs (.../DuneErosionPluginTest.cs) (revision b4166249e5330682bae1f5d4cb02b3cd05a75647) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/DuneErosionPluginTest.cs (.../DuneErosionPluginTest.cs) (revision 1a1c79792a4f6e4ef9f79dce6017a0582f994559) @@ -87,7 +87,7 @@ PluginTestHelper.AssertPropertyInfoDefined( propertyInfos, typeof(DuneLocation), - typeof(DuneLocationProperties)); + typeof(DuneLocationCalculationProperties)); } } Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/PropertyInfos/DuneLocationPropertyInfoTest.cs =================================================================== diff -u -ra5bf4f56dbf07e5cf48d0b874f5d46d7d02f0dba -r1a1c79792a4f6e4ef9f79dce6017a0582f994559 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/PropertyInfos/DuneLocationPropertyInfoTest.cs (.../DuneLocationPropertyInfoTest.cs) (revision a5bf4f56dbf07e5cf48d0b874f5d46d7d02f0dba) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/PropertyInfos/DuneLocationPropertyInfoTest.cs (.../DuneLocationPropertyInfoTest.cs) (revision 1a1c79792a4f6e4ef9f79dce6017a0582f994559) @@ -43,7 +43,7 @@ // Assert Assert.AreEqual(typeof(DuneLocation), info.DataType); - Assert.AreEqual(typeof(DuneLocationProperties), info.PropertyObjectType); + Assert.AreEqual(typeof(DuneLocationCalculationProperties), info.PropertyObjectType); } } @@ -61,7 +61,7 @@ IObjectProperties objectProperties = info.CreateInstance(duneLocation); // Assert - Assert.IsInstanceOf(objectProperties); + Assert.IsInstanceOf(objectProperties); Assert.AreSame(duneLocation, objectProperties.Data); } }