Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj
===================================================================
diff -u -r6e33ada58f1a53a5a732c3b4e46583ad846a2983 -rcbd9374834f6bd9adf1f9e62ea2bff91aa2457f9
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 6e33ada58f1a53a5a732c3b4e46583ad846a2983)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision cbd9374834f6bd9adf1f9e62ea2bff91aa2457f9)
@@ -279,7 +279,7 @@
-
+
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/PartialStabilityPointStructuresCalculationEntity.cs
===================================================================
diff -u -r43f72f0cd1f19b6bef02964ac191973d6077c74c -rcbd9374834f6bd9adf1f9e62ea2bff91aa2457f9
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/PartialStabilityPointStructuresCalculationEntity.cs (.../PartialStabilityPointStructuresCalculationEntity.cs) (revision 43f72f0cd1f19b6bef02964ac191973d6077c74c)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/PartialStabilityPointStructuresCalculationEntity.cs (.../PartialStabilityPointStructuresCalculationEntity.cs) (revision cbd9374834f6bd9adf1f9e62ea2bff91aa2457f9)
@@ -21,8 +21,9 @@
namespace Application.Ringtoets.Storage.DbContext
{
- public partial class StabilityPointStructuresCalculationEntity : IStructuresCalculationEntity
- {
-
- }
+ ///
+ /// Partial implementation of that implements
+ /// .
+ ///
+ public partial class StabilityPointStructuresCalculationEntity : IStructuresCalculationEntity {}
}
\ No newline at end of file
Fisheye: Tag cbd9374834f6bd9adf1f9e62ea2bff91aa2457f9 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityPointStructures/StabilityPointStructureCalculationEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityPointStructures/StabilityPointStructuresCalculationEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityPointStructures/StabilityPointStructuresCalculationEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityPointStructures/StabilityPointStructuresCalculationEntityReadExtensions.cs (revision cbd9374834f6bd9adf1f9e62ea2bff91aa2457f9)
@@ -0,0 +1,128 @@
+// 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 System.Linq;
+using Application.Ringtoets.Storage.DbContext;
+using Core.Common.Base.Data;
+using Ringtoets.Common.Data.Structures;
+using Ringtoets.StabilityPointStructures.Data;
+
+namespace Application.Ringtoets.Storage.Read.StabilityPointStructures
+{
+ ///
+ /// This class defines extension methods for read operations for a
+ /// based on the .
+ ///
+ internal static class StabilityPointStructuresCalculationEntityReadExtensions
+ {
+ ///
+ /// 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 StabilityPointStructuresCalculationEntity entity, ReadConversionCollector collector)
+ {
+ if (collector == null)
+ {
+ throw new ArgumentNullException("collector");
+ }
+ if (collector.Contains(entity))
+ {
+ return collector.Get(entity);
+ }
+
+ var calculation = new StructuresCalculation
+ {
+ Name = entity.Name,
+ Comments = entity.Comments
+ };
+ ReadInputParameters(calculation.InputParameters, entity, collector);
+ ReadOutput(calculation, entity);
+
+ collector.Read(entity, calculation);
+
+ return calculation;
+ }
+
+ private static void ReadInputParameters(StabilityPointStructuresInput inputParameters, StabilityPointStructuresCalculationEntity entity, ReadConversionCollector collector)
+ {
+ if (entity.StabilityPointStructureEntity != null)
+ {
+ inputParameters.Structure = entity.StabilityPointStructureEntity.Read(collector);
+ }
+
+ entity.Read(inputParameters, collector);
+
+ inputParameters.InsideWaterLevel.Mean = (RoundedDouble) entity.InsideWaterLevelMean.ToNullAsNaN();
+ inputParameters.InsideWaterLevel.StandardDeviation = (RoundedDouble) entity.InsideWaterLevelStandardDeviation.ToNullAsNaN();
+ inputParameters.ThresholdHeightOpenWeir.Mean = (RoundedDouble) entity.ThresholdHeightOpenWeirMean.ToNullAsNaN();
+ inputParameters.ThresholdHeightOpenWeir.StandardDeviation = (RoundedDouble) entity.ThresholdHeightOpenWeirStandardDeviation.ToNullAsNaN();
+ inputParameters.ConstructiveStrengthLinearLoadModel.Mean = (RoundedDouble) entity.ConstructiveStrengthLinearLoadModelMean.ToNullAsNaN();
+ inputParameters.ConstructiveStrengthLinearLoadModel.CoefficientOfVariation = (RoundedDouble) entity.ConstructiveStrengthLinearLoadModelCoefficientOfVariation.ToNullAsNaN();
+ inputParameters.ConstructiveStrengthQuadraticLoadModel.Mean = (RoundedDouble) entity.ConstructiveStrengthQuadraticLoadModelMean.ToNullAsNaN();
+ inputParameters.ConstructiveStrengthQuadraticLoadModel.CoefficientOfVariation = (RoundedDouble) entity.ConstructiveStrengthQuadraticLoadModelCoefficientOfVariation.ToNullAsNaN();
+ inputParameters.BankWidth.Mean = (RoundedDouble) entity.BankWidthMean.ToNullAsNaN();
+ inputParameters.BankWidth.StandardDeviation = (RoundedDouble) entity.BankWidthStandardDeviation.ToNullAsNaN();
+ inputParameters.InsideWaterLevelFailureConstruction.Mean = (RoundedDouble) entity.InsideWaterLevelFailureConstructionMean.ToNullAsNaN();
+ inputParameters.InsideWaterLevelFailureConstruction.StandardDeviation = (RoundedDouble) entity.InsideWaterLevelFailureConstructionStandardDeviation.ToNullAsNaN();
+ inputParameters.EvaluationLevel = (RoundedDouble) entity.EvaluationLevel.ToNullAsNaN();
+ inputParameters.LevelCrestStructure.Mean = (RoundedDouble) entity.LevelCrestStructureMean.ToNullAsNaN();
+ inputParameters.LevelCrestStructure.StandardDeviation = (RoundedDouble) entity.LevelCrestStructureStandardDeviation.ToNullAsNaN();
+ inputParameters.VerticalDistance = (RoundedDouble) entity.VerticalDistance.ToNullAsNaN();
+ inputParameters.FailureProbabilityRepairClosure = entity.FailureProbabilityRepairClosure;
+ inputParameters.FailureCollisionEnergy.Mean = (RoundedDouble) entity.FailureCollisionEnergyMean.ToNullAsNaN();
+ inputParameters.FailureCollisionEnergy.CoefficientOfVariation = (RoundedDouble) entity.FailureCollisionEnergyCoefficientOfVariation.ToNullAsNaN();
+ inputParameters.ShipMass.Mean = (RoundedDouble) entity.ShipMassMean.ToNullAsNaN();
+ inputParameters.ShipMass.CoefficientOfVariation = (RoundedDouble) entity.ShipMassCoefficientOfVariation.ToNullAsNaN();
+ inputParameters.ShipVelocity.Mean = (RoundedDouble) entity.ShipVelocityMean.ToNullAsNaN();
+ inputParameters.ShipVelocity.CoefficientOfVariation = (RoundedDouble) entity.ShipVelocityCoefficientOfVariation.ToNullAsNaN();
+ inputParameters.LevellingCount = entity.LevellingCount;
+ inputParameters.ProbabilityCollisionSecondaryStructure = entity.ProbabilityCollisionSecondaryStructure;
+ inputParameters.FlowVelocityStructureClosable.Mean = (RoundedDouble) entity.FlowVelocityStructureClosableMean.ToNullAsNaN();
+ inputParameters.FlowVelocityStructureClosable.StandardDeviation = (RoundedDouble) entity.FlowVelocityStructureClosableStandardDeviation.ToNullAsNaN();
+ inputParameters.StabilityLinearLoadModel.Mean = (RoundedDouble) entity.StabilityLinearLoadModelMean.ToNullAsNaN();
+ inputParameters.StabilityLinearLoadModel.CoefficientOfVariation = (RoundedDouble) entity.StabilityLinearLoadModelCoefficientOfVariation.ToNullAsNaN();
+ inputParameters.StabilityQuadraticLoadModel.Mean = (RoundedDouble) entity.StabilityQuadraticLoadModelMean.ToNullAsNaN();
+ inputParameters.StabilityQuadraticLoadModel.CoefficientOfVariation = (RoundedDouble) entity.StabilityQuadraticLoadModelCoefficientOfVariation.ToNullAsNaN();
+ inputParameters.AreaFlowApertures.Mean = (RoundedDouble) entity.AreaFlowAperturesMean.ToNullAsNaN();
+ inputParameters.AreaFlowApertures.StandardDeviation = (RoundedDouble) entity.AreaFlowAperturesStandardDeviation.ToNullAsNaN();
+ inputParameters.InflowModelType = (StabilityPointStructureInflowModelType) entity.InflowModelType;
+ inputParameters.LoadSchematizationType = (LoadSchematizationType) entity.LoadSchematizationType;
+ inputParameters.VolumicWeightWater = (RoundedDouble) entity.VolumicWeightWater.ToNullAsNaN();
+ inputParameters.FactorStormDurationOpenStructure = (RoundedDouble) entity.FactorStormDurationOpenStructure.ToNullAsNaN();
+ inputParameters.DrainCoefficient.Mean = (RoundedDouble) entity.DrainCoefficientMean.ToNullAsNaN();
+ }
+
+ private static void ReadOutput(StructuresCalculation calculation, StabilityPointStructuresCalculationEntity entity)
+ {
+ StabilityPointStructuresOutputEntity output = entity.StabilityPointStructuresOutputEntities.FirstOrDefault();
+ if (output != null)
+ {
+ calculation.Output = output.Read();
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj
===================================================================
diff -u -r6e33ada58f1a53a5a732c3b4e46583ad846a2983 -rcbd9374834f6bd9adf1f9e62ea2bff91aa2457f9
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 6e33ada58f1a53a5a732c3b4e46583ad846a2983)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision cbd9374834f6bd9adf1f9e62ea2bff91aa2457f9)
@@ -105,7 +105,7 @@
-
+
Fisheye: Tag cbd9374834f6bd9adf1f9e62ea2bff91aa2457f9 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructureCalculationEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructuresCalculationEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructuresCalculationEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructuresCalculationEntityReadExtensionsTest.cs (revision cbd9374834f6bd9adf1f9e62ea2bff91aa2457f9)
@@ -0,0 +1,429 @@
+// 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.StabilityPointStructures;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.Structures;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.StabilityPointStructures.Data;
+using Ringtoets.StabilityPointStructures.Data.TestUtil;
+
+namespace Application.Ringtoets.Storage.Test.Read.StabilityPointStructures
+{
+ [TestFixture]
+ public class StabilityPointStructuresCalculationEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_ReadConversionCollectorNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var entity = new StabilityPointStructuresCalculationEntity();
+
+ // Call
+ TestDelegate call = () => entity.Read(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("collector", paramName);
+ }
+
+ [Test]
+ public void Read_EntityNotReadBefore_RegisterEntity()
+ {
+ // Setup
+ var entity = new StabilityPointStructuresCalculationEntity();
+
+ var collector = new ReadConversionCollector();
+
+ // Precondition
+ Assert.IsFalse(collector.Contains(entity));
+
+ // Call
+ StructuresCalculation calculation = entity.Read(collector);
+
+ // Assert
+ Assert.IsTrue(collector.Contains(entity));
+ Assert.AreSame(calculation, collector.Get(entity));
+ }
+
+ [Test]
+ public void Read_ValidEntity_ReturnStabilityPointStructuresCalculation()
+ {
+ // Setup
+ var entity = new StabilityPointStructuresCalculationEntity
+ {
+ 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),
+ InsideWaterLevelMean = 16.16,
+ InsideWaterLevelStandardDeviation = 17.17,
+ ThresholdHeightOpenWeirMean = 18.18,
+ ThresholdHeightOpenWeirStandardDeviation = 19.19,
+ ConstructiveStrengthLinearLoadModelMean = 20.20,
+ ConstructiveStrengthLinearLoadModelCoefficientOfVariation = 21.21,
+ ConstructiveStrengthQuadraticLoadModelMean = 22.22,
+ ConstructiveStrengthQuadraticLoadModelCoefficientOfVariation = 23.23,
+ BankWidthMean = 24.24,
+ BankWidthStandardDeviation = 25.25,
+ InsideWaterLevelFailureConstructionMean = 26.26,
+ InsideWaterLevelFailureConstructionStandardDeviation = 27.27,
+ EvaluationLevel = 28.28,
+ LevelCrestStructureMean = 29.29,
+ LevelCrestStructureStandardDeviation = 30.30,
+ VerticalDistance = 31.31,
+ FailureProbabilityRepairClosure = 0.32,
+ FailureCollisionEnergyMean = 33.33,
+ FailureCollisionEnergyCoefficientOfVariation = 34.34,
+ ShipMassMean = 35.35,
+ ShipMassCoefficientOfVariation = 36.36,
+ ShipVelocityMean = 37.37,
+ ShipVelocityCoefficientOfVariation = 38.38,
+ LevellingCount = 39,
+ ProbabilityCollisionSecondaryStructure = 0.40,
+ FlowVelocityStructureClosableMean = 41.41,
+ FlowVelocityStructureClosableStandardDeviation = 42.42,
+ StabilityLinearLoadModelMean = 43.43,
+ StabilityLinearLoadModelCoefficientOfVariation = 44.44,
+ StabilityQuadraticLoadModelMean = 45.45,
+ StabilityQuadraticLoadModelCoefficientOfVariation = 46.46,
+ AreaFlowAperturesMean = 47.47,
+ AreaFlowAperturesStandardDeviation = 48.48,
+ InflowModelType = Convert.ToByte(StabilityPointStructureInflowModelType.FloodedCulvert),
+ LoadSchematizationType = Convert.ToByte(LoadSchematizationType.Quadratic),
+ VolumicWeightWater = 51.51,
+ FactorStormDurationOpenStructure = 52.52,
+ DrainCoefficientMean = 53.53
+ };
+ var collector = new ReadConversionCollector();
+
+ // Call
+ StructuresCalculation calculation = entity.Read(collector);
+
+ // Assert
+ Assert.AreEqual(entity.Name, calculation.Name);
+ Assert.AreEqual(entity.Comments, calculation.Comments);
+
+ StabilityPointStructuresInput 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(entity.InsideWaterLevelMean, inputParameters.InsideWaterLevel.Mean.Value);
+ Assert.AreEqual(entity.InsideWaterLevelStandardDeviation, inputParameters.InsideWaterLevel.StandardDeviation.Value);
+ Assert.AreEqual(entity.ThresholdHeightOpenWeirMean, inputParameters.ThresholdHeightOpenWeir.Mean.Value);
+ Assert.AreEqual(entity.ThresholdHeightOpenWeirStandardDeviation, inputParameters.ThresholdHeightOpenWeir.StandardDeviation.Value);
+ Assert.AreEqual(entity.ConstructiveStrengthLinearLoadModelMean, inputParameters.ConstructiveStrengthLinearLoadModel.Mean.Value);
+ Assert.AreEqual(entity.ConstructiveStrengthLinearLoadModelCoefficientOfVariation, inputParameters.ConstructiveStrengthLinearLoadModel.CoefficientOfVariation.Value);
+ Assert.AreEqual(entity.ConstructiveStrengthQuadraticLoadModelMean, inputParameters.ConstructiveStrengthQuadraticLoadModel.Mean.Value);
+ Assert.AreEqual(entity.ConstructiveStrengthQuadraticLoadModelCoefficientOfVariation, inputParameters.ConstructiveStrengthQuadraticLoadModel.CoefficientOfVariation.Value);
+ Assert.AreEqual(entity.BankWidthMean, inputParameters.BankWidth.Mean.Value);
+ Assert.AreEqual(entity.BankWidthStandardDeviation, inputParameters.BankWidth.StandardDeviation.Value);
+ Assert.AreEqual(entity.InsideWaterLevelFailureConstructionMean, inputParameters.InsideWaterLevelFailureConstruction.Mean.Value);
+ Assert.AreEqual(entity.InsideWaterLevelFailureConstructionStandardDeviation, inputParameters.InsideWaterLevelFailureConstruction.StandardDeviation.Value);
+ Assert.AreEqual(entity.EvaluationLevel, inputParameters.EvaluationLevel.Value);
+ Assert.AreEqual(entity.LevelCrestStructureMean, inputParameters.LevelCrestStructure.Mean.Value);
+ Assert.AreEqual(entity.LevelCrestStructureStandardDeviation, inputParameters.LevelCrestStructure.StandardDeviation.Value);
+ Assert.AreEqual(entity.VerticalDistance, inputParameters.VerticalDistance.Value);
+ Assert.AreEqual(entity.FailureProbabilityRepairClosure, inputParameters.FailureProbabilityRepairClosure);
+ Assert.AreEqual(entity.FailureCollisionEnergyMean, inputParameters.FailureCollisionEnergy.Mean.Value);
+ Assert.AreEqual(entity.FailureCollisionEnergyCoefficientOfVariation, inputParameters.FailureCollisionEnergy.CoefficientOfVariation.Value);
+ Assert.AreEqual(entity.ShipMassMean, inputParameters.ShipMass.Mean.Value);
+ Assert.AreEqual(entity.ShipMassCoefficientOfVariation, inputParameters.ShipMass.CoefficientOfVariation.Value);
+ Assert.AreEqual(entity.ShipVelocityMean, inputParameters.ShipVelocity.Mean.Value);
+ Assert.AreEqual(entity.ShipVelocityCoefficientOfVariation, inputParameters.ShipVelocity.CoefficientOfVariation.Value);
+ Assert.AreEqual(entity.LevellingCount, inputParameters.LevellingCount);
+ Assert.AreEqual(entity.ProbabilityCollisionSecondaryStructure, inputParameters.ProbabilityCollisionSecondaryStructure);
+ Assert.AreEqual(entity.FlowVelocityStructureClosableMean, inputParameters.FlowVelocityStructureClosable.Mean.Value);
+ Assert.AreEqual(entity.FlowVelocityStructureClosableStandardDeviation, inputParameters.FlowVelocityStructureClosable.StandardDeviation.Value);
+ Assert.AreEqual(entity.StabilityLinearLoadModelMean, inputParameters.StabilityLinearLoadModel.Mean.Value);
+ Assert.AreEqual(entity.StabilityLinearLoadModelCoefficientOfVariation, inputParameters.StabilityLinearLoadModel.CoefficientOfVariation.Value);
+ Assert.AreEqual(entity.StabilityQuadraticLoadModelMean, inputParameters.StabilityQuadraticLoadModel.Mean.Value);
+ Assert.AreEqual(entity.StabilityQuadraticLoadModelCoefficientOfVariation, inputParameters.StabilityQuadraticLoadModel.CoefficientOfVariation.Value);
+ Assert.AreEqual(entity.AreaFlowAperturesMean, inputParameters.AreaFlowApertures.Mean.Value);
+ Assert.AreEqual(entity.AreaFlowAperturesStandardDeviation, inputParameters.AreaFlowApertures.StandardDeviation.Value);
+ Assert.AreEqual((StabilityPointStructureInflowModelType) entity.InflowModelType, inputParameters.InflowModelType);
+ Assert.AreEqual((LoadSchematizationType) entity.LoadSchematizationType, inputParameters.LoadSchematizationType);
+ Assert.AreEqual(entity.VolumicWeightWater, inputParameters.VolumicWeightWater.Value);
+ Assert.AreEqual(entity.FactorStormDurationOpenStructure, inputParameters.FactorStormDurationOpenStructure.Value);
+ Assert.AreEqual(entity.DrainCoefficientMean, inputParameters.DrainCoefficient.Mean.Value);
+ Assert.IsFalse(calculation.HasOutput);
+ }
+
+ [Test]
+ public void Read_EntityWithNullParameters_ReturnStabilityPointStructuresCalculationWithInputParametersNaN()
+ {
+ // Setup
+ var entity = new StabilityPointStructuresCalculationEntity
+ {
+ 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,
+ ThresholdHeightOpenWeirMean = null,
+ ThresholdHeightOpenWeirStandardDeviation = null,
+ ConstructiveStrengthLinearLoadModelMean = null,
+ ConstructiveStrengthLinearLoadModelCoefficientOfVariation = null,
+ ConstructiveStrengthQuadraticLoadModelMean = null,
+ ConstructiveStrengthQuadraticLoadModelCoefficientOfVariation = null,
+ BankWidthMean = null,
+ BankWidthStandardDeviation = null,
+ InsideWaterLevelFailureConstructionMean = null,
+ InsideWaterLevelFailureConstructionStandardDeviation = null,
+ EvaluationLevel = null,
+ LevelCrestStructureMean = null,
+ LevelCrestStructureStandardDeviation = null,
+ VerticalDistance = null,
+ FailureCollisionEnergyMean = null,
+ FailureCollisionEnergyCoefficientOfVariation = null,
+ ShipMassMean = null,
+ ShipMassCoefficientOfVariation = null,
+ ShipVelocityMean = null,
+ ShipVelocityCoefficientOfVariation = null,
+ FlowVelocityStructureClosableMean = null,
+ FlowVelocityStructureClosableStandardDeviation = null,
+ StabilityLinearLoadModelMean = null,
+ StabilityLinearLoadModelCoefficientOfVariation = null,
+ StabilityQuadraticLoadModelMean = null,
+ StabilityQuadraticLoadModelCoefficientOfVariation = null,
+ AreaFlowAperturesMean = null,
+ AreaFlowAperturesStandardDeviation = null,
+ VolumicWeightWater = null,
+ FactorStormDurationOpenStructure = null,
+ DrainCoefficientMean = null
+ };
+ var collector = new ReadConversionCollector();
+
+ // Call
+ StructuresCalculation calculation = entity.Read(collector);
+
+ // Assert
+ StabilityPointStructuresInput 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.ThresholdHeightOpenWeir.Mean);
+ Assert.IsNaN(inputParameters.ThresholdHeightOpenWeir.StandardDeviation);
+ Assert.IsNaN(inputParameters.ConstructiveStrengthLinearLoadModel.Mean);
+ Assert.IsNaN(inputParameters.ConstructiveStrengthLinearLoadModel.CoefficientOfVariation);
+ Assert.IsNaN(inputParameters.ConstructiveStrengthQuadraticLoadModel.Mean);
+ Assert.IsNaN(inputParameters.ConstructiveStrengthQuadraticLoadModel.CoefficientOfVariation);
+ Assert.IsNaN(inputParameters.BankWidth.Mean);
+ Assert.IsNaN(inputParameters.BankWidth.StandardDeviation);
+ Assert.IsNaN(inputParameters.InsideWaterLevelFailureConstruction.Mean);
+ Assert.IsNaN(inputParameters.InsideWaterLevelFailureConstruction.StandardDeviation);
+ Assert.IsNaN(inputParameters.EvaluationLevel);
+ Assert.IsNaN(inputParameters.LevelCrestStructure.Mean);
+ Assert.IsNaN(inputParameters.LevelCrestStructure.StandardDeviation);
+ Assert.IsNaN(inputParameters.VerticalDistance);
+ Assert.IsNaN(inputParameters.FailureCollisionEnergy.Mean);
+ Assert.IsNaN(inputParameters.FailureCollisionEnergy.CoefficientOfVariation);
+ Assert.IsNaN(inputParameters.ShipMass.Mean);
+ Assert.IsNaN(inputParameters.ShipMass.CoefficientOfVariation);
+ Assert.IsNaN(inputParameters.ShipVelocity.Mean);
+ Assert.IsNaN(inputParameters.ShipVelocity.CoefficientOfVariation);
+ Assert.IsNaN(inputParameters.FlowVelocityStructureClosable.Mean);
+ Assert.IsNaN(inputParameters.FlowVelocityStructureClosable.StandardDeviation);
+ Assert.IsNaN(inputParameters.StabilityLinearLoadModel.Mean);
+ Assert.IsNaN(inputParameters.StabilityLinearLoadModel.CoefficientOfVariation);
+ Assert.IsNaN(inputParameters.StabilityQuadraticLoadModel.Mean);
+ Assert.IsNaN(inputParameters.StabilityQuadraticLoadModel.CoefficientOfVariation);
+ Assert.IsNaN(inputParameters.AreaFlowApertures.Mean);
+ Assert.IsNaN(inputParameters.AreaFlowApertures.StandardDeviation);
+ Assert.IsNaN(inputParameters.VolumicWeightWater);
+ Assert.IsNaN(inputParameters.FactorStormDurationOpenStructure);
+ Assert.IsNaN(inputParameters.DrainCoefficient.Mean);
+ }
+
+ [Test]
+ public void Read_EntityWithStructureEntity_ReturnCalculationWithStructure()
+ {
+ // Setup
+ StabilityPointStructure structure = new TestStabilityPointStructure();
+ var structureEntity = new StabilityPointStructureEntity();
+ var entity = new StabilityPointStructuresCalculationEntity
+ {
+ StabilityPointStructureEntity = 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 StabilityPointStructuresCalculationEntity
+ {
+ 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 StabilityPointStructuresCalculationEntity
+ {
+ ForeshoreProfileEntity = profileEntity
+ };
+
+ var collector = new ReadConversionCollector();
+ collector.Read(profileEntity, profile);
+
+ // Call
+ StructuresCalculation calculation = entity.Read(collector);
+
+ // Assert
+ Assert.AreSame(profile, calculation.InputParameters.ForeshoreProfile);
+ }
+
+ [Test]
+ public void Read_ValidEntityWithOutputEntity_ReturnCalculationWithOutput()
+ {
+ // Setup
+ var entity = new StabilityPointStructuresCalculationEntity
+ {
+ StabilityPointStructuresOutputEntities =
+ {
+ new StabilityPointStructuresOutputEntity()
+ }
+ };
+
+ var collector = new ReadConversionCollector();
+
+ // Call
+ StructuresCalculation calculation = entity.Read(collector);
+
+ // Assert
+ Assert.IsTrue(calculation.HasOutput);
+ }
+
+ [Test]
+ public void Read_CalculationEntityAlreadyRead_ReturnReadCalculation()
+ {
+ // Setup
+ var entity = new StabilityPointStructuresCalculationEntity
+ {
+ StabilityPointStructuresOutputEntities =
+ {
+ new StabilityPointStructuresOutputEntity()
+ }
+ };
+
+ var calculation = new StructuresCalculation();
+
+ var collector = new ReadConversionCollector();
+ collector.Read(entity, calculation);
+
+ // Call
+ StructuresCalculation returnedCalculation = entity.Read(collector);
+
+ // Assert
+ Assert.AreSame(calculation, returnedCalculation);
+ }
+ }
+}
\ No newline at end of file