Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj =================================================================== diff -u -r6bc95d372c789501e4d6505eb6fbe4e7a319d53f -r553f0128e1d2b027e25e00909fd2f3d0b13404b2 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 6bc95d372c789501e4d6505eb6fbe4e7a319d53f) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 553f0128e1d2b027e25e00909fd2f3d0b13404b2) @@ -64,7 +64,7 @@ - + RingtoetsEntities.tt @@ -117,6 +117,9 @@ RingtoetsEntities.tt + + RingtoetsEntities.tt + RingtoetsEntities.tt @@ -205,13 +208,17 @@ RingtoetsEntities.tt + + RingtoetsEntities.tt + + Fisheye: Tag 553f0128e1d2b027e25e00909fd2f3d0b13404b2 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverWaveConditionsOutputCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaveConditionsOutputCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaveConditionsOutputCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaveConditionsOutputCreateExtensions.cs (revision 553f0128e1d2b027e25e00909fd2f3d0b13404b2) @@ -0,0 +1,89 @@ +// 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.Revetment.Data; +using Ringtoets.StabilityStoneCover.Data; + +namespace Application.Ringtoets.Storage.Create +{ + /// + /// Extension methods for related to + /// creating a . + /// + internal static class WaveConditionsOutputCreateExtensions + { + /// + /// Creates a based on the information + /// of the . + /// + /// The calculation output for stability stone cover failure mechanism to + /// create a database entity for. + /// The type of the . + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static StabilityStoneCoverWaveConditionsOutputEntity CreateStabilityStoneCoverWaveConditionsOutput( + this WaveConditionsOutput output, WaveConditionsOutputType type, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var entity = new StabilityStoneCoverWaveConditionsOutputEntity + { + WaterLevel = output.WaterLevel.Value.ToNaNAsNull(), + WaveHeight = output.WaveHeight.Value.ToNaNAsNull(), + WavePeakPeriod = output.WavePeakPeriod.Value.ToNaNAsNull(), + WaveAngle = output.WaveAngle.Value.ToNaNAsNull(), + OutputType = (byte) type + }; + return entity; + } + + /// + /// Creates a based on the information + /// of the . + /// + /// The calculation output for stability stone cover failure mechanism to + /// create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static WaveImpactAsphaltCoverWaveConditionsOutputEntity CreateWaveImpactAsphaltCoverWaveConditionsOutput( + this WaveConditionsOutput output, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var entity = new WaveImpactAsphaltCoverWaveConditionsOutputEntity + { + WaterLevel = output.WaterLevel.Value.ToNaNAsNull(), + WaveHeight = output.WaveHeight.Value.ToNaNAsNull(), + WavePeakPeriod = output.WavePeakPeriod.Value.ToNaNAsNull(), + WaveAngle = output.WaveAngle.Value.ToNaNAsNull(), + }; + return entity; + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionOutwardsWaveConditionsCalculationEntity.cs =================================================================== diff -u -rcd386b0b37f478679e5d5566276150e30b4118de -r553f0128e1d2b027e25e00909fd2f3d0b13404b2 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionOutwardsWaveConditionsCalculationEntity.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationEntity.cs) (revision cd386b0b37f478679e5d5566276150e30b4118de) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionOutwardsWaveConditionsCalculationEntity.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationEntity.cs) (revision 553f0128e1d2b027e25e00909fd2f3d0b13404b2) @@ -35,6 +35,12 @@ public partial class GrassCoverErosionOutwardsWaveConditionsCalculationEntity { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] + public GrassCoverErosionOutwardsWaveConditionsCalculationEntity() + { + this.GrassCoverErosionOutwardsWaveConditionsOutputEntities = new HashSet(); + } + public long GrassCoverErosionOutwardsWaveConditionsCalculationEntityId { get; set; } public long CalculationGroupEntityId { get; set; } public Nullable ForeshoreProfileEntityId { get; set; } @@ -56,5 +62,7 @@ public virtual CalculationGroupEntity CalculationGroupEntity { get; set; } public virtual ForeshoreProfileEntity ForeshoreProfileEntity { get; set; } public virtual GrassCoverErosionOutwardsHydraulicLocationEntity GrassCoverErosionOutwardsHydraulicLocationEntity { get; set; } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public virtual ICollection GrassCoverErosionOutwardsWaveConditionsOutputEntities { get; set; } } } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionOutwardsWaveConditionsOutputEntity.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionOutwardsWaveConditionsOutputEntity.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionOutwardsWaveConditionsOutputEntity.cs (revision 553f0128e1d2b027e25e00909fd2f3d0b13404b2) @@ -0,0 +1,48 @@ +// 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 GrassCoverErosionOutwardsWaveConditionsOutputEntity + { + public long GrassCoverErosionOutwardsWaveConditionsOutputEntityId { get; set; } + public long GrassCoverErosionOutwardsWaveConditionsCalculationEntityId { get; set; } + public int Order { get; set; } + public Nullable WaterLevel { get; set; } + public Nullable WaveHeight { get; set; } + public Nullable WavePeakPeriod { get; set; } + public Nullable WaveAngle { get; set; } + + public virtual GrassCoverErosionOutwardsWaveConditionsCalculationEntity GrassCoverErosionOutwardsWaveConditionsCalculationEntity { get; set; } + } +} Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Context.cs =================================================================== diff -u -r5cc8a49cc445a67f425ced8216c772b9170ea517 -r553f0128e1d2b027e25e00909fd2f3d0b13404b2 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Context.cs (.../RingtoetsEntities.Context.cs) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Context.cs (.../RingtoetsEntities.Context.cs) (revision 553f0128e1d2b027e25e00909fd2f3d0b13404b2) @@ -69,6 +69,7 @@ public virtual DbSet GrassCoverErosionOutwardsHydraulicLocationEntities { get; set; } public virtual DbSet GrassCoverErosionOutwardsSectionResultEntities { get; set; } public virtual DbSet GrassCoverErosionOutwardsWaveConditionsCalculationEntities { get; set; } + public virtual DbSet GrassCoverErosionOutwardsWaveConditionsOutputEntities { get; set; } public virtual DbSet GrassCoverSlipOffInwardsSectionResultEntities { get; set; } public virtual DbSet GrassCoverSlipOffOutwardsSectionResultEntities { get; set; } public virtual DbSet HeightStructuresSectionResultEntities { get; set; } @@ -98,5 +99,6 @@ public virtual DbSet WaterPressureAsphaltCoverSectionResultEntities { get; set; } public virtual DbSet WaveImpactAsphaltCoverSectionResultEntities { get; set; } public virtual DbSet WaveImpactAsphaltCoverWaveConditionsCalculationEntities { get; set; } + public virtual DbSet WaveImpactAsphaltCoverWaveConditionsOutputEntities { get; set; } } } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx =================================================================== diff -u -r5cc8a49cc445a67f425ced8216c772b9170ea517 -r553f0128e1d2b027e25e00909fd2f3d0b13404b2 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision 553f0128e1d2b027e25e00909fd2f3d0b13404b2) @@ -227,6 +227,18 @@ + + + + + + + + + + + + @@ -574,6 +586,18 @@ + + + + + + + + + + + + @@ -850,6 +874,18 @@ + + + + + + + + + + + + @@ -1258,6 +1294,18 @@ + + + + + + + + + + + + @@ -1276,6 +1324,7 @@ + @@ -1305,6 +1354,7 @@ + @@ -1397,6 +1447,10 @@ + + + + @@ -1533,6 +1587,10 @@ + + + + @@ -1556,6 +1614,7 @@ + @@ -1585,6 +1644,7 @@ + @@ -1769,6 +1829,10 @@ + + + + @@ -1813,6 +1877,10 @@ + + + + @@ -2101,7 +2169,21 @@ + + + + + + + + + + + + + + @@ -2496,7 +2578,21 @@ + + + + + + + + + + + + + + @@ -3049,6 +3145,18 @@ + + + + + + + + + + + + @@ -3181,6 +3289,18 @@ + + + + + + + + + + + + @@ -3426,6 +3546,19 @@ + + + + + + + + + + + + + @@ -3802,6 +3935,19 @@ + + + + + + + + + + + + + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram =================================================================== diff -u -r5cc8a49cc445a67f425ced8216c772b9170ea517 -r553f0128e1d2b027e25e00909fd2f3d0b13404b2 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision 553f0128e1d2b027e25e00909fd2f3d0b13404b2) @@ -5,52 +5,54 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + @@ -97,6 +99,7 @@ + @@ -108,6 +111,7 @@ + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/WaveImpactAsphaltCoverWaveConditionsCalculationEntity.cs =================================================================== diff -u -r5cc8a49cc445a67f425ced8216c772b9170ea517 -r553f0128e1d2b027e25e00909fd2f3d0b13404b2 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/WaveImpactAsphaltCoverWaveConditionsCalculationEntity.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationEntity.cs) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/WaveImpactAsphaltCoverWaveConditionsCalculationEntity.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationEntity.cs) (revision 553f0128e1d2b027e25e00909fd2f3d0b13404b2) @@ -35,6 +35,12 @@ public partial class WaveImpactAsphaltCoverWaveConditionsCalculationEntity { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] + public WaveImpactAsphaltCoverWaveConditionsCalculationEntity() + { + this.WaveImpactAsphaltCoverWaveConditionsOutputEntities = new HashSet(); + } + public long WaveImpactAsphaltCoverWaveConditionsCalculationEntityId { get; set; } public long CalculationGroupEntityId { get; set; } public Nullable ForeshoreProfileEntityId { get; set; } @@ -56,5 +62,7 @@ public virtual CalculationGroupEntity CalculationGroupEntity { get; set; } public virtual ForeshoreProfileEntity ForeshoreProfileEntity { get; set; } public virtual HydraulicLocationEntity HydraulicLocationEntity { get; set; } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public virtual ICollection WaveImpactAsphaltCoverWaveConditionsOutputEntities { get; set; } } } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/WaveImpactAsphaltCoverWaveConditionsOutputEntity.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/WaveImpactAsphaltCoverWaveConditionsOutputEntity.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/WaveImpactAsphaltCoverWaveConditionsOutputEntity.cs (revision 553f0128e1d2b027e25e00909fd2f3d0b13404b2) @@ -0,0 +1,48 @@ +// 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 WaveImpactAsphaltCoverWaveConditionsOutputEntity + { + public long WaveImpactAsphaltCoverWaveConditionsOutputEntityId { get; set; } + public long WaveImpactAsphaltCoverWaveConditionsCalculationEntityId { get; set; } + public int Order { get; set; } + public Nullable WaterLevel { get; set; } + public Nullable WaveHeight { get; set; } + public Nullable WavePeakPeriod { get; set; } + public Nullable WaveAngle { get; set; } + + public virtual WaveImpactAsphaltCoverWaveConditionsCalculationEntity WaveImpactAsphaltCoverWaveConditionsCalculationEntity { get; set; } + } +} Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsOutputEntityReadExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsOutputEntityReadExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsOutputEntityReadExtensions.cs (revision 553f0128e1d2b027e25e00909fd2f3d0b13404b2) @@ -0,0 +1,49 @@ +// 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 Application.Ringtoets.Storage.DbContext; +using Ringtoets.Revetment.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 WaveImpactAsphaltCoverWaveConditionsOutputEntityReadExtensions + { + /// + /// Reads the + /// and use the information to construct a . + /// + /// The + /// to create for. + /// A new . + internal static WaveConditionsOutput Read(this WaveImpactAsphaltCoverWaveConditionsOutputEntity entity) + { + return new WaveConditionsOutput(entity.WaterLevel.ToNullAsNaN(), + entity.WaveHeight.ToNullAsNaN(), + entity.WavePeakPeriod.ToNullAsNaN(), + entity.WaveAngle.ToNullAsNaN()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj =================================================================== diff -u -r5cc8a49cc445a67f425ced8216c772b9170ea517 -r553f0128e1d2b027e25e00909fd2f3d0b13404b2 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 5cc8a49cc445a67f425ced8216c772b9170ea517) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 553f0128e1d2b027e25e00909fd2f3d0b13404b2) @@ -79,13 +79,15 @@ + + Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsOutputCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsOutputCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsOutputCreateExtensionsTest.cs (revision 553f0128e1d2b027e25e00909fd2f3d0b13404b2) @@ -0,0 +1,88 @@ +// 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.Create; +using Application.Ringtoets.Storage.DbContext; +using NUnit.Framework; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Revetment.Data; + +namespace Application.Ringtoets.Storage.Test.Create.WaveImpactAsphaltCover +{ + [TestFixture] + public class WaveImpactAsphaltCoverWaveConditionsOutputCreateExtensionsTest + { + [Test] + public void Create_PersistenceRegistryIsNull_ThrowArgumentNullException() + { + // Setup + var output = new WaveConditionsOutput(1.1, 2.2, 3.3, 4.4); + + // Call + TestDelegate call = () => output.CreateWaveImpactAsphaltCoverWaveConditionsOutput(null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + public void Create_AllOutputValuesSet_ReturnEntity() + { + // Setup + var output = new WaveConditionsOutput(1.1, 2.2, 3.3, 4.4); + + var registry = new PersistenceRegistry(); + + // Call + WaveImpactAsphaltCoverWaveConditionsOutputEntity entity = output.CreateWaveImpactAsphaltCoverWaveConditionsOutput(registry); + + // Assert + Assert.AreEqual(output.WaterLevel, entity.WaterLevel, output.WaterLevel.GetAccuracy()); + Assert.AreEqual(output.WaveHeight, entity.WaveHeight, output.WaveHeight.GetAccuracy()); + Assert.AreEqual(output.WavePeakPeriod, entity.WavePeakPeriod, output.WavePeakPeriod.GetAccuracy()); + Assert.AreEqual(output.WaveAngle, entity.WaveAngle, output.WaveAngle.GetAccuracy()); + + Assert.IsNull(entity.WaveImpactAsphaltCoverWaveConditionsCalculationEntity); + } + + [Test] + public void Create_AllOutputValuesNaN_ReturnEntityWithNullValues() + { + // Setup + var output = new WaveConditionsOutput(double.NaN, double.NaN, double.NaN, double.NaN); + + var registry = new PersistenceRegistry(); + + // Call + WaveImpactAsphaltCoverWaveConditionsOutputEntity entity = output.CreateWaveImpactAsphaltCoverWaveConditionsOutput(registry); + + // Assert + Assert.IsNull(entity.WaterLevel); + Assert.IsNull(entity.WaveHeight); + Assert.IsNull(entity.WavePeakPeriod); + Assert.IsNull(entity.WaveAngle); + + Assert.IsNull(entity.WaveImpactAsphaltCoverWaveConditionsCalculationEntity); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityStoneCover/StabilityStoneCoverWaveConditionsOutputEntityReadExtensionsTest.cs =================================================================== diff -u -r7082f74ed1f0f3a0601a2d8833c864b8c08bea59 -r553f0128e1d2b027e25e00909fd2f3d0b13404b2 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityStoneCover/StabilityStoneCoverWaveConditionsOutputEntityReadExtensionsTest.cs (.../StabilityStoneCoverWaveConditionsOutputEntityReadExtensionsTest.cs) (revision 7082f74ed1f0f3a0601a2d8833c864b8c08bea59) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityStoneCover/StabilityStoneCoverWaveConditionsOutputEntityReadExtensionsTest.cs (.../StabilityStoneCoverWaveConditionsOutputEntityReadExtensionsTest.cs) (revision 553f0128e1d2b027e25e00909fd2f3d0b13404b2) @@ -32,7 +32,7 @@ public class StabilityStoneCoverWaveConditionsOutputEntityReadExtensionsTest { [Test] - public void Read_ValidEntity_ReturnOutput() + public void Read_ValidEntity_ReturnOutputWithValues() { // Setup var random = new Random(12); @@ -62,7 +62,7 @@ } [Test] - public void Read_ValidEntityWithNullParameterValues_ReturnPipingOutput() + public void Read_ValidEntityWithNullParameterValues_ReturnOutputWithNaNValues() { // Setup var entity = new StabilityStoneCoverWaveConditionsOutputEntity Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsOutputEntityReadExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsOutputEntityReadExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsOutputEntityReadExtensionsTest.cs (revision 553f0128e1d2b027e25e00909fd2f3d0b13404b2) @@ -0,0 +1,86 @@ +// 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.WaveImpactAsphaltCover; +using NUnit.Framework; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Revetment.Data; + +namespace Application.Ringtoets.Storage.Test.Read.WaveImpactAsphaltCover +{ + [TestFixture] + public class WaveImpactAsphaltCoverWaveConditionsOutputEntityReadExtensionsTest + { + [Test] + public void Read_ValidEntity_ReturnOutputWithValues() + { + // Setup + var random = new Random(12); + var entity = new WaveImpactAsphaltCoverWaveConditionsOutputEntity + { + WaterLevel = random.NextDouble(), + WaveHeight = random.NextDouble(), + WavePeakPeriod = random.NextDouble(), + WaveAngle = random.NextDouble() + }; + + // Call + WaveConditionsOutput output = entity.Read(); + + // Assert + Assert.IsNotNull(entity.WaterLevel); + Assert.AreEqual(entity.WaterLevel.Value, output.WaterLevel, output.WaterLevel.GetAccuracy()); + + Assert.IsNotNull(entity.WaveHeight); + Assert.AreEqual(entity.WaveHeight.Value, output.WaveHeight, output.WaveHeight.GetAccuracy()); + + Assert.IsNotNull(entity.WavePeakPeriod); + Assert.AreEqual(entity.WavePeakPeriod.Value, output.WavePeakPeriod, output.WavePeakPeriod.GetAccuracy()); + + Assert.IsNotNull(entity.WaveAngle); + Assert.AreEqual(entity.WaveAngle.Value, output.WaveAngle, output.WaveAngle.GetAccuracy()); + } + + [Test] + public void Read_ValidEntityWithNullParameterValues_ReturnOutputWithNaNValues() + { + // Setup + var entity = new WaveImpactAsphaltCoverWaveConditionsOutputEntity + { + WaterLevel = null, + WaveHeight = null, + WavePeakPeriod = null, + WaveAngle = null + }; + + // Call + WaveConditionsOutput output = entity.Read(); + + // Assert + Assert.IsNaN(output.WaterLevel); + Assert.IsNaN(output.WaveHeight); + Assert.IsNaN(output.WavePeakPeriod); + Assert.IsNaN(output.WaveAngle); + } + } +} \ No newline at end of file