Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj =================================================================== diff -u -rcd386b0b37f478679e5d5566276150e30b4118de -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision cd386b0b37f478679e5d5566276150e30b4118de) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -62,9 +62,10 @@ - + + RingtoetsEntities.tt @@ -201,12 +202,16 @@ RingtoetsEntities.tt + + RingtoetsEntities.tt + + @@ -300,7 +305,7 @@ - + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/CalculationGroupCreateExtensions.cs =================================================================== diff -u -ra1038b9835ef74c1a2533afa2fbe5cbe2a41747c -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/CalculationGroupCreateExtensions.cs (.../CalculationGroupCreateExtensions.cs) (revision a1038b9835ef74c1a2533afa2fbe5cbe2a41747c) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/CalculationGroupCreateExtensions.cs (.../CalculationGroupCreateExtensions.cs) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -24,12 +24,14 @@ using Application.Ringtoets.Storage.Create.GrassCoverErosionOutwards; using Application.Ringtoets.Storage.Create.Piping; using Application.Ringtoets.Storage.Create.StabilityStoneCover; +using Application.Ringtoets.Storage.Create.WaveImpactAsphaltCover; using Application.Ringtoets.Storage.DbContext; using Ringtoets.Common.Data.Calculation; using Ringtoets.GrassCoverErosionInwards.Data; using Ringtoets.GrassCoverErosionOutwards.Data; using Ringtoets.Piping.Data; using Ringtoets.StabilityStoneCover.Data; +using Ringtoets.WaveImpactAsphaltCover.Data; namespace Application.Ringtoets.Storage.Create { @@ -95,6 +97,11 @@ { entity.StabilityStoneCoverWaveConditionsCalculationEntities.Add(stabilityStoneCoverWaveConditionsCalculation.Create(registry, i)); } + var waveImpactAsphaltCoverWaveConditionsCalculation = calculationBase as WaveImpactAsphaltCoverWaveConditionsCalculation; + if (waveImpactAsphaltCoverWaveConditionsCalculation != null) + { + entity.WaveImpactAsphaltCoverWaveConditionsCalculationEntities.Add(waveImpactAsphaltCoverWaveConditionsCalculation.Create(registry, i)); + } } } } Fisheye: Tag 5cc8a49cc445a67f425ced8216c772b9170ea517 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsConditionsCalculationCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsCalculationCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsCalculationCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsCalculationCreateExtensions.cs (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -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 GrassCoverErosionOutwardsWaveConditionsCalculationCreateExtensions + { + /// + /// 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/WaveImpactAsphaltCover/WaveImpactAsphaltCoverConditionsCalculationCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverConditionsCalculationCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverConditionsCalculationCreateExtensions.cs (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -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.WaveImpactAsphaltCover.Data; +using Ringtoets.HydraRing.Data; + +namespace Application.Ringtoets.Storage.Create.WaveImpactAsphaltCover +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class WaveImpactAsphaltCoverConditionsCalculationCreateExtensions + { + /// + /// 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 WaveImpactAsphaltCoverWaveConditionsCalculationEntity Create(this WaveImpactAsphaltCoverWaveConditionsCalculation calculation, + PersistenceRegistry registry, int order) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + + var entity = new WaveImpactAsphaltCoverWaveConditionsCalculationEntity + { + 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.HydraulicLocationEntity = hydraulicBoundaryLocation.Create(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/DbContext/CalculationGroupEntity.cs =================================================================== diff -u -rcd386b0b37f478679e5d5566276150e30b4118de -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/CalculationGroupEntity.cs (.../CalculationGroupEntity.cs) (revision cd386b0b37f478679e5d5566276150e30b4118de) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/CalculationGroupEntity.cs (.../CalculationGroupEntity.cs) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -44,6 +44,7 @@ this.GrassCoverErosionOutwardsWaveConditionsCalculationEntities = new HashSet(); this.PipingCalculationEntities = new HashSet(); this.StabilityStoneCoverWaveConditionsCalculationEntities = new HashSet(); + this.WaveImpactAsphaltCoverWaveConditionsCalculationEntities = new HashSet(); } public long CalculationGroupEntityId { get; set; } @@ -65,5 +66,7 @@ public virtual ICollection PipingCalculationEntities { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection StabilityStoneCoverWaveConditionsCalculationEntities { get; set; } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public virtual ICollection WaveImpactAsphaltCoverWaveConditionsCalculationEntities { get; set; } } } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql =================================================================== diff -u -rcd386b0b37f478679e5d5566276150e30b4118de -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql (.../DatabaseStructure.sql) (revision cd386b0b37f478679e5d5566276150e30b4118de) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql (.../DatabaseStructure.sql) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -1,6 +1,6 @@ /* ---------------------------------------------------- */ /* Generated by Enterprise Architect Version 12.0 */ -/* Created On : 19-Sep-2016 1:59:40 PM */ +/* Created On : 19-sep-2016 15:04:12 */ /* DBMS : SQLite */ /* ---------------------------------------------------- */ @@ -135,6 +135,9 @@ DROP TABLE IF EXISTS 'StabilityStoneCoverWaveConditionsOutputEntity' ; +DROP TABLE IF EXISTS 'WaveImpactAsphaltCoverWaveConditionsCalculationEntity' +; + DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity' ; @@ -706,6 +709,31 @@ ) ; +CREATE TABLE 'WaveImpactAsphaltCoverWaveConditionsCalculationEntity' +( + 'WaveImpactAsphaltCoverWaveConditionsCalculationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + 'CalculationGroupEntityId' INTEGER NOT NULL, + 'ForeshoreProfileEntityId' INTEGER, + 'HydraulicLocationEntityId' 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_WaveImpactAsphaltCoverWaveConditionsCalculationEntity_CalculationGroupEntity' FOREIGN KEY ('CalculationGroupEntityId') REFERENCES 'CalculationGroupEntity' ('CalculationGroupEntityId') ON DELETE No Action ON UPDATE No Action, + CONSTRAINT 'FK_WaveImpactAsphaltCoverWaveConditionsCalculationEntity_ForeshoreProfileEntity' FOREIGN KEY ('ForeshoreProfileEntityId') REFERENCES 'ForeshoreProfileEntity' ('ForeshoreProfileEntityId') ON DELETE No Action ON UPDATE No Action, + CONSTRAINT 'FK_WaveImpactAsphaltCoverWaveConditionsCalculationEntity_HydraulicLocationEntity' FOREIGN KEY ('HydraulicLocationEntityId') REFERENCES 'HydraulicLocationEntity' ('HydraulicLocationEntityId') ON DELETE No Action ON UPDATE No Action +) +; + CREATE TABLE 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity' ( 'GrassCoverErosionOutwardsWaveConditionsCalculationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, @@ -946,6 +974,18 @@ ON 'StabilityStoneCoverWaveConditionsOutputEntity' ('StabilityStoneCoverWaveConditionsCalculationEntityId' ASC) ; +CREATE INDEX 'IXFK_WaveImpactAsphaltCoverWaveConditionsCalculationEntity_CalculationGroupEntity' + ON 'WaveImpactAsphaltCoverWaveConditionsCalculationEntity' ('CalculationGroupEntityId' ASC) +; + +CREATE INDEX 'IXFK_WaveImpactAsphaltCoverWaveConditionsCalculationEntity_ForeshoreProfileEntity' + ON 'WaveImpactAsphaltCoverWaveConditionsCalculationEntity' ('ForeshoreProfileEntityId' ASC) +; + +CREATE INDEX 'IXFK_WaveImpactAsphaltCoverWaveConditionsCalculationEntity_HydraulicLocationEntity' + ON 'WaveImpactAsphaltCoverWaveConditionsCalculationEntity' ('HydraulicLocationEntityId' ASC) +; + CREATE INDEX 'IXFK_GrassCoverErosionOutwardsWaveConditionsCalculationEntity_CalculationGroupEntity' ON 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity' ('CalculationGroupEntityId' ASC) ; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/ForeshoreProfileEntity.cs =================================================================== diff -u -rcd386b0b37f478679e5d5566276150e30b4118de -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/ForeshoreProfileEntity.cs (.../ForeshoreProfileEntity.cs) (revision cd386b0b37f478679e5d5566276150e30b4118de) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/ForeshoreProfileEntity.cs (.../ForeshoreProfileEntity.cs) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -40,6 +40,7 @@ { this.GrassCoverErosionOutwardsWaveConditionsCalculationEntities = new HashSet(); this.StabilityStoneCoverWaveConditionsCalculationEntities = new HashSet(); + this.WaveImpactAsphaltCoverWaveConditionsCalculationEntities = new HashSet(); } public long ForeshoreProfileEntityId { get; set; } @@ -59,5 +60,7 @@ public virtual ICollection GrassCoverErosionOutwardsWaveConditionsCalculationEntities { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection StabilityStoneCoverWaveConditionsCalculationEntities { get; set; } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public virtual ICollection WaveImpactAsphaltCoverWaveConditionsCalculationEntities { get; set; } } } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/HydraulicLocationEntity.cs =================================================================== diff -u -r0540405a7dbabf85dc02db30c79c3c58b0faeea6 -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/HydraulicLocationEntity.cs (.../HydraulicLocationEntity.cs) (revision 0540405a7dbabf85dc02db30c79c3c58b0faeea6) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/HydraulicLocationEntity.cs (.../HydraulicLocationEntity.cs) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -41,6 +41,7 @@ this.GrassCoverErosionInwardsCalculationEntities = new HashSet(); this.PipingCalculationEntities = new HashSet(); this.StabilityStoneCoverWaveConditionsCalculationEntities = new HashSet(); + this.WaveImpactAsphaltCoverWaveConditionsCalculationEntities = new HashSet(); } public long HydraulicLocationEntityId { get; set; } @@ -62,5 +63,7 @@ public virtual ICollection PipingCalculationEntities { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection StabilityStoneCoverWaveConditionsCalculationEntities { get; set; } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public virtual ICollection WaveImpactAsphaltCoverWaveConditionsCalculationEntities { get; set; } } } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Context.cs =================================================================== diff -u -rcd386b0b37f478679e5d5566276150e30b4118de -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Context.cs (.../RingtoetsEntities.Context.cs) (revision cd386b0b37f478679e5d5566276150e30b4118de) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Context.cs (.../RingtoetsEntities.Context.cs) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -97,5 +97,6 @@ public virtual DbSet VersionEntities { get; set; } public virtual DbSet WaterPressureAsphaltCoverSectionResultEntities { get; set; } public virtual DbSet WaveImpactAsphaltCoverSectionResultEntities { get; set; } + public virtual DbSet WaveImpactAsphaltCoverWaveConditionsCalculationEntities { get; set; } } } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Designer.cs =================================================================== diff -u -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Designer.cs (.../RingtoetsEntities.Designer.cs) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Designer.cs (.../RingtoetsEntities.Designer.cs) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -1,25 +1,4 @@ -// 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. - -// T4 code generation is enabled for model 'D:\Projects\WTI\trunk\Application\Ringtoets\src\Application.Ringtoets.Storage\DbContext\RingtoetsEntities.edmx'. +// T4 code generation is enabled for model 'D:\repos\WettelijkToetsInstrumentarium\Application\Ringtoets\src\Application.Ringtoets.Storage\DbContext\RingtoetsEntities.edmx'. // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model // is open in the designer. Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx =================================================================== diff -u -rcd386b0b37f478679e5d5566276150e30b4118de -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision cd386b0b37f478679e5d5566276150e30b4118de) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -4,7 +4,7 @@ - + @@ -552,6 +552,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -1200,6 +1222,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1246,6 +1304,7 @@ + @@ -1462,6 +1521,18 @@ + + + + + + + + + + + + @@ -1513,6 +1584,7 @@ + @@ -1549,6 +1621,10 @@ + + + + @@ -1673,6 +1749,10 @@ + + + + @@ -1697,6 +1777,10 @@ + + + + @@ -1765,6 +1849,7 @@ + @@ -1887,6 +1972,7 @@ + @@ -2067,6 +2153,7 @@ + @@ -2385,6 +2472,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2493,6 +2605,18 @@ + + + + + + + + + + + + @@ -2865,6 +2989,18 @@ + + + + + + + + + + + + @@ -2937,6 +3073,18 @@ + + + + + + + + + + + + @@ -3631,6 +3779,29 @@ + + + + + + + + + + + + + + + + + + + + + + + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram =================================================================== diff -u -rcd386b0b37f478679e5d5566276150e30b4118de -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision cd386b0b37f478679e5d5566276150e30b4118de) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -5,51 +5,52 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + @@ -59,6 +60,7 @@ + @@ -90,12 +92,14 @@ + + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/WaveImpactAsphaltCoverWaveConditionsCalculationEntity.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/WaveImpactAsphaltCoverWaveConditionsCalculationEntity.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/WaveImpactAsphaltCoverWaveConditionsCalculationEntity.cs (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -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 WaveImpactAsphaltCoverWaveConditionsCalculationEntity + { + public long WaveImpactAsphaltCoverWaveConditionsCalculationEntityId { get; set; } + public long CalculationGroupEntityId { get; set; } + public Nullable ForeshoreProfileEntityId { get; set; } + public Nullable HydraulicLocationEntityId { 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 HydraulicLocationEntity HydraulicLocationEntity { get; set; } + } +} Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/CalculationGroupEntityReadExtentions.cs =================================================================== diff -u -ra1038b9835ef74c1a2533afa2fbe5cbe2a41747c -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/CalculationGroupEntityReadExtentions.cs (.../CalculationGroupEntityReadExtentions.cs) (revision a1038b9835ef74c1a2533afa2fbe5cbe2a41747c) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/CalculationGroupEntityReadExtentions.cs (.../CalculationGroupEntityReadExtentions.cs) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -26,6 +26,7 @@ using Application.Ringtoets.Storage.Read.GrassCoverErosionOutwards; using Application.Ringtoets.Storage.Read.Piping; using Application.Ringtoets.Storage.Read.StabilityStoneCover; +using Application.Ringtoets.Storage.Read.WaveImpactAsphaltCover; using Ringtoets.Common.Data.Calculation; using Ringtoets.Piping.Data; @@ -213,6 +214,11 @@ { group.Children.Add(childCalculationGroupEntity.ReadAsWaveImpactAsphaltCoverWaveConditionsCalculationGroup(collector)); } + var childCalculationEntity = childEntity as WaveImpactAsphaltCoverWaveConditionsCalculationEntity; + if (childCalculationEntity != null) + { + group.Children.Add(childCalculationEntity.Read(collector)); + } } return group; @@ -241,6 +247,10 @@ { sortedList.Add(calculationEntity.Order, calculationEntity); } + foreach (WaveImpactAsphaltCoverWaveConditionsCalculationEntity asphaltCoverWaveConditionsCalculationEntity in entity.WaveImpactAsphaltCoverWaveConditionsCalculationEntities) + { + sortedList.Add(asphaltCoverWaveConditionsCalculationEntity.Order, asphaltCoverWaveConditionsCalculationEntity); + } return sortedList.Values; } } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs =================================================================== diff -u -r8a45113465dd347e1f382345cb4c6b578232585e -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 8a45113465dd347e1f382345cb4c6b578232585e) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -26,6 +26,7 @@ using Application.Ringtoets.Storage.Read.GrassCoverErosionInwards; using Application.Ringtoets.Storage.Read.GrassCoverErosionOutwards; using Application.Ringtoets.Storage.Read.Piping; +using Application.Ringtoets.Storage.Read.WaveImpactAsphaltCover; using Core.Common.Base; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.DikeProfiles; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverSectionResultEntityReadExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverSectionResultEntityReadExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverSectionResultEntityReadExtensions.cs (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -0,0 +1,55 @@ +// 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.WaveImpactAsphaltCover.Data; + +namespace Application.Ringtoets.Storage.Read.WaveImpactAsphaltCover +{ + /// + /// This class defines extension methods for read operations for a based on the + /// . + /// + internal static class WaveImpactAsphaltCoverSectionResultEntityReadExtensions + { + /// + /// Reads the and use the information to update a + /// . + /// + /// The to create for. + /// The target of the read operation. + /// A new . + /// Thrown when is null. + internal static void Read(this WaveImpactAsphaltCoverSectionResultEntity entity, WaveImpactAsphaltCoverFailureMechanismSectionResult sectionResult) + { + if (sectionResult == null) + { + throw new ArgumentNullException("sectionResult"); + } + + sectionResult.AssessmentLayerOne = Convert.ToBoolean(entity.LayerOne); + sectionResult.AssessmentLayerTwoA = (RoundedDouble) entity.LayerTwoA.ToNullAsNaN(); + sectionResult.AssessmentLayerThree = (RoundedDouble) entity.LayerThree.ToNullAsNaN(); + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsCalculationEntityReadExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsCalculationEntityReadExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsCalculationEntityReadExtensions.cs (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -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.WaveImpactAsphaltCover.Data; +using Ringtoets.HydraRing.Data; +using Ringtoets.Revetment.Data; + +namespace Application.Ringtoets.Storage.Read.WaveImpactAsphaltCover +{ + /// + /// This class defines extension methods for read operations for a + /// based on the . + /// + internal static class WaveImpactAsphaltCoverWaveConditionsCalculationEntityReadExtensions + { + /// + /// 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 WaveImpactAsphaltCoverWaveConditionsCalculation Read(this WaveImpactAsphaltCoverWaveConditionsCalculationEntity entity, ReadConversionCollector collector) + { + if (collector == null) + { + throw new ArgumentNullException("collector"); + } + + var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation + { + Name = entity.Name, + Comments = entity.Comments, + InputParameters = + { + ForeshoreProfile = GetDikeProfileValue(entity.ForeshoreProfileEntity, collector), + HydraulicBoundaryLocation = GetHydraulicBoundaryLocationValue(entity.HydraulicLocationEntity, 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( + HydraulicLocationEntity hydraulicLocationEntity, + ReadConversionCollector collector) + { + if (hydraulicLocationEntity != null) + { + return hydraulicLocationEntity.Read(collector); + } + return null; + } + } +} \ No newline at end of file Fisheye: Tag 5cc8a49cc445a67f425ced8216c772b9170ea517 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/WaveImpactAsphaltCoverSectionResultEntityReadExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj =================================================================== diff -u -rcd386b0b37f478679e5d5566276150e30b4118de -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision cd386b0b37f478679e5d5566276150e30b4118de) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -77,13 +77,15 @@ Properties\GlobalAssembly.cs - + + + @@ -179,7 +181,7 @@ - + Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/CalculationGroupCreateExtensionsTest.cs =================================================================== diff -u -ra1038b9835ef74c1a2533afa2fbe5cbe2a41747c -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/CalculationGroupCreateExtensionsTest.cs (.../CalculationGroupCreateExtensionsTest.cs) (revision a1038b9835ef74c1a2533afa2fbe5cbe2a41747c) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/CalculationGroupCreateExtensionsTest.cs (.../CalculationGroupCreateExtensionsTest.cs) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -29,6 +29,7 @@ using Ringtoets.GrassCoverErosionOutwards.Data; using Ringtoets.Piping.Data; using Ringtoets.StabilityStoneCover.Data; +using Ringtoets.WaveImpactAsphaltCover.Data; namespace Application.Ringtoets.Storage.Test.Create { @@ -503,5 +504,94 @@ Assert.AreEqual("D", childEntity4.Name); Assert.AreEqual(3, childEntity4.Order); } + + [Test] + public void Create_GroupWithChildWaveImpactAsphaltCoverWaveConditionsCalculations_CreateEntities() + { + // Setup + var group = new CalculationGroup("root", true) + { + Children = + { + new WaveImpactAsphaltCoverWaveConditionsCalculation + { + Name = "A" + }, + new WaveImpactAsphaltCoverWaveConditionsCalculation + { + Name = "B" + } + } + }; + + var registry = new PersistenceRegistry(); + + // Call + CalculationGroupEntity entity = group.Create(registry, 0); + + // Assert + WaveImpactAsphaltCoverWaveConditionsCalculationEntity[] childCalculationEntities = entity.WaveImpactAsphaltCoverWaveConditionsCalculationEntities.ToArray(); + Assert.AreEqual(2, childCalculationEntities.Length); + + WaveImpactAsphaltCoverWaveConditionsCalculationEntity childEntity1 = childCalculationEntities[0]; + Assert.AreEqual("A", childEntity1.Name); + Assert.AreEqual(0, childEntity1.Order); + WaveImpactAsphaltCoverWaveConditionsCalculationEntity childEntity2 = childCalculationEntities[1]; + Assert.AreEqual("B", childEntity2.Name); + Assert.AreEqual(1, childEntity2.Order); + } + + [Test] + public void Create_GroupWithChildWaveImpactAsphaltCoverWaveConditionsCalculationsAndChildCalculationGroups_CreateEntities() + { + // Setup + var group = new CalculationGroup("root", true) + { + Children = + { + new CalculationGroup("A", true), + new WaveImpactAsphaltCoverWaveConditionsCalculation + { + Name = "B" + }, + new CalculationGroup("C", false), + new WaveImpactAsphaltCoverWaveConditionsCalculation + { + Name = "D" + } + } + }; + + var registry = new PersistenceRegistry(); + + // Call + CalculationGroupEntity entity = group.Create(registry, 0); + + // Assert + CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity1.ToArray(); + WaveImpactAsphaltCoverWaveConditionsCalculationEntity[] childCalculationEntities = entity.WaveImpactAsphaltCoverWaveConditionsCalculationEntities.ToArray(); + Assert.AreEqual(2, childGroupEntities.Length); + Assert.AreEqual(2, childCalculationEntities.Length); + + CalculationGroupEntity childEntity1 = childGroupEntities[0]; + Assert.AreEqual("A", childEntity1.Name); + Assert.AreEqual(1, childEntity1.IsEditable); + Assert.AreEqual(0, childEntity1.Order); + CollectionAssert.IsEmpty(childEntity1.CalculationGroupEntity1); + + WaveImpactAsphaltCoverWaveConditionsCalculationEntity childEntity2 = childCalculationEntities[0]; + Assert.AreEqual("B", childEntity2.Name); + Assert.AreEqual(1, childEntity2.Order); + + CalculationGroupEntity childEntity3 = childGroupEntities[1]; + Assert.AreEqual("C", childEntity3.Name); + Assert.AreEqual(0, childEntity3.IsEditable); + Assert.AreEqual(2, childEntity3.Order); + CollectionAssert.IsEmpty(childEntity3.CalculationGroupEntity1); + + WaveImpactAsphaltCoverWaveConditionsCalculationEntity childEntity4 = childCalculationEntities[1]; + Assert.AreEqual("D", childEntity4.Name); + Assert.AreEqual(3, childEntity4.Order); + } } } \ No newline at end of file Fisheye: Tag 5cc8a49cc445a67f425ced8216c772b9170ea517 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsConditionsCalculationCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsCalculationCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsCalculationCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsCalculationCreateExtensionsTest.cs (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -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 GrassCoverErosionOutwardsWaveConditionsCalculationCreateExtensionsTest + { + 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.ForeshoreProfileEntity); + Assert.IsNull(entity.GrassCoverErosionOutwardsHydraulicLocationEntity); + } + + [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/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u -r83a72354e69c186ca436bbe29e31122b9b8f4c3a -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismCreateExtensionsTest.cs (.../WaveImpactAsphaltCoverFailureMechanismCreateExtensionsTest.cs) (revision 83a72354e69c186ca436bbe29e31122b9b8f4c3a) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismCreateExtensionsTest.cs (.../WaveImpactAsphaltCoverFailureMechanismCreateExtensionsTest.cs) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -27,7 +27,6 @@ using Application.Ringtoets.Storage.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.Calculation; -using Ringtoets.StabilityStoneCover.Data; using Ringtoets.WaveImpactAsphaltCover.Data; namespace Application.Ringtoets.Storage.Test.Create.WaveImpactAsphaltCover Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsCalculationCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsCalculationCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsCalculationCreateExtensionsTest.cs (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -0,0 +1,206 @@ +// 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.WaveImpactAsphaltCover; +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.WaveImpactAsphaltCover.Data; +using Ringtoets.HydraRing.Data; +using Ringtoets.Revetment.Data; + +namespace Application.Ringtoets.Storage.Test.Create.WaveImpactAsphaltCover +{ + [TestFixture] + public class WaveImpactAsphaltCoverWaveConditionsCalculationCreateExtensionsTest + { + 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 WaveImpactAsphaltCoverWaveConditionsCalculation(); + + // Call + TestDelegate call = () => calculation.Create(null, 0); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual(paramName, "registry"); + } + + [Test] + [TestCaseSource("ValidWaveConditionsInputs")] + public void Create_WaveImpactAsphaltCoverWaveConditionsCalculationWithPropertiesSet_ReturnWaveImpactAsphaltCoverWaveConditionsCalculationEntity( + 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 WaveImpactAsphaltCoverWaveConditionsCalculation + { + 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 + WaveImpactAsphaltCoverWaveConditionsCalculationEntity 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.WaveImpactAsphaltCoverWaveConditionsCalculationEntityId); + Assert.IsNull(entity.CalculationGroupEntity); + Assert.IsNull(entity.ForeshoreProfileEntity); + Assert.IsNull(entity.HydraulicLocationEntity); + } + + [Test] + public void Create_StringPropertiesDoNotShareReference() + { + // Setup + const string name = "A"; + const string comments = "B"; + var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation() + { + Name = name, + Comments = comments + }; + + var registry = new PersistenceRegistry(); + + // Call + WaveImpactAsphaltCoverWaveConditionsCalculationEntity 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_WaveImpactAsphaltCoverHydraulicLocationEntity_EntityHasWaveImpactAsphaltCoverHydraulicLocationEntity() + { + // Setup + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "A", 2.3, 4.5); + + var registry = new PersistenceRegistry(); + HydraulicLocationEntity hydraulicLocationEntity = hydraulicBoundaryLocation.Create(registry, 0); + + var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation + } + }; + + // Call + WaveImpactAsphaltCoverWaveConditionsCalculationEntity entity = calculation.Create(registry, 0); + + // Assert + Assert.AreSame(hydraulicLocationEntity, entity.HydraulicLocationEntity); + } + + [Test] + public void Create_HasForeshoreProfile_EntityHasForeshoreProfileEntity() + { + // Setup + var registry = new PersistenceRegistry(); + var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation + { + InputParameters = + { + ForeshoreProfile = new ForeshoreProfile(new Point2D(1, 2), + Enumerable.Empty(), + new BreakWater(BreakWaterType.Caisson, 2), + new ForeshoreProfile.ConstructionProperties()) + } + }; + + // Call + WaveImpactAsphaltCoverWaveConditionsCalculationEntity 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/CalculationGroupEntityReadExtentionsTest.cs =================================================================== diff -u -ra1038b9835ef74c1a2533afa2fbe5cbe2a41747c -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/CalculationGroupEntityReadExtentionsTest.cs (.../CalculationGroupEntityReadExtentionsTest.cs) (revision a1038b9835ef74c1a2533afa2fbe5cbe2a41747c) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/CalculationGroupEntityReadExtentionsTest.cs (.../CalculationGroupEntityReadExtentionsTest.cs) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -29,6 +29,7 @@ using Ringtoets.GrassCoverErosionOutwards.Data; using Ringtoets.Piping.Data; using Ringtoets.StabilityStoneCover.Data; +using Ringtoets.WaveImpactAsphaltCover.Data; namespace Application.Ringtoets.Storage.Test.Read { @@ -986,6 +987,102 @@ Assert.IsTrue(rootChildGroup1Child2.IsNameEditable); CollectionAssert.IsEmpty(rootChildGroup1Child2.Children); } + + [Test] + public void ReadAsWaveImpactAsphaltCoverWaveConditionsCalculationGroup_EntityWithChildWaveImpactAsphaltCoverWaveConditionsCalculations_CreateCalculationGroupWithChildCalculations() + { + // Setup + var rootGroupEntity = new CalculationGroupEntity + { + Name = "A", + WaveImpactAsphaltCoverWaveConditionsCalculationEntities = + { + new WaveImpactAsphaltCoverWaveConditionsCalculationEntity + { + Order = 1, + Name = "2" + }, + new WaveImpactAsphaltCoverWaveConditionsCalculationEntity + { + Order = 0, + Name = "1" + } + } + }; + + var collector = new ReadConversionCollector(); + + // Call + var rootGroup = rootGroupEntity.ReadAsWaveImpactAsphaltCoverWaveConditionsCalculationGroup(collector); + + // Assert + ICalculationBase[] rootChildren = rootGroup.Children.ToArray(); + Assert.AreEqual(2, rootChildren.Length); + + var rootChildCalculation1 = (WaveImpactAsphaltCoverWaveConditionsCalculation)rootChildren[0]; + Assert.AreEqual("1", rootChildCalculation1.Name); + + var rootChildCalculation2 = (WaveImpactAsphaltCoverWaveConditionsCalculation)rootChildren[1]; + Assert.AreEqual("2", rootChildCalculation2.Name); + } + + [Test] + public void ReadAsWaveImpactAsphaltCoverWaveConditionsCalculationGroup_EntityWithChildWaveImpactAsphaltCoverWaveConditionsCalculationsAndGroups_CreateCalculationGroupWithChildCalculationsAndGroups() + { + // Setup + var rootGroupEntity = new CalculationGroupEntity + { + Name = "A", + WaveImpactAsphaltCoverWaveConditionsCalculationEntities = + { + new WaveImpactAsphaltCoverWaveConditionsCalculationEntity + { + Order = 0, + Name = "calculation1" + }, + new WaveImpactAsphaltCoverWaveConditionsCalculationEntity + { + Order = 2, + Name = "calculation2" + } + }, + CalculationGroupEntity1 = + { + new CalculationGroupEntity + { + Order = 3, + Name = "group2" + }, + new CalculationGroupEntity + { + Order = 1, + Name = "group1" + } + } + }; + + var collector = new ReadConversionCollector(); + + // Call + var rootGroup = rootGroupEntity.ReadAsWaveImpactAsphaltCoverWaveConditionsCalculationGroup(collector); + + // Assert + ICalculationBase[] rootChildren = rootGroup.Children.ToArray(); + Assert.AreEqual(4, rootChildren.Length); + + var rootChildCalculation1 = (WaveImpactAsphaltCoverWaveConditionsCalculation)rootChildren[0]; + Assert.AreEqual("calculation1", rootChildCalculation1.Name); + + var rootChildGroup1 = (CalculationGroup)rootChildren[1]; + Assert.AreEqual("group1", rootChildGroup1.Name); + + var rootChildCalculation2 = (WaveImpactAsphaltCoverWaveConditionsCalculation)rootChildren[2]; + Assert.AreEqual("calculation2", rootChildCalculation2.Name); + + var rootChildGroup2 = (CalculationGroup)rootChildren[3]; + Assert.AreEqual("group2", rootChildGroup2.Name); + } + #endregion } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverSectionResultEntityReadExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverSectionResultEntityReadExtensionsTest.cs (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -0,0 +1,131 @@ +// 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.WaveImpactAsphaltCover; +using Application.Ringtoets.Storage.TestUtil; +using NUnit.Framework; +using Ringtoets.WaveImpactAsphaltCover.Data; + +namespace Application.Ringtoets.Storage.Test.Read.WaveImpactAsphaltCover +{ + [TestFixture] + public class WaveImpactAsphaltCoverSectionResultEntityReadExtensionsTest + { + [Test] + public void Read_SectionResultIsNull_ThrowArgumentNullException() + { + // Setup + var entity = new WaveImpactAsphaltCoverSectionResultEntity(); + + // Call + TestDelegate call = () => entity.Read(null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("sectionResult", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Read_WithDecimalParameterValues_ReturnWaveImpactAsphaltCoverSectionResultWithDoubleParameterValues(bool layerOne) + { + // Setup + var random = new Random(21); + double layerThree = random.NextDouble(); + double layerTwoA = random.NextDouble(); + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new WaveImpactAsphaltCoverSectionResultEntity + { + LayerThree = layerThree, + LayerTwoA = layerTwoA, + LayerOne = Convert.ToByte(layerOne), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.IsNotNull(sectionResult); + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA, 1e-6); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Read_WithNullLayerTwoA_ReturnWaveImpactAsphaltCoverSectionResultWithNullParameters(bool layerOne) + { + // Setup + var collector = new ReadConversionCollector(); + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new WaveImpactAsphaltCoverSectionResultEntity + { + LayerOne = Convert.ToByte(layerOne), + LayerTwoA = null, + LayerThree = new Random(21).NextDouble(), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.IsNaN(sectionResult.AssessmentLayerTwoA); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Read_WithNullLayerThree_ReturnWaveImpactAsphaltCoverSectionResultWithNullParameters(bool layerOne) + { + // Setup + var collector = new ReadConversionCollector(); + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new WaveImpactAsphaltCoverSectionResultEntity + { + LayerOne = Convert.ToByte(layerOne), + LayerTwoA = new Random(21).NextDouble(), + LayerThree = null, + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.IsNaN(sectionResult.AssessmentLayerThree); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsCalculationEntityReadExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsCalculationEntityReadExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsCalculationEntityReadExtensionsTest.cs (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -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.WaveImpactAsphaltCover; +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.WaveImpactAsphaltCover.Data; +using Ringtoets.HydraRing.Data; +using Ringtoets.Revetment.Data; + +namespace Application.Ringtoets.Storage.Test.Read.WaveImpactAsphaltCover +{ + [TestFixture] + public class WaveImpactAsphaltCoverWaveConditionsCalculationEntityReadExtensionsTest + { + 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 WaveImpactAsphaltCoverWaveConditionsCalculationEntity(); + + // Call + TestDelegate call = () => entity.Read(null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("collector", paramName); + } + + [Test] + [TestCaseSource("ValidWaveConditionsInputs")] + public void Read_ValidEntity_ReturnWaveImpactAsphaltCoverWaveConditionsCalculation( + 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 WaveImpactAsphaltCoverWaveConditionsCalculationEntity + { + 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 + WaveImpactAsphaltCoverWaveConditionsCalculation 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 WaveImpactAsphaltCoverWaveConditionsCalculationEntity + { + ForeshoreProfileEntity = foreshoreProfileEntity, + }; + + var collector = new ReadConversionCollector(); + collector.Read(foreshoreProfileEntity, foreshoreProfile); + + // Call + WaveImpactAsphaltCoverWaveConditionsCalculation 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 WaveImpactAsphaltCoverWaveConditionsCalculationEntity + { + ForeshoreProfileEntity = foreshoreProfileEntity, + }; + + var collector = new ReadConversionCollector(); + + // Call + WaveImpactAsphaltCoverWaveConditionsCalculation 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 HydraulicLocationEntity(); + var entity = new WaveImpactAsphaltCoverWaveConditionsCalculationEntity + { + HydraulicLocationEntity = hydraulicLocationEntity + }; + + var collector = new ReadConversionCollector(); + collector.Read(hydraulicLocationEntity, hydraulicBoundaryLocation); + + // Call + WaveImpactAsphaltCoverWaveConditionsCalculation calculation = entity.Read(collector); + + // Assert + Assert.AreSame(hydraulicBoundaryLocation, calculation.InputParameters.HydraulicBoundaryLocation); + } + + [Test] + public void Read_EntityWithHydraulicBoundaryLocationNotYetInCollector_CalculationWithCreatedHydraulicBoundaryLocationAndRegisteredNewEntities() + { + // Setup + var hydraulicLocationEntity = new HydraulicLocationEntity + { + Name = "A" + }; + + var entity = new WaveImpactAsphaltCoverWaveConditionsCalculationEntity + { + HydraulicLocationEntity = 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 5cc8a49cc445a67f425ced8216c772b9170ea517 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/WaveImpactAsphaltCoverSectionResultEntityReadExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/RingtoetsProjectTestHelperTest.cs =================================================================== diff -u -rf22d98bf46f98e0ee4b435bf84652c1ac35aa28b -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/RingtoetsProjectTestHelperTest.cs (.../RingtoetsProjectTestHelperTest.cs) (revision f22d98bf46f98e0ee4b435bf84652c1ac35aa28b) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/RingtoetsProjectTestHelperTest.cs (.../RingtoetsProjectTestHelperTest.cs) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -152,6 +152,7 @@ StabilityStoneCoverFailureMechanism stabilityStoneCoverFailureMechanism = assessmentSection.StabilityStoneCover; Assert.AreEqual(2, stabilityStoneCoverFailureMechanism.ForeshoreProfiles.Count); Assert.NotNull(stabilityStoneCoverFailureMechanism.WaveConditionsCalculationGroup); + Assert.AreEqual(3, stabilityStoneCoverFailureMechanism.WaveConditionsCalculationGroup.Children.Count); Assert.AreEqual(1, ((CalculationGroup)stabilityStoneCoverFailureMechanism.WaveConditionsCalculationGroup.Children[0]).Children.Count); Assert.IsInstanceOf( @@ -163,10 +164,14 @@ WaveImpactAsphaltCoverFailureMechanism waveImpactAsphaltCoverFailureMechanism = assessmentSection.WaveImpactAsphaltCover; Assert.AreEqual(2, waveImpactAsphaltCoverFailureMechanism.ForeshoreProfiles.Count); Assert.NotNull(waveImpactAsphaltCoverFailureMechanism.WaveConditionsCalculationGroup); - Assert.AreEqual(2, waveImpactAsphaltCoverFailureMechanism.WaveConditionsCalculationGroup.Children.Count); + Assert.AreEqual(3, waveImpactAsphaltCoverFailureMechanism.WaveConditionsCalculationGroup.Children.Count); - Assert.AreEqual(0, ((CalculationGroup)waveImpactAsphaltCoverFailureMechanism.WaveConditionsCalculationGroup.Children[0]).Children.Count); + Assert.AreEqual(1, ((CalculationGroup)waveImpactAsphaltCoverFailureMechanism.WaveConditionsCalculationGroup.Children[0]).Children.Count); + Assert.IsInstanceOf( + ((CalculationGroup)waveImpactAsphaltCoverFailureMechanism.WaveConditionsCalculationGroup.Children[0]).Children[0]); Assert.AreEqual(0, ((CalculationGroup)waveImpactAsphaltCoverFailureMechanism.WaveConditionsCalculationGroup.Children[1]).Children.Count); + Assert.IsInstanceOf( + waveImpactAsphaltCoverFailureMechanism.WaveConditionsCalculationGroup.Children[2]); } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs =================================================================== diff -u -rf22d98bf46f98e0ee4b435bf84652c1ac35aa28b -r5cc8a49cc445a67f425ced8216c772b9170ea517 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision f22d98bf46f98e0ee4b435bf84652c1ac35aa28b) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) @@ -88,7 +88,7 @@ WaveImpactAsphaltCoverFailureMechanism waveImpactAsphaltCoverFailureMechanism = assessmentSection.WaveImpactAsphaltCover; AddForeshoreProfiles(waveImpactAsphaltCoverFailureMechanism.ForeshoreProfiles); - ConfigureWaveImpactAsphaltCoverFailureMechanism(waveImpactAsphaltCoverFailureMechanism); + ConfigureWaveImpactAsphaltCoverFailureMechanism(waveImpactAsphaltCoverFailureMechanism, assessmentSection); AddSections(waveImpactAsphaltCoverFailureMechanism); SetSectionResults(waveImpactAsphaltCoverFailureMechanism.SectionResults); @@ -692,7 +692,7 @@ }); failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup { - Name = "GCEO A" + Name = "GCEO B" }); failureMechanism.WaveConditionsCalculationGroup.Children.Add( new GrassCoverErosionOutwardsWaveConditionsCalculation @@ -742,7 +742,7 @@ ForeshoreProfile foreshoreProfile = failureMechanism.ForeshoreProfiles[0]; failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup { - Name = "GEKB A", + Name = "SSC A", Children = { new StabilityStoneCoverWaveConditionsCalculation @@ -779,7 +779,7 @@ }); failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup { - Name = "SSC A" + Name = "SSC B" }); failureMechanism.WaveConditionsCalculationGroup.Children.Add( new StabilityStoneCoverWaveConditionsCalculation @@ -830,16 +830,67 @@ #region WaveImpactAsphaltCover FailureMechanism - private static void ConfigureWaveImpactAsphaltCoverFailureMechanism(WaveImpactAsphaltCoverFailureMechanism failureMechanism) + private static void ConfigureWaveImpactAsphaltCoverFailureMechanism(WaveImpactAsphaltCoverFailureMechanism failureMechanism, IAssessmentSection assessmentSection) { + ForeshoreProfile foreshoreProfile = failureMechanism.ForeshoreProfiles[0]; failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup { - Name = "GCEO A", + Name = "WIAC A", + Children = + { + new WaveImpactAsphaltCoverWaveConditionsCalculation + { + Name = "Calculation 1", + Comments = "Comments for Calculation 1", + InputParameters = + { + ForeshoreProfile = foreshoreProfile, + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations[0], + BreakWater = + { + Height = (RoundedDouble) (foreshoreProfile.BreakWater.Height + 0.3), + Type = BreakWaterType.Wall + }, + Orientation = foreshoreProfile.Orientation, + UseForeshore = true, + UseBreakWater = true, + UpperBoundaryRevetment = (RoundedDouble) 22.3, + LowerBoundaryRevetment = (RoundedDouble) (-3.2), + UpperBoundaryWaterLevels = (RoundedDouble) 15.3, + LowerBoundaryWaterLevels = (RoundedDouble) (-2.4), + StepSize = WaveConditionsInputStepSize.Two + } + } + } }); failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup { - Name = "GCEO A" + Name = "WIAC B" }); + failureMechanism.WaveConditionsCalculationGroup.Children.Add( + new WaveImpactAsphaltCoverWaveConditionsCalculation + { + Name = "Calculation 2", + Comments = "Comments for Calculation 2", + InputParameters = + { + ForeshoreProfile = null, + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations[0], + BreakWater = + { + Height = (RoundedDouble)(foreshoreProfile.BreakWater.Height + 0.1), + Type = BreakWaterType.Dam + }, + Orientation = foreshoreProfile.Orientation, + UseForeshore = false, + UseBreakWater = false, + UpperBoundaryRevetment = (RoundedDouble)12.3, + LowerBoundaryRevetment = (RoundedDouble)(-3.5), + UpperBoundaryWaterLevels = (RoundedDouble)13.3, + LowerBoundaryWaterLevels = (RoundedDouble)(-1.9), + StepSize = WaveConditionsInputStepSize.One + } + }); } private static void SetSectionResults(IEnumerable sectionResults)