Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj
===================================================================
diff -u -r9e54793f4e953bf1a1b9c9f9d731de4831dd9ff6 -r4b095752c115dd672400da5a4acc1560e4c9ce2c
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 9e54793f4e953bf1a1b9c9f9d731de4831dd9ff6)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 4b095752c115dd672400da5a4acc1560e4c9ce2c)
@@ -60,6 +60,7 @@
Properties\GlobalAssembly.cs
+
@@ -251,6 +252,7 @@
RingtoetsEntities.tt
+
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructures/ClosingStructureCalculationCreateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructures/ClosingStructureCalculationCreateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructures/ClosingStructureCalculationCreateExtensions.cs (revision 4b095752c115dd672400da5a4acc1560e4c9ce2c)
@@ -0,0 +1,145 @@
+// Copyright (C) Stichting Deltares 2016. 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 Application.Ringtoets.Storage.DbContext;
+using Core.Common.Utils.Extensions;
+using Ringtoets.ClosingStructures.Data;
+using Ringtoets.Common.Data.Structures;
+
+namespace Application.Ringtoets.Storage.Create.ClosingStructures
+{
+ ///
+ /// Extension methods for related
+ /// to creating a .
+ ///
+ internal static class ClosingStructureCalculationCreateExtensions
+ {
+ ///
+ /// Creates a based
+ /// on the information of the .
+ ///
+ /// The calculation to create a database entity for.
+ /// The object keeping track of create operations.
+ /// The index at where resides
+ /// in its parent container.
+ /// A new .
+ /// Thrown when is null.
+ internal static ClosingStructuresCalculationEntity Create(this StructuresCalculation calculation, PersistenceRegistry registry, int order)
+ {
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ var entity = new ClosingStructuresCalculationEntity
+ {
+ Name = calculation.Name.DeepClone(),
+ Comments = calculation.Comments.DeepClone(),
+ Order = order
+ };
+ SetInputValues(entity, calculation.InputParameters, registry);
+
+ return entity;
+ }
+
+ private static void SetInputValues(ClosingStructuresCalculationEntity entity, ClosingStructuresInput input, PersistenceRegistry registry)
+ {
+ SetBaseStructureInputValues(entity, input, registry);
+ SetClosingStructureSpecificInputValues(entity, input);
+ }
+
+ private static void SetBaseStructureInputValues(ClosingStructuresCalculationEntity entity, StructuresInputBase input, PersistenceRegistry registry)
+ {
+ entity.StormDurationMean = input.StormDuration.Mean.Value.ToNaNAsNull();
+ entity.StructureNormalOrientation = input.StructureNormalOrientation.Value.ToNaNAsNull();
+ entity.FailureProbabilityStructureWithErosion = input.FailureProbabilityStructureWithErosion;
+
+ if (input.Structure != null)
+ {
+ entity.ClosingStructureEntity = registry.Get(input.Structure);
+ }
+
+ if (input.HydraulicBoundaryLocation != null)
+ {
+ entity.HydraulicLocationEntity = registry.Get(input.HydraulicBoundaryLocation);
+ }
+
+ if (input.ForeshoreProfile != null)
+ {
+ entity.ForeshoreProfileEntity = registry.Get(input.ForeshoreProfile);
+ }
+ entity.UseForeshore = Convert.ToByte(input.UseForeshore);
+
+ entity.UseBreakWater = Convert.ToByte(input.UseBreakWater);
+ entity.BreakWaterType = Convert.ToInt16(input.BreakWater.Type);
+ entity.BreakWaterHeight = input.BreakWater.Height.Value.ToNaNAsNull();
+
+ entity.AllowedLevelIncreaseStorageMean = input.AllowedLevelIncreaseStorage.Mean.Value.ToNaNAsNull();
+ entity.AllowedLevelIncreaseStorageStandardDeviation = input.AllowedLevelIncreaseStorage.StandardDeviation.Value.ToNaNAsNull();
+
+ entity.StorageStructureAreaMean = input.StorageStructureArea.Mean.Value.ToNaNAsNull();
+ entity.StorageStructureAreaCoefficientOfVariation = input.StorageStructureArea.CoefficientOfVariation.Value.ToNaNAsNull();
+
+ entity.FlowWidthAtBottomProtectionMean = input.FlowWidthAtBottomProtection.Mean.Value.ToNaNAsNull();
+ entity.FlowWidthAtBottomProtectionStandardDeviation = input.FlowWidthAtBottomProtection.StandardDeviation.Value.ToNaNAsNull();
+
+ entity.CriticalOvertoppingDischargeMean = input.CriticalOvertoppingDischarge.Mean.Value.ToNaNAsNull();
+ entity.CriticalOvertoppingDischargeCoefficientOfVariation = input.CriticalOvertoppingDischarge.CoefficientOfVariation.Value.ToNaNAsNull();
+
+ entity.ModelFactorSuperCriticalFlowMean = input.ModelFactorSuperCriticalFlow.Mean.Value.ToNaNAsNull();
+
+ entity.WidthFlowAperturesMean = input.WidthFlowApertures.Mean.Value.ToNaNAsNull();
+ entity.WidthFlowAperturesCoefficientOfVariation = input.WidthFlowApertures.CoefficientOfVariation.Value.ToNaNAsNull();
+ }
+
+ private static void SetClosingStructureSpecificInputValues(ClosingStructuresCalculationEntity entity, ClosingStructuresInput input)
+ {
+ entity.InflowModelType = Convert.ToByte(input.InflowModelType);
+
+ entity.InsideWaterLevelMean = input.InsideWaterLevel.Mean.Value.ToNaNAsNull();
+ entity.InsideWaterLevelStandardDeviation = input.InsideWaterLevel.StandardDeviation.Value.ToNaNAsNull();
+
+ entity.DeviationWaveDirection = input.DeviationWaveDirection.Value.ToNaNAsNull();
+
+ entity.DrainCoefficientMean = input.DrainCoefficient.Mean.Value.ToNaNAsNull();
+
+ entity.FactorStormDurationOpenStructure = input.FactorStormDurationOpenStructure.Value.ToNaNAsNull();
+
+ entity.ThresholdHeightOpenWeirMean = input.ThresholdHeightOpenWeir.Mean.Value.ToNaNAsNull();
+ entity.ThresholdHeightOpenWeirStandardDeviation = input.ThresholdHeightOpenWeir.StandardDeviation.Value.ToNaNAsNull();
+
+ entity.AreaFlowAperturesMean = input.AreaFlowApertures.Mean.Value.ToNaNAsNull();
+ entity.AreaFlowAperturesStandardDeviation = input.AreaFlowApertures.StandardDeviation.Value.ToNaNAsNull();
+
+ entity.FailureProbabilityOpenStructure = input.FailureProbabilityOpenStructure;
+
+ entity.FailureProbablityReparation = input.FailureProbabilityReparation;
+
+ entity.IdenticalApertures = input.IdenticalApertures;
+
+ entity.LevelCrestStructureNotClosingMean = input.LevelCrestStructureNotClosing.Mean.Value.ToNaNAsNull();
+ entity.LevelCrestStructureNotClosingStandardDeviation = input.LevelCrestStructureNotClosing.StandardDeviation.Value.ToNaNAsNull();
+
+ entity.ProbabilityOpenStructureBeforeFlooding = input.ProbabilityOpenStructureBeforeFlooding;
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ClosingStructures/ClosingStructuresCalculationEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ClosingStructures/ClosingStructuresCalculationEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ClosingStructures/ClosingStructuresCalculationEntityReadExtensions.cs (revision 4b095752c115dd672400da5a4acc1560e4c9ce2c)
@@ -0,0 +1,127 @@
+// Copyright (C) Stichting Deltares 2016. 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 Application.Ringtoets.Storage.DbContext;
+using Core.Common.Base.Data;
+using Ringtoets.ClosingStructures.Data;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.Structures;
+
+namespace Application.Ringtoets.Storage.Read.ClosingStructures
+{
+ ///
+ /// This class defines extension methods for read operations for a
+ /// based on the .
+ ///
+ internal static class ClosingStructuresCalculationEntityReadExtensions
+ {
+ ///
+ /// Reads the and use the
+ /// information to update a .
+ ///
+ /// The
+ /// to create for.
+ /// The object keeping track of read operations.
+ /// A new .
+ /// Thrown when is null.
+ internal static StructuresCalculation Read(this ClosingStructuresCalculationEntity entity, ReadConversionCollector collector)
+ {
+ if (collector == null)
+ {
+ throw new ArgumentNullException("collector");
+ }
+
+ var calculation = new StructuresCalculation
+ {
+ Name = entity.Name,
+ Comments = entity.Comments
+ };
+ ReadInputParameters(calculation.InputParameters, entity, collector);
+
+ return calculation;
+ }
+
+ private static void ReadInputParameters(ClosingStructuresInput inputParameters, ClosingStructuresCalculationEntity entity, ReadConversionCollector collector)
+ {
+ ReadBaseStructuresInputParameters(inputParameters, entity, collector);
+ ReadClosingStructuresSpecificInputParameters(inputParameters, entity);
+ }
+
+ private static void ReadBaseStructuresInputParameters(StructuresInputBase structuresInputBase,
+ ClosingStructuresCalculationEntity entity,
+ ReadConversionCollector collector)
+ {
+ if (entity.ForeshoreProfileEntity != null)
+ {
+ structuresInputBase.ForeshoreProfile = entity.ForeshoreProfileEntity.Read(collector);
+ }
+ if (entity.ClosingStructureEntity != null)
+ {
+ structuresInputBase.Structure = entity.ClosingStructureEntity.Read(collector);
+ }
+ if (entity.HydraulicLocationEntity != null)
+ {
+ structuresInputBase.HydraulicBoundaryLocation = entity.HydraulicLocationEntity.Read(collector);
+ }
+
+ structuresInputBase.StructureNormalOrientation = (RoundedDouble) entity.StructureNormalOrientation.ToNullAsNaN();
+ structuresInputBase.ModelFactorSuperCriticalFlow.Mean = (RoundedDouble) entity.ModelFactorSuperCriticalFlowMean.ToNullAsNaN();
+ structuresInputBase.AllowedLevelIncreaseStorage.Mean = (RoundedDouble) entity.AllowedLevelIncreaseStorageMean.ToNullAsNaN();
+ structuresInputBase.AllowedLevelIncreaseStorage.StandardDeviation = (RoundedDouble) entity.AllowedLevelIncreaseStorageStandardDeviation.ToNullAsNaN();
+ structuresInputBase.StorageStructureArea.Mean = (RoundedDouble) entity.StorageStructureAreaMean.ToNullAsNaN();
+ structuresInputBase.StorageStructureArea.CoefficientOfVariation = (RoundedDouble) entity.StorageStructureAreaCoefficientOfVariation.ToNullAsNaN();
+ structuresInputBase.FlowWidthAtBottomProtection.Mean = (RoundedDouble) entity.FlowWidthAtBottomProtectionMean.ToNullAsNaN();
+ structuresInputBase.FlowWidthAtBottomProtection.StandardDeviation = (RoundedDouble) entity.FlowWidthAtBottomProtectionStandardDeviation.ToNullAsNaN();
+ structuresInputBase.CriticalOvertoppingDischarge.Mean = (RoundedDouble) entity.CriticalOvertoppingDischargeMean.ToNullAsNaN();
+ structuresInputBase.CriticalOvertoppingDischarge.CoefficientOfVariation = (RoundedDouble) entity.CriticalOvertoppingDischargeCoefficientOfVariation.ToNullAsNaN();
+ structuresInputBase.FailureProbabilityStructureWithErosion = entity.FailureProbabilityStructureWithErosion;
+ structuresInputBase.WidthFlowApertures.Mean = (RoundedDouble) entity.WidthFlowAperturesMean.ToNullAsNaN();
+ structuresInputBase.WidthFlowApertures.CoefficientOfVariation = (RoundedDouble) entity.WidthFlowAperturesCoefficientOfVariation.ToNullAsNaN();
+ structuresInputBase.StormDuration.Mean = (RoundedDouble) entity.StormDurationMean.ToNullAsNaN();
+
+ structuresInputBase.UseBreakWater = Convert.ToBoolean(entity.UseBreakWater);
+ structuresInputBase.BreakWater.Type = (BreakWaterType)entity.BreakWaterType;
+ structuresInputBase.BreakWater.Height = (RoundedDouble)entity.BreakWaterHeight.ToNullAsNaN();
+ structuresInputBase.UseForeshore = Convert.ToBoolean(entity.UseForeshore);
+ }
+
+ private static void ReadClosingStructuresSpecificInputParameters(ClosingStructuresInput inputParameters, ClosingStructuresCalculationEntity entity)
+ {
+ inputParameters.InflowModelType = (ClosingStructureInflowModelType) entity.InflowModelType;
+ inputParameters.InsideWaterLevel.Mean = (RoundedDouble) entity.InsideWaterLevelMean.ToNullAsNaN();
+ inputParameters.InsideWaterLevel.StandardDeviation = (RoundedDouble) entity.InsideWaterLevelStandardDeviation.ToNullAsNaN();
+ inputParameters.DeviationWaveDirection = (RoundedDouble) entity.DeviationWaveDirection.ToNullAsNaN();
+ inputParameters.DrainCoefficient.Mean = (RoundedDouble) entity.DrainCoefficientMean.ToNullAsNaN();
+ inputParameters.FactorStormDurationOpenStructure = (RoundedDouble) entity.FactorStormDurationOpenStructure.ToNullAsNaN();
+ inputParameters.ThresholdHeightOpenWeir.Mean = (RoundedDouble) entity.ThresholdHeightOpenWeirMean.ToNullAsNaN();
+ inputParameters.ThresholdHeightOpenWeir.StandardDeviation = (RoundedDouble) entity.ThresholdHeightOpenWeirStandardDeviation.ToNullAsNaN();
+ inputParameters.AreaFlowApertures.Mean = (RoundedDouble) entity.AreaFlowAperturesMean.ToNullAsNaN();
+ inputParameters.AreaFlowApertures.StandardDeviation = (RoundedDouble) entity.AreaFlowAperturesStandardDeviation.ToNullAsNaN();
+ inputParameters.FailureProbabilityOpenStructure = entity.FailureProbabilityOpenStructure;
+ inputParameters.FailureProbabilityReparation = entity.FailureProbablityReparation;
+ inputParameters.IdenticalApertures = entity.IdenticalApertures;
+ inputParameters.LevelCrestStructureNotClosing.Mean = (RoundedDouble) entity.LevelCrestStructureNotClosingMean.ToNullAsNaN();
+ inputParameters.LevelCrestStructureNotClosing.StandardDeviation = (RoundedDouble) entity.LevelCrestStructureNotClosingStandardDeviation.ToNullAsNaN();
+ inputParameters.ProbabilityOpenStructureBeforeFlooding = entity.ProbabilityOpenStructureBeforeFlooding;
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj
===================================================================
diff -u -r08bb51221d82157423573733a9bf43e0191c9b68 -r4b095752c115dd672400da5a4acc1560e4c9ce2c
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 08bb51221d82157423573733a9bf43e0191c9b68)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 4b095752c115dd672400da5a4acc1560e4c9ce2c)
@@ -77,6 +77,7 @@
Properties\GlobalAssembly.cs
+
@@ -92,6 +93,7 @@
+
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructures/ClosingStructureCalculationCreateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructures/ClosingStructureCalculationCreateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructures/ClosingStructureCalculationCreateExtensionsTest.cs (revision 4b095752c115dd672400da5a4acc1560e4c9ce2c)
@@ -0,0 +1,356 @@
+using System;
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.Create.ClosingStructures;
+using Application.Ringtoets.Storage.DbContext;
+using Core.Common.Base.Data;
+using Core.Common.Base.Geometry;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.ClosingStructures.Data;
+using Ringtoets.ClosingStructures.Data.TestUtil;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.Structures;
+using Ringtoets.HydraRing.Data;
+
+namespace Application.Ringtoets.Storage.Test.Create.ClosingStructures
+{
+ [TestFixture]
+ public class ClosingStructureCalculationCreateExtensionsTest
+ {
+ [Test]
+ public void Create_RegistryIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var calculation = new StructuresCalculation();
+
+ // Call
+ TestDelegate call = () => calculation.Create(null, 0);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Create_ValidCalculation_ReturnClosingStructuresCalculationEntity()
+ {
+ // Setup
+ var random = new Random(45);
+ var calculation = new StructuresCalculation
+ {
+ Name = "A",
+ Comments = "B",
+ InputParameters =
+ {
+ StormDuration =
+ {
+ Mean = (RoundedDouble) random.NextDouble(),
+ },
+ StructureNormalOrientation = (RoundedDouble) random.NextDouble(),
+ FailureProbabilityStructureWithErosion = (RoundedDouble) random.NextDouble(),
+ UseForeshore = random.NextBoolean(),
+ UseBreakWater = random.NextBoolean(),
+ BreakWater =
+ {
+ Type = BreakWaterType.Dam,
+ Height = (RoundedDouble) random.NextDouble()
+ },
+ AllowedLevelIncreaseStorage =
+ {
+ Mean = (RoundedDouble) random.NextDouble(),
+ StandardDeviation = (RoundedDouble) random.NextDouble()
+ },
+ StorageStructureArea =
+ {
+ Mean = (RoundedDouble) random.NextDouble(),
+ CoefficientOfVariation = (RoundedDouble) random.NextDouble()
+ },
+ FlowWidthAtBottomProtection =
+ {
+ Mean = (RoundedDouble) random.NextDouble(),
+ StandardDeviation = (RoundedDouble) random.NextDouble()
+ },
+ CriticalOvertoppingDischarge =
+ {
+ Mean = (RoundedDouble) random.NextDouble(),
+ CoefficientOfVariation = (RoundedDouble) random.NextDouble()
+ },
+ ModelFactorSuperCriticalFlow =
+ {
+ Mean = (RoundedDouble) random.NextDouble()
+ },
+ WidthFlowApertures =
+ {
+ Mean = (RoundedDouble) random.NextDouble(),
+ CoefficientOfVariation = (RoundedDouble) random.NextDouble()
+ },
+ InflowModelType = ClosingStructureInflowModelType.VerticalWall,
+ InsideWaterLevel =
+ {
+ Mean = (RoundedDouble) random.NextDouble(),
+ StandardDeviation = (RoundedDouble) random.NextDouble()
+ },
+ DeviationWaveDirection = (RoundedDouble) random.NextDouble(),
+ DrainCoefficient =
+ {
+ Mean = (RoundedDouble) random.NextDouble()
+ },
+ FactorStormDurationOpenStructure = (RoundedDouble) random.NextDouble(),
+ ThresholdHeightOpenWeir =
+ {
+ Mean = (RoundedDouble) random.NextDouble(),
+ StandardDeviation = (RoundedDouble) random.NextDouble()
+ },
+ AreaFlowApertures =
+ {
+ Mean = (RoundedDouble) random.NextDouble(),
+ StandardDeviation = (RoundedDouble) random.NextDouble()
+ },
+ FailureProbabilityOpenStructure = (RoundedDouble) random.NextDouble(),
+ FailureProbabilityReparation = (RoundedDouble) random.NextDouble(),
+ IdenticalApertures = random.Next(),
+ LevelCrestStructureNotClosing =
+ {
+ Mean = (RoundedDouble) random.NextDouble(),
+ StandardDeviation = (RoundedDouble) random.NextDouble()
+ },
+ ProbabilityOpenStructureBeforeFlooding = (RoundedDouble) random.NextDouble()
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ const int order = 67;
+
+ // Call
+ ClosingStructuresCalculationEntity entity = calculation.Create(registry, order);
+
+ // Assert
+ Assert.AreEqual(calculation.Name, entity.Name);
+ Assert.AreEqual(calculation.Comments, entity.Comments);
+
+ ClosingStructuresInput inputParameters = calculation.InputParameters;
+ Assert.AreEqual(inputParameters.StormDuration.Mean.Value, entity.StormDurationMean);
+ Assert.AreEqual(inputParameters.StructureNormalOrientation.Value, entity.StructureNormalOrientation);
+ Assert.AreEqual(inputParameters.FailureProbabilityStructureWithErosion, entity.FailureProbabilityStructureWithErosion);
+ Assert.IsNull(entity.ClosingStructureEntity);
+ Assert.IsNull(entity.HydraulicLocationEntity);
+ Assert.IsNull(entity.ForeshoreProfileEntity);
+ Assert.AreEqual(Convert.ToByte(inputParameters.UseForeshore), entity.UseForeshore);
+ Assert.AreEqual(Convert.ToByte(inputParameters.UseBreakWater), entity.UseBreakWater);
+ Assert.AreEqual(Convert.ToInt16(inputParameters.BreakWater.Type), entity.BreakWaterType);
+ Assert.AreEqual(inputParameters.BreakWater.Height.Value, entity.BreakWaterHeight);
+ Assert.AreEqual(inputParameters.AllowedLevelIncreaseStorage.Mean.Value, entity.AllowedLevelIncreaseStorageMean);
+ Assert.AreEqual(inputParameters.AllowedLevelIncreaseStorage.StandardDeviation.Value, entity.AllowedLevelIncreaseStorageStandardDeviation);
+ Assert.AreEqual(inputParameters.StorageStructureArea.Mean.Value, entity.StorageStructureAreaMean);
+ Assert.AreEqual(inputParameters.StorageStructureArea.CoefficientOfVariation.Value, entity.StorageStructureAreaCoefficientOfVariation);
+ Assert.AreEqual(inputParameters.FlowWidthAtBottomProtection.Mean.Value, entity.FlowWidthAtBottomProtectionMean);
+ Assert.AreEqual(inputParameters.FlowWidthAtBottomProtection.StandardDeviation.Value, entity.FlowWidthAtBottomProtectionStandardDeviation);
+ Assert.AreEqual(inputParameters.CriticalOvertoppingDischarge.Mean.Value, entity.CriticalOvertoppingDischargeMean);
+ Assert.AreEqual(inputParameters.CriticalOvertoppingDischarge.CoefficientOfVariation.Value, entity.CriticalOvertoppingDischargeCoefficientOfVariation);
+ Assert.AreEqual(inputParameters.ModelFactorSuperCriticalFlow.Mean.Value, entity.ModelFactorSuperCriticalFlowMean);
+ Assert.AreEqual(inputParameters.WidthFlowApertures.Mean.Value, entity.WidthFlowAperturesMean);
+ Assert.AreEqual(inputParameters.WidthFlowApertures.CoefficientOfVariation.Value, entity.WidthFlowAperturesCoefficientOfVariation);
+ Assert.AreEqual(Convert.ToByte(inputParameters.InflowModelType), entity.InflowModelType);
+ Assert.AreEqual(inputParameters.InsideWaterLevel.Mean.Value, entity.InsideWaterLevelMean);
+ Assert.AreEqual(inputParameters.InsideWaterLevel.StandardDeviation.Value, entity.InsideWaterLevelStandardDeviation);
+ Assert.AreEqual(inputParameters.DeviationWaveDirection.Value, entity.DeviationWaveDirection);
+ Assert.AreEqual(inputParameters.DrainCoefficient.Mean.Value, entity.DrainCoefficientMean);
+ Assert.AreEqual(inputParameters.FactorStormDurationOpenStructure.Value, entity.FactorStormDurationOpenStructure);
+ Assert.AreEqual(inputParameters.ThresholdHeightOpenWeir.Mean.Value, entity.ThresholdHeightOpenWeirMean);
+ Assert.AreEqual(inputParameters.ThresholdHeightOpenWeir.StandardDeviation.Value, entity.ThresholdHeightOpenWeirStandardDeviation);
+ Assert.AreEqual(inputParameters.AreaFlowApertures.Mean.Value, entity.AreaFlowAperturesMean);
+ Assert.AreEqual(inputParameters.AreaFlowApertures.StandardDeviation.Value, entity.AreaFlowAperturesStandardDeviation);
+ Assert.AreEqual(inputParameters.FailureProbabilityOpenStructure, entity.FailureProbabilityOpenStructure);
+ Assert.AreEqual(inputParameters.FailureProbabilityReparation, entity.FailureProbablityReparation);
+ Assert.AreEqual(inputParameters.IdenticalApertures, entity.IdenticalApertures);
+ Assert.AreEqual(inputParameters.LevelCrestStructureNotClosing.Mean.Value, entity.LevelCrestStructureNotClosingMean);
+ Assert.AreEqual(inputParameters.LevelCrestStructureNotClosing.StandardDeviation.Value, entity.LevelCrestStructureNotClosingStandardDeviation);
+ Assert.AreEqual(inputParameters.ProbabilityOpenStructureBeforeFlooding, entity.ProbabilityOpenStructureBeforeFlooding);
+ Assert.AreEqual(order, entity.Order);
+ }
+
+ [Test]
+ public void Create_CalculationWithParametersNaN_ReturnEntityWithNullParameters()
+ {
+ // Setup
+ var random = new Random(45);
+ var calculation = new StructuresCalculation
+ {
+ InputParameters =
+ {
+ StormDuration =
+ {
+ Mean = RoundedDouble.NaN,
+ },
+ StructureNormalOrientation = RoundedDouble.NaN,
+ BreakWater =
+ {
+ Height = RoundedDouble.NaN
+ },
+ AllowedLevelIncreaseStorage =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ },
+ StorageStructureArea =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ },
+ FlowWidthAtBottomProtection =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ },
+ CriticalOvertoppingDischarge =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ },
+ ModelFactorSuperCriticalFlow =
+ {
+ Mean = RoundedDouble.NaN
+ },
+ WidthFlowApertures =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ },
+ InsideWaterLevel =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ },
+ DeviationWaveDirection = RoundedDouble.NaN,
+ DrainCoefficient =
+ {
+ Mean = RoundedDouble.NaN
+ },
+ FactorStormDurationOpenStructure = RoundedDouble.NaN,
+ ThresholdHeightOpenWeir =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ },
+ AreaFlowApertures =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ },
+ LevelCrestStructureNotClosing =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ const int order = 67;
+
+ // Call
+ ClosingStructuresCalculationEntity entity = calculation.Create(registry, order);
+
+ // Assert
+ Assert.IsNull(entity.StormDurationMean);
+ Assert.IsNull(entity.StructureNormalOrientation);
+ Assert.IsNull(entity.BreakWaterHeight);
+ Assert.IsNull(entity.AllowedLevelIncreaseStorageMean);
+ Assert.IsNull(entity.AllowedLevelIncreaseStorageStandardDeviation);
+ Assert.IsNull(entity.StorageStructureAreaMean);
+ Assert.IsNull(entity.StorageStructureAreaCoefficientOfVariation);
+ Assert.IsNull(entity.FlowWidthAtBottomProtectionMean);
+ Assert.IsNull(entity.FlowWidthAtBottomProtectionStandardDeviation);
+ Assert.IsNull(entity.CriticalOvertoppingDischargeMean);
+ Assert.IsNull(entity.CriticalOvertoppingDischargeCoefficientOfVariation);
+ Assert.IsNull(entity.ModelFactorSuperCriticalFlowMean);
+ Assert.IsNull(entity.WidthFlowAperturesMean);
+ Assert.IsNull(entity.WidthFlowAperturesCoefficientOfVariation);
+ Assert.IsNull(entity.InsideWaterLevelMean);
+ Assert.IsNull(entity.InsideWaterLevelStandardDeviation);
+ Assert.IsNull(entity.DeviationWaveDirection);
+ Assert.IsNull(entity.DrainCoefficientMean);
+ Assert.IsNull(entity.FactorStormDurationOpenStructure);
+ Assert.IsNull(entity.ThresholdHeightOpenWeirMean);
+ Assert.IsNull(entity.ThresholdHeightOpenWeirStandardDeviation);
+ Assert.IsNull(entity.AreaFlowAperturesMean);
+ Assert.IsNull(entity.AreaFlowAperturesStandardDeviation);
+ Assert.IsNull(entity.LevelCrestStructureNotClosingMean);
+ Assert.IsNull(entity.LevelCrestStructureNotClosingStandardDeviation);
+ }
+
+ [Test]
+ public void Create_CalculationWithStructure_ReturnEntityWithStructureEntity()
+ {
+ // Setup
+ ClosingStructure alreadyRegisteredStructure = new TestClosingStructure();
+ var calculation = new StructuresCalculation
+ {
+ InputParameters =
+ {
+ Structure = alreadyRegisteredStructure
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+ registry.Register(new ClosingStructureEntity(), alreadyRegisteredStructure);
+
+ // Call
+ ClosingStructuresCalculationEntity entity = calculation.Create(registry, 0);
+
+ // Assert
+ Assert.IsNotNull(entity.ClosingStructureEntity);
+ }
+
+ [Test]
+ public void Create_CalculationWithHydraulicBoundaryLocation_ReturnEntityWithHydraulicLocationEntity()
+ {
+ // Setup
+ var alreadyRegisteredHydroLocation = new HydraulicBoundaryLocation(1, "A", 2, 3);
+ var calculation = new StructuresCalculation
+ {
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = alreadyRegisteredHydroLocation
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+ registry.Register(new HydraulicLocationEntity(), alreadyRegisteredHydroLocation);
+
+ // Call
+ ClosingStructuresCalculationEntity entity = calculation.Create(registry, 0);
+
+ // Assert
+ Assert.IsNotNull(entity.HydraulicLocationEntity);
+ }
+
+ [Test]
+ public void Create_CalculationWithForeshoreProfile_ReturnEntityWithForeshoreProfileEntity()
+ {
+ // Setup
+ var alreadyRegisteredForeshoreProfile = new ForeshoreProfile(new Point2D(0, 0),
+ new Point2D[0],
+ null,
+ new ForeshoreProfile.ConstructionProperties());
+ var calculation = new StructuresCalculation
+ {
+ InputParameters =
+ {
+ ForeshoreProfile = alreadyRegisteredForeshoreProfile
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+ registry.Register(new ForeshoreProfileEntity(), alreadyRegisteredForeshoreProfile);
+
+ // Call
+ ClosingStructuresCalculationEntity entity = calculation.Create(registry, 0);
+
+ // Assert
+ Assert.IsNotNull(entity.ForeshoreProfileEntity);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresCalculationEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresCalculationEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresCalculationEntityReadExtensionsTest.cs (revision 4b095752c115dd672400da5a4acc1560e4c9ce2c)
@@ -0,0 +1,276 @@
+// Copyright (C) Stichting Deltares 2016. 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 Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Read;
+using Application.Ringtoets.Storage.Read.ClosingStructures;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.ClosingStructures.Data;
+using Ringtoets.ClosingStructures.Data.TestUtil;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.Structures;
+using Ringtoets.HydraRing.Data;
+
+namespace Application.Ringtoets.Storage.Test.Read.ClosingStructures
+{
+ [TestFixture]
+ public class ClosingStructuresCalculationEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_ReadConversionColletorNull_ThrowArugumentNullException()
+ {
+ // Setup
+ var entity = new ClosingStructuresCalculationEntity();
+
+ // Call
+ TestDelegate call = () => entity.Read(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("collector", paramName);
+ }
+
+ [Test]
+ public void Read_ValidEntity_ReturnClosingStructuresCalculation()
+ {
+ // Setup
+ var entity = new ClosingStructuresCalculationEntity
+ {
+ Name = "name",
+ Comments = "comments",
+ StructureNormalOrientation = 1.1,
+ ModelFactorSuperCriticalFlowMean = 2.2,
+ AllowedLevelIncreaseStorageMean = 3.3,
+ AllowedLevelIncreaseStorageStandardDeviation = 4.4,
+ StorageStructureAreaMean = 5.5,
+ StorageStructureAreaCoefficientOfVariation = 6.6,
+ FlowWidthAtBottomProtectionMean = 7.7,
+ FlowWidthAtBottomProtectionStandardDeviation = 8.8,
+ CriticalOvertoppingDischargeMean = 9.9,
+ CriticalOvertoppingDischargeCoefficientOfVariation = 10.10,
+ FailureProbabilityStructureWithErosion = 0.11,
+ WidthFlowAperturesMean = 12.12,
+ WidthFlowAperturesCoefficientOfVariation = 13.13,
+ StormDurationMean = 14.14,
+ UseBreakWater = Convert.ToByte(true),
+ BreakWaterType = Convert.ToInt16(BreakWaterType.Wall),
+ BreakWaterHeight = 15.15,
+ UseForeshore = Convert.ToByte(true),
+ InflowModelType = Convert.ToByte(ClosingStructureInflowModelType.LowSill),
+ InsideWaterLevelMean = 16.16,
+ InsideWaterLevelStandardDeviation = 17.17,
+ DeviationWaveDirection = 18.18,
+ DrainCoefficientMean = 19.19,
+ FactorStormDurationOpenStructure = 20.20,
+ ThresholdHeightOpenWeirMean = 21.21,
+ ThresholdHeightOpenWeirStandardDeviation = 22.22,
+ AreaFlowAperturesMean = 23.23,
+ AreaFlowAperturesStandardDeviation = 24.24,
+ FailureProbabilityOpenStructure = 0.25,
+ FailureProbablityReparation = 0.26,
+ IdenticalApertures = 27,
+ LevelCrestStructureNotClosingMean = 28.28,
+ LevelCrestStructureNotClosingStandardDeviation = 29.29,
+ ProbabilityOpenStructureBeforeFlooding = 0.30
+ };
+ var collector = new ReadConversionCollector();
+
+ // Call
+ StructuresCalculation calculation = entity.Read(collector);
+
+ // Assert
+ Assert.AreEqual(entity.Name, calculation.Name);
+ Assert.AreEqual(entity.Comments, calculation.Comments);
+
+ ClosingStructuresInput inputParameters = calculation.InputParameters;
+ Assert.IsNull(inputParameters.ForeshoreProfile);
+ Assert.IsNull(inputParameters.Structure);
+ Assert.IsNull(inputParameters.HydraulicBoundaryLocation);
+ Assert.AreEqual(entity.StructureNormalOrientation, inputParameters.StructureNormalOrientation.Value);
+ Assert.AreEqual(entity.ModelFactorSuperCriticalFlowMean, inputParameters.ModelFactorSuperCriticalFlow.Mean.Value);
+ Assert.AreEqual(entity.AllowedLevelIncreaseStorageMean, inputParameters.AllowedLevelIncreaseStorage.Mean.Value);
+ Assert.AreEqual(entity.AllowedLevelIncreaseStorageStandardDeviation, inputParameters.AllowedLevelIncreaseStorage.StandardDeviation.Value);
+ Assert.AreEqual(entity.StorageStructureAreaMean, inputParameters.StorageStructureArea.Mean.Value);
+ Assert.AreEqual(entity.StorageStructureAreaCoefficientOfVariation, inputParameters.StorageStructureArea.CoefficientOfVariation.Value);
+ Assert.AreEqual(entity.FlowWidthAtBottomProtectionMean, inputParameters.FlowWidthAtBottomProtection.Mean.Value);
+ Assert.AreEqual(entity.FlowWidthAtBottomProtectionStandardDeviation, inputParameters.FlowWidthAtBottomProtection.StandardDeviation.Value);
+ Assert.AreEqual(entity.CriticalOvertoppingDischargeMean, inputParameters.CriticalOvertoppingDischarge.Mean.Value);
+ Assert.AreEqual(entity.CriticalOvertoppingDischargeCoefficientOfVariation, inputParameters.CriticalOvertoppingDischarge.CoefficientOfVariation.Value);
+ Assert.AreEqual(entity.FailureProbabilityStructureWithErosion, inputParameters.FailureProbabilityStructureWithErosion);
+ Assert.AreEqual(entity.WidthFlowAperturesMean, inputParameters.WidthFlowApertures.Mean.Value);
+ Assert.AreEqual(entity.WidthFlowAperturesCoefficientOfVariation, inputParameters.WidthFlowApertures.CoefficientOfVariation.Value);
+ Assert.AreEqual(entity.StormDurationMean, inputParameters.StormDuration.Mean.Value);
+ Assert.AreEqual(Convert.ToBoolean(entity.UseBreakWater), inputParameters.UseBreakWater);
+ Assert.AreEqual((BreakWaterType) entity.BreakWaterType, inputParameters.BreakWater.Type);
+ Assert.AreEqual(entity.BreakWaterHeight, inputParameters.BreakWater.Height.Value);
+ Assert.AreEqual(Convert.ToBoolean(entity.UseForeshore), inputParameters.UseForeshore);
+
+ Assert.AreEqual((ClosingStructureInflowModelType) entity.InflowModelType, inputParameters.InflowModelType);
+ Assert.AreEqual(entity.InsideWaterLevelMean, inputParameters.InsideWaterLevel.Mean.Value);
+ Assert.AreEqual(entity.InsideWaterLevelStandardDeviation, inputParameters.InsideWaterLevel.StandardDeviation.Value);
+ Assert.AreEqual(entity.DeviationWaveDirection, inputParameters.DeviationWaveDirection.Value);
+ Assert.AreEqual(entity.DrainCoefficientMean, inputParameters.DrainCoefficient.Mean.Value);
+ Assert.AreEqual(entity.FactorStormDurationOpenStructure, inputParameters.FactorStormDurationOpenStructure.Value);
+ Assert.AreEqual(entity.ThresholdHeightOpenWeirMean, inputParameters.ThresholdHeightOpenWeir.Mean.Value);
+ Assert.AreEqual(entity.ThresholdHeightOpenWeirStandardDeviation, inputParameters.ThresholdHeightOpenWeir.StandardDeviation.Value);
+ Assert.AreEqual(entity.AreaFlowAperturesMean, inputParameters.AreaFlowApertures.Mean.Value);
+ Assert.AreEqual(entity.AreaFlowAperturesStandardDeviation, inputParameters.AreaFlowApertures.StandardDeviation.Value);
+ Assert.AreEqual(entity.FailureProbabilityOpenStructure, inputParameters.FailureProbabilityOpenStructure);
+ Assert.AreEqual(entity.FailureProbablityReparation, inputParameters.FailureProbabilityReparation);
+ Assert.AreEqual(entity.IdenticalApertures, inputParameters.IdenticalApertures);
+ Assert.AreEqual(entity.LevelCrestStructureNotClosingMean, inputParameters.LevelCrestStructureNotClosing.Mean.Value);
+ Assert.AreEqual(entity.LevelCrestStructureNotClosingStandardDeviation, inputParameters.LevelCrestStructureNotClosing.StandardDeviation.Value);
+ Assert.AreEqual(entity.ProbabilityOpenStructureBeforeFlooding, inputParameters.ProbabilityOpenStructureBeforeFlooding);
+ }
+
+ [Test]
+ public void Read_EntityWithNullParameters_ReturnClosingStructuresCalculationWithInputParametersNaN()
+ {
+ // Setup
+ var entity = new ClosingStructuresCalculationEntity
+ {
+ StructureNormalOrientation = null,
+ ModelFactorSuperCriticalFlowMean = null,
+ AllowedLevelIncreaseStorageMean = null,
+ AllowedLevelIncreaseStorageStandardDeviation = null,
+ StorageStructureAreaMean = null,
+ StorageStructureAreaCoefficientOfVariation = null,
+ FlowWidthAtBottomProtectionMean = null,
+ FlowWidthAtBottomProtectionStandardDeviation = null,
+ CriticalOvertoppingDischargeMean = null,
+ CriticalOvertoppingDischargeCoefficientOfVariation = null,
+ WidthFlowAperturesMean = null,
+ WidthFlowAperturesCoefficientOfVariation = null,
+ StormDurationMean = null,
+ BreakWaterHeight = null,
+ InsideWaterLevelMean = null,
+ InsideWaterLevelStandardDeviation = null,
+ DeviationWaveDirection = null,
+ DrainCoefficientMean = null,
+ FactorStormDurationOpenStructure = null,
+ ThresholdHeightOpenWeirMean = null,
+ ThresholdHeightOpenWeirStandardDeviation = null,
+ AreaFlowAperturesMean = null,
+ AreaFlowAperturesStandardDeviation = null,
+ LevelCrestStructureNotClosingMean = null,
+ LevelCrestStructureNotClosingStandardDeviation = null
+ };
+ var collector = new ReadConversionCollector();
+
+ // Call
+ StructuresCalculation calculation = entity.Read(collector);
+
+ // Assert
+ ClosingStructuresInput inputParameters = calculation.InputParameters;
+ Assert.IsNaN(inputParameters.StructureNormalOrientation);
+ Assert.IsNaN(inputParameters.ModelFactorSuperCriticalFlow.Mean);
+ Assert.IsNaN(inputParameters.AllowedLevelIncreaseStorage.Mean);
+ Assert.IsNaN(inputParameters.AllowedLevelIncreaseStorage.StandardDeviation);
+ Assert.IsNaN(inputParameters.StorageStructureArea.Mean);
+ Assert.IsNaN(inputParameters.StorageStructureArea.CoefficientOfVariation);
+ Assert.IsNaN(inputParameters.FlowWidthAtBottomProtection.Mean);
+ Assert.IsNaN(inputParameters.FlowWidthAtBottomProtection.StandardDeviation);
+ Assert.IsNaN(inputParameters.CriticalOvertoppingDischarge.Mean);
+ Assert.IsNaN(inputParameters.CriticalOvertoppingDischarge.CoefficientOfVariation);
+ Assert.IsNaN(inputParameters.WidthFlowApertures.Mean);
+ Assert.IsNaN(inputParameters.WidthFlowApertures.CoefficientOfVariation);
+ Assert.IsNaN(inputParameters.StormDuration.Mean);
+ Assert.IsNaN(inputParameters.BreakWater.Height);
+
+ Assert.IsNaN(inputParameters.InsideWaterLevel.Mean);
+ Assert.IsNaN(inputParameters.InsideWaterLevel.StandardDeviation);
+ Assert.IsNaN(inputParameters.DeviationWaveDirection);
+ Assert.IsNaN(inputParameters.DrainCoefficient.Mean);
+ Assert.IsNaN(inputParameters.FactorStormDurationOpenStructure);
+ Assert.IsNaN(inputParameters.ThresholdHeightOpenWeir.Mean);
+ Assert.IsNaN(inputParameters.ThresholdHeightOpenWeir.StandardDeviation);
+ Assert.IsNaN(inputParameters.AreaFlowApertures.Mean);
+ Assert.IsNaN(inputParameters.AreaFlowApertures.StandardDeviation);
+ Assert.IsNaN(inputParameters.LevelCrestStructureNotClosing.Mean);
+ Assert.IsNaN(inputParameters.LevelCrestStructureNotClosing.StandardDeviation);
+ }
+
+ [Test]
+ public void Read_EntityWithStructureEntity_ReturnCalculationWithStructure()
+ {
+ // Setup
+ ClosingStructure structure = new TestClosingStructure();
+ var structureEntity = new ClosingStructureEntity();
+ var entity = new ClosingStructuresCalculationEntity
+ {
+ ClosingStructureEntity = structureEntity
+ };
+ var collector = new ReadConversionCollector();
+ collector.Read(structureEntity, structure);
+
+ // Call
+ StructuresCalculation calculation = entity.Read(collector);
+
+ // Assert
+ Assert.AreSame(structure, calculation.InputParameters.Structure);
+ }
+
+ [Test]
+ public void Read_EntityWithHydroLocationEntity_ReturnCalculationWithHydraulicBoundaryLocation()
+ {
+ // Setup
+ var hydroLocation = new HydraulicBoundaryLocation(1, "A", 2, 3);
+ var hydroLocationEntity = new HydraulicLocationEntity();
+ var entity = new ClosingStructuresCalculationEntity
+ {
+ HydraulicLocationEntity = hydroLocationEntity
+ };
+
+ var collector = new ReadConversionCollector();
+ collector.Read(hydroLocationEntity, hydroLocation);
+
+ // Call
+ StructuresCalculation calculation = entity.Read(collector);
+
+ // Assert
+ Assert.AreSame(hydroLocation, calculation.InputParameters.HydraulicBoundaryLocation);
+ }
+
+ [Test]
+ public void Read_EntityWithForeshoreProfileEntity_ReturnCalculationWithForeshoreProfile()
+ {
+ // Setup
+ var profile = new ForeshoreProfile(new Point2D(0, 0), new Point2D[0],
+ null, new ForeshoreProfile.ConstructionProperties());
+ var profileEntity = new ForeshoreProfileEntity();
+ var entity = new ClosingStructuresCalculationEntity
+ {
+ ForeshoreProfileEntity = profileEntity
+ };
+
+ var collector = new ReadConversionCollector();
+ collector.Read(profileEntity, profile);
+
+ // Call
+ StructuresCalculation calculation = entity.Read(collector);
+
+ // Assert
+ Assert.AreSame(profile, calculation.InputParameters.ForeshoreProfile);
+ }
+ }
+}
\ No newline at end of file