Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj
===================================================================
diff -u -r056c24804fa3267952bebae1f58705bf45338b07 -rcd386b0b37f478679e5d5566276150e30b4118de
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 056c24804fa3267952bebae1f58705bf45338b07)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -62,6 +62,7 @@
+
@@ -112,6 +113,9 @@
RingtoetsEntities.tt
+
+ RingtoetsEntities.tt
+
RingtoetsEntities.tt
@@ -200,6 +204,7 @@
+
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsConditionsCalculationCreateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsConditionsCalculationCreateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsConditionsCalculationCreateExtensions.cs (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -0,0 +1,81 @@
+// 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 Ringtoets.GrassCoverErosionOutwards.Data;
+using Ringtoets.HydraRing.Data;
+
+namespace Application.Ringtoets.Storage.Create.GrassCoverErosionOutwards
+{
+ ///
+ /// Extension methods for related to creating a
+ /// .
+ ///
+ internal static class GrassCoverErosionOutwardsConditionsCalculationCreateExtensions
+ {
+ ///
+ /// 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 which resides within its parent.
+ /// A new .
+ /// Thrown when is null.
+ internal static GrassCoverErosionOutwardsWaveConditionsCalculationEntity Create(this GrassCoverErosionOutwardsWaveConditionsCalculation calculation,
+ PersistenceRegistry registry, int order)
+ {
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ var entity = new GrassCoverErosionOutwardsWaveConditionsCalculationEntity
+ {
+ Order = order,
+ Name = calculation.Name.DeepClone(),
+ Comments = calculation.Comments.DeepClone(),
+ Orientation = calculation.InputParameters.Orientation,
+ UseBreakWater = Convert.ToByte(calculation.InputParameters.UseBreakWater),
+ BreakWaterType = (byte)calculation.InputParameters.BreakWater.Type,
+ BreakWaterHeight = calculation.InputParameters.BreakWater.Height,
+ UseForeshore = Convert.ToByte(calculation.InputParameters.UseForeshore),
+ UpperBoundaryRevetment = calculation.InputParameters.UpperBoundaryRevetment,
+ LowerBoundaryRevetment = calculation.InputParameters.LowerBoundaryRevetment,
+ UpperBoundaryWaterLevels = calculation.InputParameters.UpperBoundaryWaterLevels,
+ LowerBoundaryWaterLevels = calculation.InputParameters.LowerBoundaryWaterLevels,
+ StepSize = Convert.ToByte(calculation.InputParameters.StepSize)
+ };
+
+ HydraulicBoundaryLocation hydraulicBoundaryLocation = calculation.InputParameters.HydraulicBoundaryLocation;
+ if (hydraulicBoundaryLocation != null)
+ {
+ entity.GrassCoverErosionOutwardsHydraulicLocationEntity = hydraulicBoundaryLocation.CreateGrassCoverErosionOutwardsHydraulicBoundaryLocation(registry, 0);
+ }
+ if (calculation.InputParameters.ForeshoreProfile != null)
+ {
+ entity.ForeshoreProfileEntity = calculation.InputParameters.ForeshoreProfile.Create(registry, 0);
+ }
+ return entity;
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverWaveConditionsCalculationCreateExtensions.cs
===================================================================
diff -u -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 -rcd386b0b37f478679e5d5566276150e30b4118de
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverWaveConditionsCalculationCreateExtensions.cs (.../StabilityStoneCoverWaveConditionsCalculationCreateExtensions.cs) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverWaveConditionsCalculationCreateExtensions.cs (.../StabilityStoneCoverWaveConditionsCalculationCreateExtensions.cs) (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -29,17 +29,19 @@
/// Extension methods for related to creating a
/// .
///
- public static class StabilityStoneCoverWaveConditionsCalculationCreateExtensions
+ internal static class StabilityStoneCoverWaveConditionsCalculationCreateExtensions
{
///
/// 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 which resides within its parent.
/// A new .
/// Thrown when is null.
- internal static StabilityStoneCoverWaveConditionsCalculationEntity Create(this StabilityStoneCoverWaveConditionsCalculation calculation, PersistenceRegistry registry, int order)
+ internal static StabilityStoneCoverWaveConditionsCalculationEntity Create(this StabilityStoneCoverWaveConditionsCalculation calculation,
+ PersistenceRegistry registry, int order)
{
if (registry == null)
{
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/CalculationGroupEntity.cs
===================================================================
diff -u -r0540405a7dbabf85dc02db30c79c3c58b0faeea6 -rcd386b0b37f478679e5d5566276150e30b4118de
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/CalculationGroupEntity.cs (.../CalculationGroupEntity.cs) (revision 0540405a7dbabf85dc02db30c79c3c58b0faeea6)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/CalculationGroupEntity.cs (.../CalculationGroupEntity.cs) (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -41,6 +41,7 @@
this.CalculationGroupEntity1 = new HashSet();
this.FailureMechanismEntities = new HashSet();
this.GrassCoverErosionInwardsCalculationEntities = new HashSet();
+ this.GrassCoverErosionOutwardsWaveConditionsCalculationEntities = new HashSet();
this.PipingCalculationEntities = new HashSet();
this.StabilityStoneCoverWaveConditionsCalculationEntities = new HashSet();
}
@@ -59,6 +60,8 @@
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection GrassCoverErosionInwardsCalculationEntities { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+ public virtual ICollection GrassCoverErosionOutwardsWaveConditionsCalculationEntities { get; set; }
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection PipingCalculationEntities { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection StabilityStoneCoverWaveConditionsCalculationEntities { get; set; }
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql
===================================================================
diff -u -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 -rcd386b0b37f478679e5d5566276150e30b4118de
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql (.../DatabaseStructure.sql) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql (.../DatabaseStructure.sql) (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -1,6 +1,6 @@
/* ---------------------------------------------------- */
/* Generated by Enterprise Architect Version 12.0 */
-/* Created On : 19-Sep-2016 7:51:29 AM */
+/* Created On : 19-Sep-2016 1:59:40 PM */
/* DBMS : SQLite */
/* ---------------------------------------------------- */
@@ -135,6 +135,9 @@
DROP TABLE IF EXISTS 'StabilityStoneCoverWaveConditionsOutputEntity'
;
+DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity'
+;
+
DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsHydraulicLocationEntity'
;
@@ -703,6 +706,31 @@
)
;
+CREATE TABLE 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity'
+(
+ 'GrassCoverErosionOutwardsWaveConditionsCalculationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'CalculationGroupEntityId' INTEGER NOT NULL,
+ 'ForeshoreProfileEntityId' INTEGER,
+ 'GrassCoverErosionOutwardsHydraulicLocationEntityId' INTEGER,
+ 'Order' INT (4) NOT NULL,
+ 'Name' VARCHAR (260),
+ 'Comments' TEXT,
+ 'UseBreakWater' TINYINT (1) NOT NULL, -- true or false
+ 'BreakWaterType' TINYINT (1) NOT NULL, -- Enum: 1 = Wall 2 = Caisson 3 = Dam
+ 'BreakWaterHeight' REAL,
+ 'UseForeshore' TINYINT (1) NOT NULL, -- true or false
+ 'Orientation' REAL,
+ 'UpperBoundaryRevetment' REAL,
+ 'LowerBoundaryRevetment' REAL,
+ 'UpperBoundaryWaterLevels' REAL,
+ 'LowerBoundaryWaterLevels' REAL,
+ 'StepSize' TINYINT (1) NOT NULL, -- 0.5, 1.0 or 2.0
+ CONSTRAINT 'FK_GrassCoverErosionOutwardsWaveConditionsCalculationEntity_CalculationGroupEntity' FOREIGN KEY ('CalculationGroupEntityId') REFERENCES 'CalculationGroupEntity' ('CalculationGroupEntityId') ON DELETE No Action ON UPDATE No Action,
+ CONSTRAINT 'FK_GrassCoverErosionOutwardsWaveConditionsCalculationEntity_ForeshoreProfileEntity' FOREIGN KEY ('ForeshoreProfileEntityId') REFERENCES 'ForeshoreProfileEntity' ('ForeshoreProfileEntityId') ON DELETE No Action ON UPDATE No Action,
+ CONSTRAINT 'FK_GrassCoverErosionOutwardsWaveConditionsCalculationEntity_GrassCoverErosionOutwardsHydraulicLocationEntity' FOREIGN KEY ('GrassCoverErosionOutwardsHydraulicLocationEntityId') REFERENCES 'GrassCoverErosionOutwardsHydraulicLocationEntity' ('GrassCoverErosionOutwardsHydraulicLocationEntityId') ON DELETE No Action ON UPDATE No Action
+)
+;
+
CREATE TABLE 'GrassCoverErosionOutwardsHydraulicLocationEntity'
(
'GrassCoverErosionOutwardsHydraulicLocationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
@@ -918,6 +946,18 @@
ON 'StabilityStoneCoverWaveConditionsOutputEntity' ('StabilityStoneCoverWaveConditionsCalculationEntityId' ASC)
;
+CREATE INDEX 'IXFK_GrassCoverErosionOutwardsWaveConditionsCalculationEntity_CalculationGroupEntity'
+ ON 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity' ('CalculationGroupEntityId' ASC)
+;
+
+CREATE INDEX 'IXFK_GrassCoverErosionOutwardsWaveConditionsCalculationEntity_ForeshoreProfileEntity'
+ ON 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity' ('ForeshoreProfileEntityId' ASC)
+;
+
+CREATE INDEX 'IXFK_GrassCoverErosionOutwardsWaveConditionsCalculationEntity_GrassCoverErosionOutwardsHydraulicLocationEntity'
+ ON 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity' ('GrassCoverErosionOutwardsHydraulicLocationEntityId' ASC)
+;
+
CREATE INDEX 'IXFK_GrassCoverErosionOutwardsHydraulicLocationEntity_FailureMechanismEntity'
ON 'GrassCoverErosionOutwardsHydraulicLocationEntity' ('FailureMechanismEntityId' ASC)
;
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/ForeshoreProfileEntity.cs
===================================================================
diff -u -r0540405a7dbabf85dc02db30c79c3c58b0faeea6 -rcd386b0b37f478679e5d5566276150e30b4118de
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/ForeshoreProfileEntity.cs (.../ForeshoreProfileEntity.cs) (revision 0540405a7dbabf85dc02db30c79c3c58b0faeea6)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/ForeshoreProfileEntity.cs (.../ForeshoreProfileEntity.cs) (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -38,6 +38,7 @@
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public ForeshoreProfileEntity()
{
+ this.GrassCoverErosionOutwardsWaveConditionsCalculationEntities = new HashSet();
this.StabilityStoneCoverWaveConditionsCalculationEntities = new HashSet();
}
@@ -55,6 +56,8 @@
public virtual FailureMechanismEntity FailureMechanismEntity { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+ public virtual ICollection GrassCoverErosionOutwardsWaveConditionsCalculationEntities { get; set; }
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection StabilityStoneCoverWaveConditionsCalculationEntities { get; set; }
}
}
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionOutwardsHydraulicLocationEntity.cs
===================================================================
diff -u -r2651fdf110e56d0f48e416fcffc1b4922cff00a5 -rcd386b0b37f478679e5d5566276150e30b4118de
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionOutwardsHydraulicLocationEntity.cs (.../GrassCoverErosionOutwardsHydraulicLocationEntity.cs) (revision 2651fdf110e56d0f48e416fcffc1b4922cff00a5)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionOutwardsHydraulicLocationEntity.cs (.../GrassCoverErosionOutwardsHydraulicLocationEntity.cs) (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -35,6 +35,12 @@
public partial class GrassCoverErosionOutwardsHydraulicLocationEntity
{
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+ public GrassCoverErosionOutwardsHydraulicLocationEntity()
+ {
+ this.GrassCoverErosionOutwardsWaveConditionsCalculationEntities = new HashSet();
+ }
+
public long GrassCoverErosionOutwardsHydraulicLocationEntityId { get; set; }
public long FailureMechanismEntityId { get; set; }
public long LocationId { get; set; }
@@ -48,5 +54,7 @@
public int Order { get; set; }
public virtual FailureMechanismEntity FailureMechanismEntity { get; set; }
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+ public virtual ICollection GrassCoverErosionOutwardsWaveConditionsCalculationEntities { get; set; }
}
}
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionOutwardsWaveConditionsCalculationEntity.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionOutwardsWaveConditionsCalculationEntity.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionOutwardsWaveConditionsCalculationEntity.cs (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -0,0 +1,60 @@
+// 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.
+
+//------------------------------------------------------------------------------
+//
+// This code was generated from a template.
+//
+// Manual changes to this file may cause unexpected behavior in your application.
+// Manual changes to this file will be overwritten if the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Application.Ringtoets.Storage.DbContext
+{
+ using System;
+ using System.Collections.Generic;
+
+ public partial class GrassCoverErosionOutwardsWaveConditionsCalculationEntity
+ {
+ public long GrassCoverErosionOutwardsWaveConditionsCalculationEntityId { get; set; }
+ public long CalculationGroupEntityId { get; set; }
+ public Nullable ForeshoreProfileEntityId { get; set; }
+ public Nullable GrassCoverErosionOutwardsHydraulicLocationEntityId { get; set; }
+ public int Order { get; set; }
+ public string Name { get; set; }
+ public string Comments { get; set; }
+ public byte UseBreakWater { get; set; }
+ public byte BreakWaterType { get; set; }
+ public Nullable BreakWaterHeight { get; set; }
+ public byte UseForeshore { get; set; }
+ public Nullable Orientation { get; set; }
+ public Nullable UpperBoundaryRevetment { get; set; }
+ public Nullable LowerBoundaryRevetment { get; set; }
+ public Nullable UpperBoundaryWaterLevels { get; set; }
+ public Nullable LowerBoundaryWaterLevels { get; set; }
+ public byte StepSize { get; set; }
+
+ public virtual CalculationGroupEntity CalculationGroupEntity { get; set; }
+ public virtual ForeshoreProfileEntity ForeshoreProfileEntity { get; set; }
+ public virtual GrassCoverErosionOutwardsHydraulicLocationEntity GrassCoverErosionOutwardsHydraulicLocationEntity { get; set; }
+ }
+}
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Context.cs
===================================================================
diff -u -r2651fdf110e56d0f48e416fcffc1b4922cff00a5 -rcd386b0b37f478679e5d5566276150e30b4118de
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Context.cs (.../RingtoetsEntities.Context.cs) (revision 2651fdf110e56d0f48e416fcffc1b4922cff00a5)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Context.cs (.../RingtoetsEntities.Context.cs) (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -68,6 +68,7 @@
public virtual DbSet GrassCoverErosionOutwardsFailureMechanismMetaEntities { get; set; }
public virtual DbSet GrassCoverErosionOutwardsHydraulicLocationEntities { get; set; }
public virtual DbSet GrassCoverErosionOutwardsSectionResultEntities { get; set; }
+ public virtual DbSet GrassCoverErosionOutwardsWaveConditionsCalculationEntities { get; set; }
public virtual DbSet GrassCoverSlipOffInwardsSectionResultEntities { get; set; }
public virtual DbSet GrassCoverSlipOffOutwardsSectionResultEntities { get; set; }
public virtual DbSet HeightStructuresSectionResultEntities { get; set; }
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx
===================================================================
diff -u -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 -rcd386b0b37f478679e5d5566276150e30b4118de
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -205,6 +205,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -770,6 +792,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1159,6 +1217,7 @@
+
@@ -1267,6 +1326,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1413,6 +1484,7 @@
+
@@ -1465,6 +1537,10 @@
+
+
+
+
@@ -1589,6 +1665,10 @@
+
+
+
+
@@ -1605,6 +1685,10 @@
+
+
+
+
@@ -1678,6 +1762,7 @@
+
@@ -1800,6 +1885,7 @@
+
@@ -1892,6 +1978,7 @@
+
@@ -1904,6 +1991,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2345,6 +2457,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2717,6 +2841,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2765,6 +2901,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3107,6 +3255,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram
===================================================================
diff -u -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 -rcd386b0b37f478679e5d5566276150e30b4118de
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -5,56 +5,58 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
@@ -86,10 +88,12 @@
+
+
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsCalculationEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsCalculationEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsCalculationEntityReadExtensions.cs (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -0,0 +1,101 @@
+// 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.Common.Data.DikeProfiles;
+using Ringtoets.GrassCoverErosionOutwards.Data;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.Revetment.Data;
+
+namespace Application.Ringtoets.Storage.Read.GrassCoverErosionOutwards
+{
+ ///
+ /// This class defines extension methods for read operations for a
+ /// based on the .
+ ///
+ internal static class GrassCoverErosionOutwardsWaveConditionsCalculationEntityReadExtensions
+ {
+ ///
+ /// 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 GrassCoverErosionOutwardsWaveConditionsCalculation Read(this GrassCoverErosionOutwardsWaveConditionsCalculationEntity entity, ReadConversionCollector collector)
+ {
+ if (collector == null)
+ {
+ throw new ArgumentNullException("collector");
+ }
+
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation
+ {
+ Name = entity.Name,
+ Comments = entity.Comments,
+ InputParameters =
+ {
+ ForeshoreProfile = GetDikeProfileValue(entity.ForeshoreProfileEntity, collector),
+ HydraulicBoundaryLocation = GetHydraulicBoundaryLocationValue(entity.GrassCoverErosionOutwardsHydraulicLocationEntity, collector),
+ Orientation = (RoundedDouble) entity.Orientation.ToNullAsNaN(),
+ UseForeshore = Convert.ToBoolean(entity.UseForeshore),
+ UseBreakWater = Convert.ToBoolean(entity.UseBreakWater),
+ BreakWater =
+ {
+ Height = (RoundedDouble) entity.BreakWaterHeight.ToNullAsNaN(),
+ Type = (BreakWaterType) entity.BreakWaterType
+ },
+ UpperBoundaryRevetment = (RoundedDouble) entity.UpperBoundaryRevetment.ToNullAsNaN(),
+ LowerBoundaryRevetment = (RoundedDouble) entity.LowerBoundaryRevetment.ToNullAsNaN(),
+ UpperBoundaryWaterLevels = (RoundedDouble) entity.UpperBoundaryWaterLevels.ToNullAsNaN(),
+ LowerBoundaryWaterLevels = (RoundedDouble) entity.LowerBoundaryWaterLevels.ToNullAsNaN(),
+ StepSize = (WaveConditionsInputStepSize) entity.StepSize
+ }
+ };
+
+ return calculation;
+ }
+
+ private static ForeshoreProfile GetDikeProfileValue(ForeshoreProfileEntity foreshoreProfileEntity, ReadConversionCollector collector)
+ {
+ if (foreshoreProfileEntity != null)
+ {
+ return foreshoreProfileEntity.Read(collector);
+ }
+ return null;
+ }
+
+ private static HydraulicBoundaryLocation GetHydraulicBoundaryLocationValue(
+ GrassCoverErosionOutwardsHydraulicLocationEntity hydraulicLocationEntity,
+ ReadConversionCollector collector)
+ {
+ if (hydraulicLocationEntity != null)
+ {
+ return hydraulicLocationEntity.Read(collector);
+ }
+ return null;
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityStoneCover/StabilityStoneCoverWaveConditionsCalculationEntityReadExtensions.cs
===================================================================
diff -u -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 -rcd386b0b37f478679e5d5566276150e30b4118de
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityStoneCover/StabilityStoneCoverWaveConditionsCalculationEntityReadExtensions.cs (.../StabilityStoneCoverWaveConditionsCalculationEntityReadExtensions.cs) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityStoneCover/StabilityStoneCoverWaveConditionsCalculationEntityReadExtensions.cs (.../StabilityStoneCoverWaveConditionsCalculationEntityReadExtensions.cs) (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -46,6 +46,7 @@
/// to create for.
/// The object keeping track of read operations.
/// A new .
+ /// Thrown when is null.
internal static StabilityStoneCoverWaveConditionsCalculation Read(this StabilityStoneCoverWaveConditionsCalculationEntity entity, ReadConversionCollector collector)
{
if (collector == null)
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj
===================================================================
diff -u -r7082f74ed1f0f3a0601a2d8833c864b8c08bea59 -rcd386b0b37f478679e5d5566276150e30b4118de
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 7082f74ed1f0f3a0601a2d8833c864b8c08bea59)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -77,9 +77,11 @@
Properties\GlobalAssembly.cs
+
-
+
+
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsConditionsCalculationCreateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsConditionsCalculationCreateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsConditionsCalculationCreateExtensionsTest.cs (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -0,0 +1,207 @@
+// 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.Collections.Generic;
+using System.Linq;
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.Create.GrassCoverErosionOutwards;
+using Application.Ringtoets.Storage.DbContext;
+using Core.Common.Base.Data;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.GrassCoverErosionOutwards.Data;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.Revetment.Data;
+
+namespace Application.Ringtoets.Storage.Test.Create.GrassCoverErosionOutwards
+{
+ [TestFixture]
+ public class GrassCoverErosionOutwardsConditionsCalculationCreateExtensionsTest
+ {
+ private static IEnumerable ValidWaveConditionsInputs
+ {
+ get
+ {
+ yield return new TestCaseData(1.0, true, 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.Half);
+ yield return new TestCaseData(1.0, true, 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.One);
+ yield return new TestCaseData(1.0, true, 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.Two);
+
+ yield return new TestCaseData(1.0, false, 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.Half);
+ yield return new TestCaseData(1.0, false, 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.One);
+ yield return new TestCaseData(1.0, false, 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.Two);
+
+ yield return new TestCaseData(double.NaN, true, double.NaN, double.NaN, double.NaN, double.NaN, WaveConditionsInputStepSize.Half);
+ yield return new TestCaseData(double.NaN, true, double.NaN, double.NaN, double.NaN, double.NaN, WaveConditionsInputStepSize.One);
+ yield return new TestCaseData(double.NaN, true, double.NaN, double.NaN, double.NaN, double.NaN, WaveConditionsInputStepSize.Two);
+
+ yield return new TestCaseData(double.NaN, false, double.NaN, double.NaN, double.NaN, double.NaN, WaveConditionsInputStepSize.Half);
+ yield return new TestCaseData(double.NaN, false, double.NaN, double.NaN, double.NaN, double.NaN, WaveConditionsInputStepSize.One);
+ yield return new TestCaseData(double.NaN, false, double.NaN, double.NaN, double.NaN, double.NaN, WaveConditionsInputStepSize.Two);
+ }
+ }
+
+ [Test]
+ public void Create_PersistenceRegistryIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation();
+
+ // Call
+ TestDelegate call = () => calculation.Create(null, 0);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual(paramName, "registry");
+ }
+
+ [Test]
+ [TestCaseSource("ValidWaveConditionsInputs")]
+ public void Create_GrassCoverErosionOutwardsWaveConditionsCalculationWithPropertiesSet_ReturnGrassCoverErosionOutwardsWaveConditionsCalculationEntity(
+ double orientation, bool useBreakWater, double lowerBoundaryRevetment,
+ double upperBoundaryRevetment, double lowerBoundaryWaterLevels,
+ double upperBoundaryWaterLevels, WaveConditionsInputStepSize stepSize)
+ {
+ // Setup
+ const string name = "Name";
+ const string comments = "comments";
+ const int order = 1234;
+
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation
+ {
+ Name = name,
+ Comments = comments,
+ InputParameters =
+ {
+ Orientation = (RoundedDouble) orientation,
+ UseBreakWater = useBreakWater,
+ UpperBoundaryRevetment = (RoundedDouble) upperBoundaryRevetment,
+ LowerBoundaryRevetment = (RoundedDouble) lowerBoundaryRevetment,
+ UpperBoundaryWaterLevels = (RoundedDouble) upperBoundaryWaterLevels,
+ LowerBoundaryWaterLevels = (RoundedDouble) lowerBoundaryWaterLevels,
+ StepSize = stepSize
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ GrassCoverErosionOutwardsWaveConditionsCalculationEntity entity = calculation.Create(registry, order);
+
+ // Assert
+ Assert.AreEqual(name, entity.Name);
+ Assert.AreEqual(comments, entity.Comments);
+
+ WaveConditionsInput input = calculation.InputParameters;
+ Assert.AreEqual(input.Orientation.Value, entity.Orientation);
+ Assert.AreEqual(Convert.ToByte(useBreakWater), entity.UseBreakWater);
+ Assert.AreEqual(Convert.ToByte(false), entity.UseForeshore);
+ Assert.AreEqual(input.UpperBoundaryRevetment, entity.UpperBoundaryRevetment, input.UpperBoundaryRevetment.GetAccuracy());
+ Assert.AreEqual(input.LowerBoundaryRevetment, entity.LowerBoundaryRevetment, input.LowerBoundaryRevetment.GetAccuracy());
+ Assert.AreEqual(input.UpperBoundaryWaterLevels, entity.UpperBoundaryWaterLevels, input.UpperBoundaryWaterLevels.GetAccuracy());
+ Assert.AreEqual(input.LowerBoundaryWaterLevels, entity.LowerBoundaryWaterLevels, input.LowerBoundaryWaterLevels.GetAccuracy());
+ Assert.AreEqual(Convert.ToByte(input.StepSize), entity.StepSize);
+
+ Assert.AreEqual(order, entity.Order);
+ Assert.AreEqual(0, entity.GrassCoverErosionOutwardsWaveConditionsCalculationEntityId);
+ Assert.IsNull(entity.CalculationGroupEntity);
+ Assert.IsNull(entity.ForeshoreProfileEntityId);
+ Assert.IsNull(entity.GrassCoverErosionOutwardsHydraulicLocationEntityId);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string name = "A";
+ const string comments = "B";
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation()
+ {
+ Name = name,
+ Comments = comments
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ GrassCoverErosionOutwardsWaveConditionsCalculationEntity entity = calculation.Create(registry, 0);
+
+ // Assert
+ Assert.AreNotSame(name, entity.Name,
+ "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
+ Assert.AreEqual(name, entity.Name);
+
+ Assert.AreNotSame(comments, entity.Comments,
+ "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
+ Assert.AreEqual(comments, entity.Comments);
+ }
+
+ [Test]
+ public void Create_GrassCoverErosionOutwardsHydraulicLocationEntity_EntityHasGrassCoverErosionOutwardsHydraulicLocationEntity()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "A", 2.3, 4.5);
+
+ var registry = new PersistenceRegistry();
+ GrassCoverErosionOutwardsHydraulicLocationEntity hydraulicLocationEntity =
+ hydraulicBoundaryLocation.CreateGrassCoverErosionOutwardsHydraulicBoundaryLocation(registry, 0);
+
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation
+ {
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = hydraulicBoundaryLocation
+ }
+ };
+
+ // Call
+ GrassCoverErosionOutwardsWaveConditionsCalculationEntity entity = calculation.Create(registry, 0);
+
+ // Assert
+ Assert.AreSame(hydraulicLocationEntity, entity.GrassCoverErosionOutwardsHydraulicLocationEntity);
+ }
+
+ [Test]
+ public void Create_HasForeshoreProfile_EntityHasForeshoreProfileEntity()
+ {
+ // Setup
+ var registry = new PersistenceRegistry();
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation
+ {
+ InputParameters =
+ {
+ ForeshoreProfile = new ForeshoreProfile(new Point2D(1, 2),
+ Enumerable.Empty(),
+ new BreakWater(BreakWaterType.Caisson, 2),
+ new ForeshoreProfile.ConstructionProperties())
+ }
+ };
+
+ // Call
+ GrassCoverErosionOutwardsWaveConditionsCalculationEntity 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/GrassCoverErosionOutwards/GrassCoverErosionOutwardsHydraulicLocationEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsHydraulicLocationEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsHydraulicLocationEntityReadExtensionsTest.cs (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -0,0 +1,155 @@
+// 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.GrassCoverErosionOutwards;
+using Core.Common.Base.Data;
+using NUnit.Framework;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.HydraRing.Data;
+
+namespace Application.Ringtoets.Storage.Test.Read.GrassCoverErosionOutwards
+{
+ [TestFixture]
+ public class GrassCoverErosionOutwardsHydraulicLocationEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_CollectorIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var entity = new GrassCoverErosionOutwardsHydraulicLocationEntity();
+
+ // Call
+ TestDelegate call = () => entity.Read(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("collector", paramName);
+ }
+
+ [Test]
+ public void Read_Always_ReturnsHydraulicBoundaryLocationWithPropertiesSet()
+ {
+ // Setup
+ var random = new Random(21);
+ long testId = random.Next(0, 400);
+ var testName = "testName";
+ double x = random.NextDouble();
+ double y = random.NextDouble();
+ var entity = new GrassCoverErosionOutwardsHydraulicLocationEntity
+ {
+ LocationId = testId,
+ Name = testName,
+ LocationX = x,
+ LocationY = y,
+ DesignWaterLevelCalculationConvergence = (byte) CalculationConvergence.CalculatedConverged,
+ WaveHeightCalculationConvergence = (byte) CalculationConvergence.CalculatedConverged
+ };
+
+ var collector = new ReadConversionCollector();
+
+ // Call
+ HydraulicBoundaryLocation location = entity.Read(collector);
+
+ // Assert
+ Assert.IsNotNull(location);
+ Assert.AreEqual(testId, location.Id);
+ Assert.AreEqual(testName, location.Name);
+ Assert.AreEqual(x, location.Location.X, 1e-6);
+ Assert.AreEqual(y, location.Location.Y, 1e-6);
+ Assert.IsNaN(location.DesignWaterLevel);
+ Assert.IsNaN(location.WaveHeight);
+ Assert.AreEqual(CalculationConvergence.CalculatedConverged, location.DesignWaterLevelCalculationConvergence);
+ Assert.AreEqual(CalculationConvergence.CalculatedConverged, location.WaveHeightCalculationConvergence);
+ }
+
+ [Test]
+ [TestCase(null, double.NaN)]
+ [TestCase(double.MaxValue, double.MaxValue)]
+ [TestCase(double.MinValue, double.MinValue)]
+ [TestCase(1.5, 1.5)]
+ [TestCase(double.NaN, double.NaN)]
+ public void Read_DifferentDesignWaterLevel_ReturnHydraulicBoundaryLocationWithExpectedWaterLevel(double? waterLevel, double expectedWaterLevel)
+ {
+ // Setup
+ var entity = new GrassCoverErosionOutwardsHydraulicLocationEntity
+ {
+ Name = "someName",
+ DesignWaterLevel = waterLevel
+ };
+
+ var collector = new ReadConversionCollector();
+
+ // Call
+ HydraulicBoundaryLocation location = entity.Read(collector);
+
+ // Assert
+ Assert.IsNotNull(location);
+ Assert.AreEqual((RoundedDouble) expectedWaterLevel, location.DesignWaterLevel, location.DesignWaterLevel.GetAccuracy());
+ }
+
+ [Test]
+ [TestCase(null, double.NaN)]
+ [TestCase(double.MaxValue, double.MaxValue)]
+ [TestCase(double.MinValue, double.MinValue)]
+ [TestCase(1.5, 1.5)]
+ [TestCase(double.NaN, double.NaN)]
+ public void Read_DifferentWaveHeight_ReturnHydraulicBoundaryLocationWithExpectedWaveHeight(double? waveHeight, double expectedWaveHeight)
+ {
+ // Setup
+ var entity = new GrassCoverErosionOutwardsHydraulicLocationEntity
+ {
+ Name = "someName",
+ WaveHeight = waveHeight
+ };
+
+ var collector = new ReadConversionCollector();
+
+ // Call
+ HydraulicBoundaryLocation location = entity.Read(collector);
+
+ // Assert
+ Assert.IsNotNull(location);
+ Assert.AreEqual((RoundedDouble) expectedWaveHeight, location.WaveHeight, location.WaveHeight.GetAccuracy());
+ }
+
+ [Test]
+ public void Read_SameHydraulicLocationEntityTwice_ReturnSameHydraulicBoundaryLocation()
+ {
+ // Setup
+ var entity = new GrassCoverErosionOutwardsHydraulicLocationEntity
+ {
+ Name = "A"
+ };
+
+ var collector = new ReadConversionCollector();
+
+ // Call
+ HydraulicBoundaryLocation location1 = entity.Read(collector);
+ HydraulicBoundaryLocation location2 = entity.Read(collector);
+
+ // Assert
+ Assert.AreSame(location1, location2);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsCalculationEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsCalculationEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsCalculationEntityReadExtensionsTest.cs (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -0,0 +1,261 @@
+// 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.Collections.Generic;
+using System.Linq;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Read;
+using Application.Ringtoets.Storage.Read.GrassCoverErosionOutwards;
+using Application.Ringtoets.Storage.Serializers;
+using Application.Ringtoets.Storage.TestUtil;
+using Core.Common.Base.Data;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.GrassCoverErosionOutwards.Data;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.Revetment.Data;
+
+namespace Application.Ringtoets.Storage.Test.Read.GrassCoverErosionOutwards
+{
+ [TestFixture]
+ public class GrassCoverErosionOutwardsWaveConditionsCalculationEntityReadExtensionsTest
+ {
+ private static IEnumerable ValidWaveConditionsInputs
+ {
+ get
+ {
+ yield return new TestCaseData("N", "C", 1.0, true, BreakWaterType.Caisson, 2.0, true,
+ 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.Half);
+ yield return new TestCaseData("N", "C", 1.0, true, BreakWaterType.Dam, 2.0, true,
+ 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.One);
+ yield return new TestCaseData("N", "C", 1.0, true, BreakWaterType.Wall, 2.0, true,
+ 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.Two);
+
+ yield return new TestCaseData("N", "C", 1.0, true, BreakWaterType.Wall, 2.0, false,
+ 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.Half);
+ yield return new TestCaseData("N", "C", 1.0, true, BreakWaterType.Dam, 2.0, false,
+ 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.One);
+ yield return new TestCaseData("N", "C", 1.0, true, BreakWaterType.Caisson, 2.0, false,
+ 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.Two);
+
+ yield return new TestCaseData("N", "C", 1.0, false, BreakWaterType.Caisson, 2.0, true,
+ 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.Half);
+ yield return new TestCaseData("N", "C", 1.0, false, BreakWaterType.Caisson, 2.0, true,
+ 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.One);
+ yield return new TestCaseData("N", "C", 1.0, false, BreakWaterType.Caisson, 2.0, true,
+ 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.Two);
+
+ yield return new TestCaseData("N", "C", 1.0, false, BreakWaterType.Caisson, 2.0, false,
+ 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.Half);
+ yield return new TestCaseData("N", "C", 1.0, false, BreakWaterType.Caisson, 2.0, false,
+ 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.One);
+ yield return new TestCaseData("N", "C", 1.0, false, BreakWaterType.Caisson, 2.0, false,
+ 3.58, 6.10, 3.40, 5.88, WaveConditionsInputStepSize.Two);
+
+ yield return new TestCaseData(null, null, double.NaN, true, BreakWaterType.Caisson, double.NaN, true,
+ double.NaN, double.NaN, double.NaN, double.NaN, WaveConditionsInputStepSize.Half);
+ yield return new TestCaseData(null, null, double.NaN, true, BreakWaterType.Caisson, double.NaN, true,
+ double.NaN, double.NaN, double.NaN, double.NaN, WaveConditionsInputStepSize.One);
+ yield return new TestCaseData(null, null, double.NaN, true, BreakWaterType.Caisson, double.NaN, true,
+ double.NaN, double.NaN, double.NaN, double.NaN, WaveConditionsInputStepSize.Two);
+
+ yield return new TestCaseData(null, null, double.NaN, true, BreakWaterType.Caisson, double.NaN, false,
+ double.NaN, double.NaN, double.NaN, double.NaN, WaveConditionsInputStepSize.Half);
+ yield return new TestCaseData(null, null, double.NaN, true, BreakWaterType.Caisson, double.NaN, false,
+ double.NaN, double.NaN, double.NaN, double.NaN, WaveConditionsInputStepSize.One);
+ yield return new TestCaseData(null, null, double.NaN, true, BreakWaterType.Caisson, double.NaN, false,
+ double.NaN, double.NaN, double.NaN, double.NaN, WaveConditionsInputStepSize.Two);
+
+ yield return new TestCaseData(null, null, double.NaN, false, BreakWaterType.Caisson, double.NaN, false,
+ double.NaN, double.NaN, double.NaN, double.NaN, WaveConditionsInputStepSize.Half);
+ yield return new TestCaseData(null, null, double.NaN, false, BreakWaterType.Caisson, double.NaN, false,
+ double.NaN, double.NaN, double.NaN, double.NaN, WaveConditionsInputStepSize.One);
+ yield return new TestCaseData(null, null, double.NaN, false, BreakWaterType.Caisson, double.NaN, false,
+ double.NaN, double.NaN, double.NaN, double.NaN, WaveConditionsInputStepSize.Two);
+ }
+ }
+
+ [Test]
+ public void Read_CollectorIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var entity = new GrassCoverErosionOutwardsWaveConditionsCalculationEntity();
+
+ // Call
+ TestDelegate call = () => entity.Read(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("collector", paramName);
+ }
+
+ [Test]
+ [TestCaseSource("ValidWaveConditionsInputs")]
+ public void Read_ValidEntity_ReturnGrassCoverErosionOutwardsWaveConditionsCalculation(
+ string name, string comments,
+ double orientation, bool useBreakWater, BreakWaterType breakWaterType, double breakWaterHeight, bool useForeshore, double lowerBoundaryRevetment,
+ double upperBoundaryRevetment, double lowerBoundaryWaterLevels,
+ double upperBoundaryWaterLevels, WaveConditionsInputStepSize stepSize)
+ {
+ // Setup
+ var entity = new GrassCoverErosionOutwardsWaveConditionsCalculationEntity
+ {
+ Name = name,
+ Comments = comments,
+ UseBreakWater = Convert.ToByte(useBreakWater),
+ BreakWaterType = (byte) breakWaterType,
+ BreakWaterHeight = breakWaterHeight,
+ UseForeshore = Convert.ToByte(useForeshore),
+ Orientation = orientation,
+ UpperBoundaryRevetment = upperBoundaryRevetment,
+ LowerBoundaryRevetment = lowerBoundaryRevetment,
+ UpperBoundaryWaterLevels = upperBoundaryWaterLevels,
+ LowerBoundaryWaterLevels = lowerBoundaryWaterLevels,
+ StepSize = (byte) stepSize
+ };
+
+ var collector = new ReadConversionCollector();
+
+ // Call
+ GrassCoverErosionOutwardsWaveConditionsCalculation calculation = entity.Read(collector);
+
+ // Assert
+ Assert.AreEqual(name, calculation.Name);
+ Assert.AreEqual(comments, calculation.Comments);
+ Assert.AreEqual(useBreakWater, calculation.InputParameters.UseBreakWater);
+ Assert.AreEqual(breakWaterType, calculation.InputParameters.BreakWater.Type);
+ AssertRoundedDouble(breakWaterHeight, calculation.InputParameters.BreakWater.Height);
+ Assert.AreEqual(useForeshore, calculation.InputParameters.UseForeshore);
+ AssertRoundedDouble(orientation, calculation.InputParameters.Orientation);
+ AssertRoundedDouble(upperBoundaryRevetment, calculation.InputParameters.UpperBoundaryRevetment);
+ AssertRoundedDouble(lowerBoundaryRevetment, calculation.InputParameters.LowerBoundaryRevetment);
+ AssertRoundedDouble(upperBoundaryWaterLevels, calculation.InputParameters.UpperBoundaryWaterLevels);
+ AssertRoundedDouble(lowerBoundaryWaterLevels, calculation.InputParameters.LowerBoundaryWaterLevels);
+ Assert.AreEqual(stepSize, calculation.InputParameters.StepSize);
+
+ Assert.IsNull(calculation.InputParameters.HydraulicBoundaryLocation);
+ Assert.IsNull(calculation.InputParameters.ForeshoreProfile);
+ Assert.IsNull(calculation.Output);
+ }
+
+ [Test]
+ public void Read_EntityWithForeshoreProfileInCollector_CalculationHasAlreadyReadForeshoreProfile()
+ {
+ // Setup
+ var foreshoreProfile = new TestForeshoreProfile();
+ var foreshoreProfileEntity = new ForeshoreProfileEntity
+ {
+ GeometryXml = new Point2DXmlSerializer().ToXml(Enumerable.Empty())
+ };
+ var entity = new GrassCoverErosionOutwardsWaveConditionsCalculationEntity
+ {
+ ForeshoreProfileEntity = foreshoreProfileEntity,
+ };
+
+ var collector = new ReadConversionCollector();
+ collector.Read(foreshoreProfileEntity, foreshoreProfile);
+
+ // Call
+ GrassCoverErosionOutwardsWaveConditionsCalculation calculation = entity.Read(collector);
+
+ // Assert
+ Assert.AreSame(foreshoreProfile, calculation.InputParameters.ForeshoreProfile);
+ }
+
+ [Test]
+ public void Read_EntityWithForeshoreProfileNotYetInCollector_CalculationWithCreatedForeshoreProfileAndRegisteredNewEntities()
+ {
+ // Setup
+ string name = "foreshore profile";
+ var foreshoreProfileEntity = new ForeshoreProfileEntity
+ {
+ Name = name,
+ GeometryXml = new Point2DXmlSerializer().ToXml(Enumerable.Empty())
+ };
+
+ var entity = new GrassCoverErosionOutwardsWaveConditionsCalculationEntity
+ {
+ ForeshoreProfileEntity = foreshoreProfileEntity,
+ };
+
+ var collector = new ReadConversionCollector();
+
+ // Call
+ GrassCoverErosionOutwardsWaveConditionsCalculation calculation = entity.Read(collector);
+
+ // Assert
+ Assert.IsTrue(collector.Contains(foreshoreProfileEntity));
+ CollectionAssert.AreEqual(name, calculation.InputParameters.ForeshoreProfile.Name);
+ }
+
+ [Test]
+ public void Read_EntityWithHydraulicBoundaryLocationInCollector_CalculationHasAlreadyReadHydraulicBoundaryLocation()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "A", 1.1, 2.2);
+ var hydraulicLocationEntity = new GrassCoverErosionOutwardsHydraulicLocationEntity();
+ var entity = new GrassCoverErosionOutwardsWaveConditionsCalculationEntity
+ {
+ GrassCoverErosionOutwardsHydraulicLocationEntity = hydraulicLocationEntity
+ };
+
+ var collector = new ReadConversionCollector();
+ collector.Read(hydraulicLocationEntity, hydraulicBoundaryLocation);
+
+ // Call
+ GrassCoverErosionOutwardsWaveConditionsCalculation calculation = entity.Read(collector);
+
+ // Assert
+ Assert.AreSame(hydraulicBoundaryLocation, calculation.InputParameters.HydraulicBoundaryLocation);
+ }
+
+ [Test]
+ public void Read_EntityWithHydraulicBoundaryLocationNotYetInCollector_CalculationWithCreatedHydraulicBoundaryLocationAndRegisteredNewEntities()
+ {
+ // Setup
+ var hydraulicLocationEntity = new GrassCoverErosionOutwardsHydraulicLocationEntity
+ {
+ Name = "A"
+ };
+
+ var entity = new GrassCoverErosionOutwardsWaveConditionsCalculationEntity
+ {
+ GrassCoverErosionOutwardsHydraulicLocationEntity = hydraulicLocationEntity
+ };
+
+ var collector = new ReadConversionCollector();
+
+ // Call
+ entity.Read(collector);
+
+ // Assert
+ Assert.IsTrue(collector.Contains(hydraulicLocationEntity));
+ }
+
+ private static void AssertRoundedDouble(double expectedValue, RoundedDouble actualValue)
+ {
+ Assert.AreEqual(expectedValue, actualValue, actualValue.GetAccuracy());
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag cd386b0b37f478679e5d5566276150e30b4118de refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionOutwardsHydraulicLocationEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityStoneCover/StabilityStoneCoverWaveConditionsCalculationEntityReadExtensionsTest.cs
===================================================================
diff -u -r7082f74ed1f0f3a0601a2d8833c864b8c08bea59 -rcd386b0b37f478679e5d5566276150e30b4118de
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityStoneCover/StabilityStoneCoverWaveConditionsCalculationEntityReadExtensionsTest.cs (.../StabilityStoneCoverWaveConditionsCalculationEntityReadExtensionsTest.cs) (revision 7082f74ed1f0f3a0601a2d8833c864b8c08bea59)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityStoneCover/StabilityStoneCoverWaveConditionsCalculationEntityReadExtensionsTest.cs (.../StabilityStoneCoverWaveConditionsCalculationEntityReadExtensionsTest.cs) (revision cd386b0b37f478679e5d5566276150e30b4118de)
@@ -170,7 +170,7 @@
};
var entity = new StabilityStoneCoverWaveConditionsCalculationEntity
{
- ForeshoreProfileEntity = foreshoreProfileEntity,
+ ForeshoreProfileEntity = foreshoreProfileEntity
};
var collector = new ReadConversionCollector();
@@ -196,7 +196,7 @@
var entity = new StabilityStoneCoverWaveConditionsCalculationEntity
{
- ForeshoreProfileEntity = foreshoreProfileEntity,
+ ForeshoreProfileEntity = foreshoreProfileEntity
};
var collector = new ReadConversionCollector();
@@ -241,7 +241,7 @@
var entity = new StabilityStoneCoverWaveConditionsCalculationEntity
{
- HydraulicLocationEntity = hydraulicLocationEntity,
+ HydraulicLocationEntity = hydraulicLocationEntity
};
var collector = new ReadConversionCollector();