Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj
===================================================================
diff -u -r01ff2c58c13df8f42661ae3e446dc2caaa94247e -ra5714fc0488030773fff50dfc82041c6cb9edc2f
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -243,15 +243,28 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -260,25 +273,12 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -311,55 +311,55 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/CalculationGroupEntityReadExtentions.cs
===================================================================
diff -u -r93f4c75ba2309bb82de7e2362bafca5aa516d545 -ra5714fc0488030773fff50dfc82041c6cb9edc2f
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/CalculationGroupEntityReadExtentions.cs (.../CalculationGroupEntityReadExtentions.cs) (revision 93f4c75ba2309bb82de7e2362bafca5aa516d545)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/CalculationGroupEntityReadExtentions.cs (.../CalculationGroupEntityReadExtentions.cs) (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -23,6 +23,7 @@
using System.Collections;
using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Read.Piping;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Piping.Data;
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/DikeProfileEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs
===================================================================
diff -u -r93f4c75ba2309bb82de7e2362bafca5aa516d545 -ra5714fc0488030773fff50dfc82041c6cb9edc2f
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 93f4c75ba2309bb82de7e2362bafca5aa516d545)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -24,6 +24,8 @@
using System.Linq;
using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Read.GrassCoverErosionInwards;
+using Application.Ringtoets.Storage.Read.Piping;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.FailureMechanism;
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/DikeProfileEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/DikeProfileEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/DikeProfileEntityReadExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,75 @@
+// 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.BinaryConverters;
+using Application.Ringtoets.Storage.DbContext;
+
+using Core.Common.Base.Geometry;
+
+using Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Application.Ringtoets.Storage.Read.GrassCoverErosionInwards
+{
+ ///
+ /// This class defines extension methods for read operations for a
+ /// based on the .
+ ///
+ internal static class DikeProfileEntityReadExtensions
+ {
+ ///
+ /// Reads the and use the information to update a
+ /// .
+ ///
+ /// The to create for.
+ /// A new .
+ internal static DikeProfile Read(this DikeProfileEntity entity)
+ {
+ return new DikeProfile(new Point2D(entity.X, entity.Y),
+ new RoughnessPointBinaryConverter().ToData(entity.DikeGeometryData),
+ new Point2DBinaryConverter().ToData(entity.ForeShoreData),
+ CreateBreakWater(entity),
+ CreateProperties(entity))
+ {
+ StorageId = entity.DikeProfileEntityId
+ };
+ }
+
+ private static DikeProfile.ConstructionProperties CreateProperties(DikeProfileEntity entity)
+ {
+ return new DikeProfile.ConstructionProperties
+ {
+ Name = entity.Name,
+ Orientation = entity.Orientation,
+ DikeHeight = entity.DikeHeight,
+ X0 = entity.X0
+ };
+ }
+
+ private static BreakWater CreateBreakWater(DikeProfileEntity entity)
+ {
+ if (entity.BreakWaterType == null)
+ {
+ return null;
+ }
+ return new BreakWater((BreakWaterType)entity.BreakWaterType, entity.BreakWaterHeight.Value);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -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 Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Application.Ringtoets.Storage.Read.GrassCoverErosionInwards
+{
+ ///
+ /// This class defines extension methods for read operations for a
+ /// based on the .
+ ///
+ internal static class GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensions
+ {
+ ///
+ /// Reads the
+ /// and use the information to construct a .
+ ///
+ /// The
+ /// to create for.
+ /// The to be updated.
+ /// A new .
+ /// When is null.
+ internal static void Read(this GrassCoverErosionInwardsFailureMechanismMetaEntity entity, GeneralGrassCoverErosionInwardsInput input)
+ {
+ if (input == null)
+ {
+ throw new ArgumentNullException("input");
+ }
+ input.StorageId = entity.GrassCoverErosionInwardsFailureMechanismMetaEntityId;
+ input.N = entity.N;
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsSectionResultEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsSectionResultEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsSectionResultEntityReadExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,63 @@
+// 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.GrassCoverErosionInwards.Data;
+
+namespace Application.Ringtoets.Storage.Read.GrassCoverErosionInwards
+{
+ ///
+ /// This class defines extension methods for read operations for a based on the
+ /// .
+ ///
+ internal static class GrassCoverErosionInwardsSectionResultEntityReadExtensions
+ {
+ ///
+ /// Reads the and use the information to construct a
+ /// .
+ ///
+ /// The to create for.
+ /// The target of the read operation.
+ /// The object keeping track of read operations.
+ /// A new .
+ /// Thrown when is null.
+ internal static void Read(this GrassCoverErosionInwardsSectionResultEntity entity, GrassCoverErosionInwardsFailureMechanismSectionResult sectionResult, ReadConversionCollector collector)
+ {
+ if (collector == null)
+ {
+ throw new ArgumentNullException("collector");
+ }
+ if (sectionResult == null)
+ {
+ throw new ArgumentNullException("sectionResult");
+ }
+
+ sectionResult.StorageId = entity.GrassCoverErosionInwardsSectionResultEntityId;
+ sectionResult.AssessmentLayerOne = Convert.ToBoolean(entity.LayerOne);
+ sectionResult.AssessmentLayerThree = (RoundedDouble) entity.LayerThree.ToNanableDouble();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwardsSectionResultEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingCalculationEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingCalculationEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingCalculationEntityReadExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,121 @@
+// 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.Integration.Data;
+using Ringtoets.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Read.Piping
+{
+ internal static class PipingCalculationEntityReadExtensions
+ {
+ ///
+ /// Read the and use the information to
+ /// construct a .
+ ///
+ /// The to create
+ /// for.
+ /// The object keeping track of read operations.
+ /// The general input parameters that apply
+ /// to all instances.
+ /// A new .
+ /// Thrown when is null.
+ internal static PipingCalculationScenario Read(this PipingCalculationEntity entity, ReadConversionCollector collector,
+ GeneralPipingInput generalInputParameters)
+ {
+ if (collector == null)
+ {
+ throw new ArgumentNullException("collector");
+ }
+
+ var calculation = new PipingCalculationScenario(generalInputParameters)
+ {
+ StorageId = entity.PipingCalculationEntityId,
+ IsRelevant = Convert.ToBoolean(entity.RelevantForScenario),
+ Contribution = (RoundedDouble)Convert.ToDouble(entity.ScenarioContribution),
+ Name = entity.Name,
+ Comments = entity.Comments
+ };
+ ReadInputParameters(calculation.InputParameters, entity, collector);
+ ReadCalculationOutputs(calculation, entity);
+
+ return calculation;
+ }
+
+ private static void ReadCalculationOutputs(PipingCalculationScenario calculation, PipingCalculationEntity entity)
+ {
+ if (entity.PipingCalculationOutputEntity != null)
+ {
+ calculation.Output = entity.PipingCalculationOutputEntity.Read();
+ }
+
+ if (entity.PipingSemiProbabilisticOutputEntity != null)
+ {
+ calculation.SemiProbabilisticOutput = entity.PipingSemiProbabilisticOutputEntity.Read();
+ }
+ }
+
+ private static void ReadInputParameters(PipingInput inputParameters, PipingCalculationEntity entity, ReadConversionCollector collector)
+ {
+ if (entity.SurfaceLineEntity != null)
+ {
+ inputParameters.SurfaceLine = entity.SurfaceLineEntity.Read(collector);
+ }
+ if (entity.HydraulicLocationEntity != null)
+ {
+ inputParameters.HydraulicBoundaryLocation = entity.HydraulicLocationEntity.Read(collector);
+ }
+ if (entity.StochasticSoilProfileEntity != null)
+ {
+ inputParameters.StochasticSoilModel = entity.StochasticSoilProfileEntity.StochasticSoilModelEntity.Read(collector);
+ inputParameters.StochasticSoilProfile = entity.StochasticSoilProfileEntity.Read(collector);
+ }
+
+ inputParameters.EntryPointL = GetRoundedDoubleFromNullableDecimal(entity.EntryPointL);
+ inputParameters.ExitPointL = GetRoundedDoubleFromNullableDecimal(entity.ExitPointL);
+ inputParameters.PhreaticLevelExit.Mean = (RoundedDouble)Convert.ToDouble(entity.PhreaticLevelExitMean);
+ inputParameters.PhreaticLevelExit.StandardDeviation = (RoundedDouble)Convert.ToDouble(entity.PhreaticLevelExitStandardDeviation);
+ inputParameters.DampingFactorExit.Mean = (RoundedDouble)Convert.ToDouble(entity.DampingFactorExitMean);
+ inputParameters.DampingFactorExit.StandardDeviation = (RoundedDouble)Convert.ToDouble(entity.DampingFactorExitStandardDeviation);
+ inputParameters.SaturatedVolumicWeightOfCoverageLayer.Mean = (RoundedDouble)Convert.ToDouble(entity.SaturatedVolumicWeightOfCoverageLayerMean);
+ inputParameters.SaturatedVolumicWeightOfCoverageLayer.StandardDeviation = (RoundedDouble)Convert.ToDouble(entity.SaturatedVolumicWeightOfCoverageLayerStandardDeviation);
+ inputParameters.SaturatedVolumicWeightOfCoverageLayer.Shift = (RoundedDouble)Convert.ToDouble(entity.SaturatedVolumicWeightOfCoverageLayerShift);
+ inputParameters.Diameter70.Mean = (RoundedDouble)Convert.ToDouble(entity.Diameter70Mean);
+ inputParameters.Diameter70.StandardDeviation = (RoundedDouble)Convert.ToDouble(entity.Diameter70StandardDeviation);
+ inputParameters.DarcyPermeability.Mean = (RoundedDouble)Convert.ToDouble(entity.DarcyPermeabilityMean);
+ inputParameters.DarcyPermeability.StandardDeviation = (RoundedDouble)Convert.ToDouble(entity.DarcyPermeabilityStandardDeviation);
+ }
+
+ private static RoundedDouble GetRoundedDoubleFromNullableDecimal(decimal? parameter)
+ {
+ if (parameter.HasValue)
+ {
+ return (RoundedDouble)Convert.ToDouble(parameter);
+ }
+ return (RoundedDouble)double.NaN;
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingCalculationOutputEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingCalculationOutputEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingCalculationOutputEntityReadExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,51 @@
+// 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.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Read.Piping
+{
+ ///
+ /// This class defines extension methods for read operations for an
+ /// based on the .
+ ///
+ internal static class PipingCalculationOutputEntityReadExtensions
+ {
+ ///
+ /// Read the and use the information to
+ /// construct a .
+ ///
+ /// The to create
+ /// for.
+ /// A new .
+ internal static PipingOutput Read(this PipingCalculationOutputEntity entity)
+ {
+ return new PipingOutput(entity.UpliftZValue.ToNanableDouble(), entity.UpliftFactorOfSafety.ToNanableDouble(),
+ entity.HeaveZValue.ToNanableDouble(), entity.HeaveFactorOfSafety.ToNanableDouble(),
+ entity.SellmeijerZValue.ToNanableDouble(), entity.SellmeijerFactorOfSafety.ToNanableDouble())
+ {
+ StorageId = entity.PipingCalculationOutputEntityId
+ };
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingFailureMechanismMetaEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingFailureMechanismMetaEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingFailureMechanismMetaEntityReadExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,50 @@
+// 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.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Read.Piping
+{
+ ///
+ /// This class defines extension methods for read operations for a based on the
+ /// .
+ ///
+ internal static class PipingFailureMechanismMetaEntityReadExtensions
+ {
+ ///
+ /// Read the and use the information to construct a .
+ ///
+ /// The to create for.
+ /// A new .
+ internal static PipingProbabilityAssessmentInput Read(this PipingFailureMechanismMetaEntity entity)
+ {
+ return new PipingProbabilityAssessmentInput
+ {
+ StorageId = entity.PipingFailureMechanismMetaEntityId,
+ A = Convert.ToDouble(entity.A)
+ };
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingSectionResultEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingSectionResultEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingSectionResultEntityReadExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,62 @@
+// 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.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Read.Piping
+{
+ ///
+ /// This class defines extension methods for read operations for a based on the
+ /// .
+ ///
+ internal static class PipingSectionResultEntityReadExtensions
+ {
+ ///
+ /// Reads the and use the information to construct a
+ /// .
+ ///
+ /// The to create for.
+ /// The target of the read operation.
+ /// The object keeping track of read operations.
+ /// A new .
+ /// Thrown when is null.
+ internal static void Read(this PipingSectionResultEntity entity, PipingFailureMechanismSectionResult sectionResult, ReadConversionCollector collector)
+ {
+ if (collector == null)
+ {
+ throw new ArgumentNullException("collector");
+ }
+ if (sectionResult == null)
+ {
+ throw new ArgumentNullException("sectionResult");
+ }
+ sectionResult.StorageId = entity.PipingSectionResultEntityId;
+ sectionResult.AssessmentLayerOne = Convert.ToBoolean(entity.LayerOne);
+ sectionResult.AssessmentLayerThree = (RoundedDouble) entity.LayerThree.ToNanableDouble();
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingSemiProbabilisticOutputEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingSemiProbabilisticOutputEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingSemiProbabilisticOutputEntityReadExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,54 @@
+// 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.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Read.Piping
+{
+ ///
+ /// This class defines extension methods for read operations for a
+ /// based on the .
+ ///
+ internal static class PipingSemiProbabilisticOutputEntityReadExtensions
+ {
+ ///
+ /// Read the and use the information
+ /// to construct a .
+ ///
+ /// The to
+ /// create for.
+ /// A new .
+ internal static PipingSemiProbabilisticOutput Read(this PipingSemiProbabilisticOutputEntity entity)
+ {
+ return new PipingSemiProbabilisticOutput(
+ entity.UpliftFactorOfSafety.ToNanableDouble(), entity.UpliftReliability.ToNanableDouble(), entity.UpliftProbability.ToNanableDouble(),
+ entity.HeaveFactorOfSafety.ToNanableDouble(), entity.HeaveReliability.ToNanableDouble(), entity.HeaveProbability.ToNanableDouble(),
+ entity.SellmeijerFactorOfSafety.ToNanableDouble(), entity.SellmeijerReliability.ToNanableDouble(), entity.SellmeijerProbability.ToNanableDouble(),
+ entity.RequiredProbability.ToNanableDouble(), entity.RequiredReliability.ToNanableDouble(),
+ entity.PipingProbability.ToNanableDouble(), entity.PipingReliability.ToNanableDouble(), entity.PipingFactorOfSafety.ToNanableDouble())
+ {
+ StorageId = entity.PipingSemiProbabilisticOutputEntityId
+ };
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingStructureSectionResultEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingStructureSectionResultEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingStructureSectionResultEntityReadExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,65 @@
+// 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.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Read.Piping
+{
+ ///
+ /// This class defines extension methods for read operations for a based on the
+ /// .
+ ///
+ internal static class PipingStructureSectionResultEntityReadExtensions
+ {
+ ///
+ /// Reads the and use the information to update a
+ /// .
+ ///
+ /// The to create for.
+ /// The target of the read operation.
+ /// The object keeping track of read operations.
+ /// A new .
+ /// Thrown when is null.
+ internal static void Read(this PipingStructureSectionResultEntity entity, PipingStructureFailureMechanismSectionResult sectionResult, ReadConversionCollector collector)
+ {
+ if (collector == null)
+ {
+ throw new ArgumentNullException("collector");
+ }
+ if (sectionResult == null)
+ {
+ throw new ArgumentNullException("sectionResult");
+ }
+
+ sectionResult.StorageId = entity.PipingStructureSectionResultEntityId;
+ sectionResult.AssessmentLayerOne = Convert.ToBoolean(entity.LayerOne);
+ sectionResult.AssessmentLayerTwoA = (AssessmentLayerTwoAResult)entity.LayerTwoA;
+ sectionResult.AssessmentLayerThree = (RoundedDouble)entity.LayerThree.ToNanableDouble();
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/SoilLayerEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/SoilLayerEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/SoilLayerEntityReadExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,61 @@
+// 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.Drawing;
+
+using Application.Ringtoets.Storage.DbContext;
+
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Read.Piping
+{
+ ///
+ /// This class defines extension methods for read operations for a based on the
+ /// .
+ ///
+ internal static class SoilLayerEntityReadExtensions
+ {
+ ///
+ /// Reads the and use the information to construct a .
+ ///
+ /// The to create for.
+ /// A new .
+ internal static PipingSoilLayer Read(this SoilLayerEntity entity)
+ {
+ var pipingSoilLayer = new PipingSoilLayer(Convert.ToDouble(entity.Top))
+ {
+ StorageId = entity.SoilLayerEntityId,
+ IsAquifer = Convert.ToBoolean(entity.IsAquifer),
+ Color = Color.FromArgb(Convert.ToInt32(entity.Color)),
+ MaterialName = entity.MaterialName ?? string.Empty,
+ BelowPhreaticLevelMean = entity.BelowPhreaticLevelMean.ToNullAsNaN(),
+ BelowPhreaticLevelDeviation = entity.BelowPhreaticLevelDeviation.ToNullAsNaN(),
+ BelowPhreaticLevelShift = entity.BelowPhreaticLevelShift.ToNullAsNaN(),
+ DiameterD70Mean = entity.DiameterD70Mean.ToNullAsNaN(),
+ DiameterD70Deviation = entity.DiameterD70Deviation.ToNullAsNaN(),
+ PermeabilityMean = entity.PermeabilityMean.ToNullAsNaN(),
+ PermeabilityDeviation = entity.PermeabilityDeviation.ToNullAsNaN()
+ };
+ return pipingSoilLayer;
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/SoilProfileEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/SoilProfileEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/SoilProfileEntityReadExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,66 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.DbContext;
+
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Read.Piping
+{
+ ///
+ /// This class defines extension methods for read operations for a based on the
+ /// .
+ ///
+ internal static class SoilProfileEntityReadExtensions
+ {
+ ///
+ /// Reads the and use the information to construct a .
+ ///
+ /// The to create for.
+ /// The object keeping track of read operations.
+ /// A new or one from the if the
+ /// has been read before.
+ /// Thrown when is null.
+ internal static PipingSoilProfile Read(this SoilProfileEntity entity, ReadConversionCollector collector)
+ {
+ if (collector == null)
+ {
+ throw new ArgumentNullException("collector");
+ }
+
+ if (collector.Contains(entity))
+ {
+ return collector.Get(entity);
+ }
+ var layers = entity.SoilLayerEntities.Select(sl => SoilLayerEntityReadExtensions.Read(sl));
+ var pipingSoilProfile = new PipingSoilProfile(entity.Name, Convert.ToDouble(entity.Bottom), layers, SoilProfileType.SoilProfile1D, -1)
+ {
+ StorageId = entity.SoilProfileEntityId
+ };
+
+ collector.Read(entity, pipingSoilProfile);
+ return pipingSoilProfile;
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/StochasticSoilModelEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/StochasticSoilModelEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/StochasticSoilModelEntityReadExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,82 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.DbContext;
+
+using Ringtoets.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Read.Piping
+{
+ ///
+ /// This class defines extension methods for read operations for a based on the
+ /// .
+ ///
+ internal static class StochasticSoilModelEntityReadExtensions
+ {
+ ///
+ /// Reads the and use the information to construct a .
+ ///
+ /// The to create for.
+ /// The object keeping track of read operations.
+ /// A new .
+ /// Thrown when is null.
+ internal static StochasticSoilModel Read(this StochasticSoilModelEntity entity, ReadConversionCollector collector)
+ {
+ if (collector == null)
+ {
+ throw new ArgumentNullException("collector");
+ }
+ if (collector.Contains(entity))
+ {
+ return collector.Get(entity);
+ }
+
+ var model = new StochasticSoilModel(-1, entity.Name, entity.SegmentName)
+ {
+ StorageId = entity.StochasticSoilModelEntityId
+ };
+ entity.ReadStochasticSoilProfiles(model, collector);
+ entity.ReadSegmentPoints(model);
+
+ collector.Read(entity, model);
+
+ return model;
+ }
+
+ private static void ReadStochasticSoilProfiles(this StochasticSoilModelEntity entity, StochasticSoilModel model, ReadConversionCollector collector)
+ {
+ foreach (var stochasticSoilProfileEntity in entity.StochasticSoilProfileEntities)
+ {
+ model.StochasticSoilProfiles.Add(stochasticSoilProfileEntity.Read(collector));
+ }
+ }
+
+ private static void ReadSegmentPoints(this StochasticSoilModelEntity entity, StochasticSoilModel model)
+ {
+ model.Geometry.AddRange(entity.StochasticSoilModelSegmentPointEntities
+ .OrderBy(pe => pe.Order)
+ .Select(pe => pe.Read()));
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/StochasticSoilModelSegmentPointEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/StochasticSoilModelSegmentPointEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/StochasticSoilModelSegmentPointEntityReadExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,50 @@
+// 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.Geometry;
+
+using Ringtoets.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Read.Piping
+{
+ ///
+ /// This class defines extension methods for read operations for a
+ /// based on the .
+ ///
+ internal static class StochasticSoilModelSegmentPointEntityReadExtensions
+ {
+ ///
+ /// Reads the and use the information
+ /// to construct a .
+ ///
+ /// The to create for.
+ /// A new .
+ internal static Point2D Read(this StochasticSoilModelSegmentPointEntity entity)
+ {
+ return new Point2D(Convert.ToDouble(entity.X),
+ Convert.ToDouble(entity.Y));
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/StochasticSoilProfileEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/StochasticSoilProfileEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/StochasticSoilProfileEntityReadExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,71 @@
+// 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.Piping.Data;
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Read.Piping
+{
+ ///
+ /// This class defines extension methods for read operations for a based on the
+ /// .
+ ///
+ internal static class StochasticSoilProfileEntityReadExtensions
+ {
+ ///
+ /// Reads the and use the information to construct a .
+ ///
+ /// The to create for.
+ /// The object keeping track of read operations.
+ /// A new .
+ /// Thrown when is null.
+ internal static StochasticSoilProfile Read(this StochasticSoilProfileEntity entity, ReadConversionCollector collector)
+ {
+ if (collector == null)
+ {
+ throw new ArgumentNullException("collector");
+ }
+ if (collector.Contains(entity))
+ {
+ return collector.Get(entity);
+ }
+
+ var profile = new StochasticSoilProfile(Convert.ToDouble(entity.Probability), SoilProfileType.SoilProfile1D, -1)
+ {
+ StorageId = entity.StochasticSoilProfileEntityId
+ };
+ entity.ReadSoilProfile(profile, collector);
+
+ collector.Read(entity, profile);
+
+ return profile;
+ }
+
+ private static void ReadSoilProfile(this StochasticSoilProfileEntity entity, StochasticSoilProfile profile, ReadConversionCollector collector)
+ {
+ profile.SoilProfile = entity.SoilProfileEntity.Read(collector);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/SurfaceLineEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/SurfaceLineEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/SurfaceLineEntityReadExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,124 @@
+// 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 Application.Ringtoets.Storage.DbContext;
+
+using Core.Common.Base.Geometry;
+
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Read.Piping
+{
+ ///
+ /// This class defines extension methods for read operations for an
+ /// based on the .
+ ///
+ internal static class SurfaceLineEntityReadExtensions
+ {
+ ///
+ /// Read the and use the information to construct
+ /// a .
+ ///
+ /// The to create
+ /// for.
+ /// The object keeping track of read operations.
+ /// A new .
+ /// Thrown when is null.
+ internal static RingtoetsPipingSurfaceLine Read(this SurfaceLineEntity entity, ReadConversionCollector collector)
+ {
+ if (collector == null)
+ {
+ throw new ArgumentNullException("collector");
+ }
+ if (collector.Contains(entity))
+ {
+ return collector.Get(entity);
+ }
+
+ var surfaceLine = new RingtoetsPipingSurfaceLine
+ {
+ StorageId = entity.SurfaceLineEntityId,
+ Name = entity.Name,
+ ReferenceLineIntersectionWorldPoint = new Point2D(
+ Convert.ToDouble(entity.ReferenceLineIntersectionX),
+ Convert.ToDouble(entity.ReferenceLineIntersectionY))
+ };
+ entity.ReadSurfaceLineGeometryAndCharacteristicPoints(surfaceLine, collector);
+
+ collector.Read(entity, surfaceLine);
+
+ return surfaceLine;
+ }
+
+ private static void ReadSurfaceLineGeometryAndCharacteristicPoints(this SurfaceLineEntity entity, RingtoetsPipingSurfaceLine surfaceLine, ReadConversionCollector collector)
+ {
+ var geometryPoints = new Point3D[entity.SurfaceLinePointEntities.Count];
+ var characteristicPoints = new Dictionary();
+
+ foreach (SurfaceLinePointEntity pointEntity in entity.SurfaceLinePointEntities)
+ {
+ var geometryPoint = pointEntity.Read(collector);
+ geometryPoints[pointEntity.Order] = geometryPoint;
+
+ foreach (CharacteristicPointEntity characteristicPointEntity in pointEntity.CharacteristicPointEntities)
+ {
+ characteristicPoints[(CharacteristicPointType)characteristicPointEntity.CharacteristicPointType] = geometryPoint;
+ }
+ }
+
+ surfaceLine.SetGeometry(geometryPoints);
+ foreach (KeyValuePair keyValuePair in characteristicPoints)
+ {
+ SetCharacteristicPoint(surfaceLine, keyValuePair.Key, keyValuePair.Value);
+ }
+ }
+
+ private static void SetCharacteristicPoint(RingtoetsPipingSurfaceLine surfaceLine, CharacteristicPointType type, Point3D geometryPoint)
+ {
+ switch (type)
+ {
+ case CharacteristicPointType.DikeToeAtRiver:
+ surfaceLine.SetDikeToeAtRiverAt(geometryPoint);
+ break;
+ case CharacteristicPointType.DikeToeAtPolder:
+ surfaceLine.SetDikeToeAtPolderAt(geometryPoint);
+ break;
+ case CharacteristicPointType.DitchDikeSide:
+ surfaceLine.SetDitchDikeSideAt(geometryPoint);
+ break;
+ case CharacteristicPointType.BottomDitchDikeSide:
+ surfaceLine.SetBottomDitchDikeSideAt(geometryPoint);
+ break;
+ case CharacteristicPointType.BottomDitchPolderSide:
+ surfaceLine.SetBottomDitchPolderSideAt(geometryPoint);
+ break;
+ case CharacteristicPointType.DitchPolderSide:
+ surfaceLine.SetDitchPolderSideAt(geometryPoint);
+ break;
+ default:
+ throw new NotImplementedException();
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/SurfaceLinePointEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/SurfaceLinePointEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/SurfaceLinePointEntityReadExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,71 @@
+// 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.Geometry;
+
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Read.Piping
+{
+ ///
+ /// This class defines extension methods for read operations for
+ /// for based on the .
+ ///
+ internal static class SurfaceLinePointEntityReadExtensions
+ {
+ ///
+ /// Read the and use the information to construct
+ /// a for a .
+ ///
+ /// The to create
+ /// for.
+ /// The object keeping track of read operations.
+ /// A new surfaceline geometry point.
+ /// Thrown when is null.
+ internal static Point3D Read(this SurfaceLinePointEntity entity, ReadConversionCollector collector)
+ {
+ if (collector == null)
+ {
+ throw new ArgumentNullException("collector");
+ }
+ if (collector.Contains(entity))
+ {
+ return collector.Get(entity);
+ }
+
+ var surfaceLineGeometryPoint = new Point3D(
+ Convert.ToDouble(entity.X),
+ Convert.ToDouble(entity.Y),
+ Convert.ToDouble(entity.Z))
+ {
+ StorageId = entity.SurfaceLinePointEntityId
+ };
+
+ collector.Read(entity, surfaceLineGeometryPoint);
+
+ return surfaceLineGeometryPoint;
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/PipingCalculationEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/PipingCalculationOutputEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/PipingFailureMechanismMetaEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/PipingSectionResultEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/PipingSemiProbabilisticOutputEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/PipingStructureSectionResultEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/SoilLayerEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/SoilProfileEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StochasticSoilModelEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StochasticSoilModelSegmentPointEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StochasticSoilProfileEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/SurfaceLineEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/SurfaceLinePointEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/AssessmentSectionUpdateExtensions.cs
===================================================================
diff -u -r424e934ab7fcdef2661e3fee605423ee9fd1b489 -ra5714fc0488030773fff50dfc82041c6cb9edc2f
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/AssessmentSectionUpdateExtensions.cs (.../AssessmentSectionUpdateExtensions.cs) (revision 424e934ab7fcdef2661e3fee605423ee9fd1b489)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/AssessmentSectionUpdateExtensions.cs (.../AssessmentSectionUpdateExtensions.cs) (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -25,6 +25,25 @@
using Application.Ringtoets.Storage.Create;
using Application.Ringtoets.Storage.DbContext;
using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.Update.ClosingStructure;
+using Application.Ringtoets.Storage.Update.DuneErosion;
+using Application.Ringtoets.Storage.Update.GrassCoverErosionInwards;
+using Application.Ringtoets.Storage.Update.GrassCoverErosionOutwards;
+using Application.Ringtoets.Storage.Update.GrassCoverSlipOffInwards;
+using Application.Ringtoets.Storage.Update.GrassCoverSlipOffOutwards;
+using Application.Ringtoets.Storage.Update.HeightStructures;
+using Application.Ringtoets.Storage.Update.MacrostabilityInwards;
+using Application.Ringtoets.Storage.Update.MacrostabilityOutwards;
+using Application.Ringtoets.Storage.Update.Microstability;
+using Application.Ringtoets.Storage.Update.Piping;
+using Application.Ringtoets.Storage.Update.PipingStructure;
+using Application.Ringtoets.Storage.Update.StabilityStoneCover;
+using Application.Ringtoets.Storage.Update.StrengthStabilityLengthwiseConstruction;
+using Application.Ringtoets.Storage.Update.StrengthStabilityPointConstruction;
+using Application.Ringtoets.Storage.Update.TechnicalInnovation;
+using Application.Ringtoets.Storage.Update.WaterPressureAsphaltCover;
+using Application.Ringtoets.Storage.Update.WaveImpactAsphaltCover;
+
using Core.Common.Base.Geometry;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Integration.Data;
@@ -77,24 +96,24 @@
private static void UpdateFailureMechanisms(AssessmentSection section, PersistenceRegistry registry, IRingtoetsEntities context)
{
- section.PipingFailureMechanism.Update(registry, context);
- section.GrassCoverErosionInwards.Update(registry, context);
- section.MacrostabilityInwards.Update(registry, context);
- section.MacrostabilityOutwards.Update(registry, context);
- section.Microstability.Update(registry, context);
- section.StabilityStoneCover.Update(registry, context);
- section.WaveImpactAsphaltCover.Update(registry, context);
- section.WaterPressureAsphaltCover.Update(registry, context);
- section.GrassCoverErosionOutwards.Update(registry, context);
- section.GrassCoverSlipOffOutwards.Update(registry, context);
- section.GrassCoverSlipOffInwards.Update(registry, context);
- section.HeightStructures.Update(registry, context);
- section.ClosingStructure.Update(registry, context);
- section.PipingStructure.Update(registry, context);
- section.StrengthStabilityPointConstruction.Update(registry, context);
- section.StrengthStabilityLengthwiseConstruction.Update(registry, context);
- section.DuneErosion.Update(registry, context);
- section.TechnicalInnovation.Update(registry, context);
+ PipingFailureMechanismUpdateExtensions.Update(section.PipingFailureMechanism, registry, context);
+ GrassCoverErosionInwardsFailureMechanismUpdateExtensions.Update(section.GrassCoverErosionInwards, registry, context);
+ MacrostabilityInwardsFailureMechanismUpdateExtensions.Update(section.MacrostabilityInwards, registry, context);
+ MacrostabilityOutwardsFailureMechanismUpdateExtensions.Update(section.MacrostabilityOutwards, registry, context);
+ MicrostabilityFailureMechanismUpdateExtensions.Update(section.Microstability, registry, context);
+ StabilityStoneCoverFailureMechanismUpdateExtensions.Update(section.StabilityStoneCover, registry, context);
+ WaveImpactAsphaltCoverFailureMechanismUpdateExtensions.Update(section.WaveImpactAsphaltCover, registry, context);
+ WaterPressureAsphaltCoverFailureMechanismUpdateExtensions.Update(section.WaterPressureAsphaltCover, registry, context);
+ GrassCoverErosionOutwardsFailureMechanismUpdateExtensions.Update(section.GrassCoverErosionOutwards, registry, context);
+ GrassCoverSlipOffOutwardsFailureMechanismUpdateExtensions.Update(section.GrassCoverSlipOffOutwards, registry, context);
+ GrassCoverSlipOffInwardsFailureMechanismUpdateExtensions.Update(section.GrassCoverSlipOffInwards, registry, context);
+ HeightStructuresFailureMechanismUpdateExtensions.Update(section.HeightStructures, registry, context);
+ ClosingStructureFailureMechanismUpdateExtensions.Update(section.ClosingStructure, registry, context);
+ PipingStructureFailureMechanismUpdateExtensions.Update(section.PipingStructure, registry, context);
+ StrengthStabilityPointConstructionFailureMechanismUpdateExtensions.Update(section.StrengthStabilityPointConstruction, registry, context);
+ StrengthStabilityLengthwiseConstructionFailureMechanismUpdateExtensions.Update(section.StrengthStabilityLengthwiseConstruction, registry, context);
+ DuneErosionFailureMechanismUpdateExtensions.Update(section.DuneErosion, registry, context);
+ TechnicalInnovationFailureMechanismUpdateExtensions.Update(section.TechnicalInnovation, registry, context);
}
private static void UpdateReferenceLine(AssessmentSection section, AssessmentSectionEntity entity, IRingtoetsEntities context)
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/CalculationGroupUpdateExtensions.cs
===================================================================
diff -u -r01ff2c58c13df8f42661ae3e446dc2caaa94247e -ra5714fc0488030773fff50dfc82041c6cb9edc2f
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/CalculationGroupUpdateExtensions.cs (.../CalculationGroupUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/CalculationGroupUpdateExtensions.cs (.../CalculationGroupUpdateExtensions.cs) (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -26,6 +26,8 @@
using Application.Ringtoets.Storage.Create.Piping;
using Application.Ringtoets.Storage.DbContext;
using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.Update.Piping;
+
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Piping.Data;
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/ClosingStructure/ClosingStructureFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/ClosingStructure/ClosingStructureFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/ClosingStructure/ClosingStructureFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,74 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Update.ClosingStructure
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class ClosingStructureFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this ClosingStructureFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ ClosingStructureSectionResultEntity entity = result.GetCorrespondingEntity(
+ context.ClosingStructureSectionResultEntities,
+ s => s.ClosingStructureSectionResultEntityId);
+
+ entity.LayerOne = Convert.ToByte(result.AssessmentLayerOne);
+ entity.LayerTwoA = result.AssessmentLayerTwoA.ToNullableDecimal();
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/ClosingStructure/ClosingStructureFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/ClosingStructure/ClosingStructureFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/ClosingStructure/ClosingStructureFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,90 @@
+// 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.Create.ClosingStructure;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Update.ClosingStructure
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class ClosingStructureFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this ClosingStructureFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateSectionResults(ClosingStructureFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).ClosingStructureSectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/ClosingStructureFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/ClosingStructureFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/DikeProfileUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/DuneErosion/DuneErosionFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/DuneErosion/DuneErosionFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/DuneErosion/DuneErosionFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,73 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Update.DuneErosion
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class DuneErosionFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this DuneErosionFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ DuneErosionSectionResultEntity entity = result.GetCorrespondingEntity(
+ context.DuneErosionSectionResultEntities,
+ s => s.DuneErosionSectionResultEntityId);
+
+ entity.LayerTwoA = Convert.ToByte(result.AssessmentLayerTwoA);
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/DuneErosion/DuneErosionFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/DuneErosion/DuneErosionFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/DuneErosion/DuneErosionFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,90 @@
+// 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.Create.DuneErosion;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Update.DuneErosion
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class DuneErosionFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this DuneErosionFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateSectionResults(DuneErosionFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).DuneErosionSectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/DuneErosionFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/DuneErosionFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GeneralGrassCoverErosionInwardsInputUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionInwards/DikeProfileUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionInwards/DikeProfileUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionInwards/DikeProfileUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,71 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Application.Ringtoets.Storage.Update.GrassCoverErosionInwards
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class DikeProfileUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information
+ /// of the .
+ ///
+ /// The dike profile to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this DikeProfile profile, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ DikeProfileEntity entity = profile.GetCorrespondingEntity(
+ context.DikeProfileEntities,
+ o => o.DikeProfileEntityId);
+
+ // DikeProfile cannot be changed after construction. No need to update state in 'entity'
+
+ registry.Register(entity, profile);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,71 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Application.Ringtoets.Storage.Update.GrassCoverErosionInwards
+{
+ ///
+ /// Extension methods for related
+ /// to updating a .
+ ///
+ internal static class GeneralGrassCoverErosionInwardsInputUpdateExtensions
+ {
+ ///
+ /// Updates a in
+ /// the database based on the information of the .
+ ///
+ /// The general input for a Grass Cover Erosion Inwards failure mechanism.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this GeneralGrassCoverErosionInwardsInput input, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ GrassCoverErosionInwardsFailureMechanismMetaEntity entity = input.GetCorrespondingEntity(
+ context.GrassCoverErosionInwardsFailureMechanismMetaEntities,
+ inputEntity => inputEntity.GrassCoverErosionInwardsFailureMechanismMetaEntityId);
+ entity.N = input.N;
+
+ registry.Register(entity, input);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,73 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Application.Ringtoets.Storage.Update.GrassCoverErosionInwards
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class GrassCoverErosionInwardsFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this GrassCoverErosionInwardsFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ GrassCoverErosionInwardsSectionResultEntity entity = result.GetCorrespondingEntity(
+ context.GrassCoverErosionInwardsSectionResultEntities,
+ o => o.GrassCoverErosionInwardsSectionResultEntityId);
+
+ entity.LayerOne = Convert.ToByte(result.AssessmentLayerOne);
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,110 @@
+// 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.Create.GrassCoverErosionInwards;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Application.Ringtoets.Storage.Update.GrassCoverErosionInwards
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class GrassCoverErosionInwardsFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this GrassCoverErosionInwardsFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.GeneralInput.Update(registry, context);
+ UpdateDikeProfiles(mechanism, registry, entity, context);
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+ mechanism.CalculationsGroup.Update(registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateDikeProfiles(GrassCoverErosionInwardsFailureMechanism mechanism,
+ PersistenceRegistry registry, FailureMechanismEntity entity, IRingtoetsEntities context)
+ {
+ foreach (DikeProfile dikeProfile in mechanism.DikeProfiles)
+ {
+ if (dikeProfile.IsNew())
+ {
+ entity.DikeProfileEntities.Add(dikeProfile.Create(registry));
+ }
+ else
+ {
+ dikeProfile.Update(registry, context);
+ }
+ }
+ }
+
+ private static void UpdateSectionResults(GrassCoverErosionInwardsFailureMechanism mechanism,
+ PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).GrassCoverErosionInwardsSectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionInwardsFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionInwardsFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,74 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Update.GrassCoverErosionOutwards
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class GrassCoverErosionOutwardsFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this GrassCoverErosionOutwardsFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ GrassCoverErosionOutwardsSectionResultEntity entity = result.GetCorrespondingEntity(
+ context.GrassCoverErosionOutwardsSectionResultEntities,
+ s => s.GrassCoverErosionOutwardsSectionResultEntityId);
+
+ entity.LayerOne = Convert.ToByte(result.AssessmentLayerOne);
+ entity.LayerTwoA = Convert.ToByte(result.AssessmentLayerTwoA);
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,90 @@
+// 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.Create.GrassCoverErosionOutwards;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Update.GrassCoverErosionOutwards
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class GrassCoverErosionOutwardsFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this GrassCoverErosionOutwardsFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateSectionResults(GrassCoverErosionOutwardsFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).GrassCoverErosionOutwardsSectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionOutwardsFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionOutwardsFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,74 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Update.GrassCoverSlipOffInwards
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class GrassCoverSlipOffInwardsFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this GrassCoverSlipOffInwardsFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ GrassCoverSlipOffInwardsSectionResultEntity entity = result.GetCorrespondingEntity(
+ context.GrassCoverSlipOffInwardsSectionResultEntities,
+ s => s.GrassCoverSlipOffInwardsSectionResultEntityId);
+
+ entity.LayerOne = Convert.ToByte(result.AssessmentLayerOne);
+ entity.LayerTwoA = Convert.ToByte(result.AssessmentLayerTwoA);
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,90 @@
+// 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.Create.GrassCoverSlipOffInwards;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Update.GrassCoverSlipOffInwards
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class GrassCoverSlipOffInwardsFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this GrassCoverSlipOffInwardsFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateSectionResults(GrassCoverSlipOffInwardsFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).GrassCoverSlipOffInwardsSectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffInwardsFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffInwardsFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,74 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Update.GrassCoverSlipOffOutwards
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class GrassCoverSlipOffOutwardsFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this GrassCoverSlipOffOutwardsFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ GrassCoverSlipOffOutwardsSectionResultEntity entity = result.GetCorrespondingEntity(
+ context.GrassCoverSlipOffOutwardsSectionResultEntities,
+ s => s.GrassCoverSlipOffOutwardsSectionResultEntityId);
+
+ entity.LayerOne = Convert.ToByte(result.AssessmentLayerOne);
+ entity.LayerTwoA = Convert.ToByte(result.AssessmentLayerTwoA);
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,90 @@
+// 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.Create.GrassCoverSlipOffOutwards;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Update.GrassCoverSlipOffOutwards
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class GrassCoverSlipOffOutwardsFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this GrassCoverSlipOffOutwardsFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateSectionResults(GrassCoverSlipOffOutwardsFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).GrassCoverSlipOffOutwardsSectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffOutwardsFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffOutwardsFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/HeightStructures/HeightStructuresFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/HeightStructures/HeightStructuresFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/HeightStructures/HeightStructuresFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,73 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.HeightStructures.Data;
+
+namespace Application.Ringtoets.Storage.Update.HeightStructures
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class HeightStructuresFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this HeightStructuresFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ HeightStructuresSectionResultEntity entity = result.GetCorrespondingEntity(
+ context.HeightStructuresSectionResultEntities,
+ o => o.HeightStructuresSectionResultEntityId);
+
+ entity.LayerOne = Convert.ToByte(result.AssessmentLayerOne);
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/HeightStructures/HeightStructuresFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/HeightStructures/HeightStructuresFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/HeightStructures/HeightStructuresFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,90 @@
+// 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.Create.HeightStructures;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.HeightStructures.Data;
+
+namespace Application.Ringtoets.Storage.Update.HeightStructures
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class HeightStructuresFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this HeightStructuresFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateSectionResults(HeightStructuresFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).HeightStructuresSectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/HeightStructuresFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/HeightStructuresFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,74 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Update.MacrostabilityInwards
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class MacrostabilityInwardsFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this MacrostabilityInwardsFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ MacrostabilityInwardsSectionResultEntity entity = result.GetCorrespondingEntity(
+ context.MacrostabilityInwardsSectionResultEntities,
+ s => s.MacrostabilityInwardsSectionResultEntityId);
+
+ entity.LayerOne = Convert.ToByte(result.AssessmentLayerOne);
+ entity.LayerTwoA = result.AssessmentLayerTwoA.ToNullableDecimal();
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,90 @@
+// 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.Create.MacrostabilityInwards;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Update.MacrostabilityInwards
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class MacrostabilityInwardsFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this MacrostabilityInwardsFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateSectionResults(MacrostabilityInwardsFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).MacrostabilityInwardsSectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityInwardsFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityInwardsFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,74 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Update.MacrostabilityOutwards
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class MacrostabilityOutwardsFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this MacrostabilityOutwardsFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ MacrostabilityOutwardsSectionResultEntity entity = result.GetCorrespondingEntity(
+ context.MacrostabilityOutwardsSectionResultEntities,
+ s => s.MacrostabilityOutwardsSectionResultEntityId);
+
+ entity.LayerOne = Convert.ToByte(result.AssessmentLayerOne);
+ entity.LayerTwoA = result.AssessmentLayerTwoA.ToNullableDecimal();
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,90 @@
+// 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.Create.MacrostabilityOutwards;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Update.MacrostabilityOutwards
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class MacrostabilityOutwardsFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this MacrostabilityOutwardsFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateSectionResults(MacrostabilityOutwardsFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).MacrostabilityOutwardsSectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityOutwardsFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityOutwardsFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Microstability/MicrostabilityFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Microstability/MicrostabilityFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Microstability/MicrostabilityFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,74 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Update.Microstability
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class MicrostabilityFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this MicrostabilityFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ MicrostabilitySectionResultEntity entity = result.GetCorrespondingEntity(
+ context.MicrostabilitySectionResultEntities,
+ s => s.MicrostabilitySectionResultEntityId);
+
+ entity.LayerOne = Convert.ToByte(result.AssessmentLayerOne);
+ entity.LayerTwoA = Convert.ToByte(result.AssessmentLayerTwoA);
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Microstability/MicrostabilityFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Microstability/MicrostabilityFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Microstability/MicrostabilityFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,90 @@
+// 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.Create.Microstability;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Update.Microstability
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class MicrostabilityFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this MicrostabilityFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateSectionResults(MicrostabilityFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).MicrostabilitySectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MicrostabilityFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MicrostabilityFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingCalculationScenarioUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingCalculationScenarioUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingCalculationScenarioUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,142 @@
+// 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.Create.Piping;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Update.Piping
+{
+ ///
+ /// Extension methods for related to updating
+ /// a .
+ ///
+ internal static class PipingCalculationScenarioUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the
+ /// information of the .
+ ///
+ /// The piping calculation to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this PipingCalculationScenario calculation, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+
+ PipingCalculationEntity entity = calculation.GetCorrespondingEntity(
+ context.PipingCalculationEntities,
+ o => o.PipingCalculationEntityId);
+ entity.RelevantForScenario = Convert.ToByte(calculation.IsRelevant);
+ entity.ScenarioContribution = Convert.ToDecimal(calculation.Contribution);
+ entity.Name = calculation.Name;
+ entity.Comments = calculation.Comments;
+ SetInputParameters(entity, calculation.InputParameters, registry);
+ UpdatePipingCalculationOutputs(entity, calculation, registry);
+
+ registry.Register(entity, calculation);
+ }
+
+ private static void SetInputParameters(PipingCalculationEntity entity, PipingInput inputParameters, PersistenceRegistry registry)
+ {
+ entity.SurfaceLineEntity = inputParameters.SurfaceLine == null ?
+ null :
+ registry.Get(inputParameters.SurfaceLine);
+ entity.HydraulicLocationEntity = inputParameters.HydraulicBoundaryLocation == null ?
+ null :
+ registry.Get(inputParameters.HydraulicBoundaryLocation);
+ entity.StochasticSoilProfileEntity = inputParameters.StochasticSoilProfile == null ?
+ null :
+ registry.Get(inputParameters.StochasticSoilProfile);
+
+ entity.EntryPointL = inputParameters.EntryPointL.Value.ToNullableDecimal();
+ entity.ExitPointL = inputParameters.ExitPointL.Value.ToNullableDecimal();
+
+ entity.PhreaticLevelExitMean = Convert.ToDecimal(inputParameters.PhreaticLevelExit.Mean);
+ entity.PhreaticLevelExitStandardDeviation = Convert.ToDecimal(inputParameters.PhreaticLevelExit.StandardDeviation);
+ entity.DampingFactorExitMean = Convert.ToDecimal(inputParameters.DampingFactorExit.Mean);
+ entity.DampingFactorExitStandardDeviation = Convert.ToDecimal(inputParameters.DampingFactorExit.StandardDeviation);
+ entity.SaturatedVolumicWeightOfCoverageLayerMean = Convert.ToDecimal(inputParameters.SaturatedVolumicWeightOfCoverageLayer.Mean);
+ entity.SaturatedVolumicWeightOfCoverageLayerStandardDeviation = Convert.ToDecimal(inputParameters.SaturatedVolumicWeightOfCoverageLayer.StandardDeviation);
+ entity.SaturatedVolumicWeightOfCoverageLayerShift = Convert.ToDecimal(inputParameters.SaturatedVolumicWeightOfCoverageLayer.Shift);
+ entity.Diameter70Mean = Convert.ToDecimal(inputParameters.Diameter70.Mean);
+ entity.Diameter70StandardDeviation = Convert.ToDecimal(inputParameters.Diameter70.StandardDeviation);
+ entity.DarcyPermeabilityMean = Convert.ToDecimal(inputParameters.DarcyPermeability.Mean);
+ entity.DarcyPermeabilityStandardDeviation = Convert.ToDecimal(inputParameters.DarcyPermeability.StandardDeviation);
+ }
+
+ private static void UpdatePipingCalculationOutputs(PipingCalculationEntity entity, PipingCalculationScenario calculation, PersistenceRegistry registry)
+ {
+ if (calculation.Output != null)
+ {
+ PipingOutput pipingOutput = calculation.Output;
+ if (pipingOutput.IsNew())
+ {
+ entity.PipingCalculationOutputEntity = pipingOutput.Create(registry);
+ }
+ else
+ {
+ registry.Register(entity.PipingCalculationOutputEntity, pipingOutput);
+ }
+ }
+ else
+ {
+ entity.PipingCalculationOutputEntity = null;
+ }
+
+ if (calculation.SemiProbabilisticOutput != null)
+ {
+ PipingSemiProbabilisticOutput semiProbabilisticOutput = calculation.SemiProbabilisticOutput;
+ if (semiProbabilisticOutput.IsNew())
+ {
+ entity.PipingSemiProbabilisticOutputEntity = semiProbabilisticOutput.Create(registry);
+ }
+ else
+ {
+ registry.Register(entity.PipingSemiProbabilisticOutputEntity, semiProbabilisticOutput);
+ }
+ }
+ else
+ {
+ entity.PipingSemiProbabilisticOutputEntity = null;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,73 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Update.Piping
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class PipingFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this PipingFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ PipingSectionResultEntity entity = result.GetCorrespondingEntity(
+ context.PipingSectionResultEntities,
+ o => o.PipingSectionResultEntityId);
+
+ entity.LayerOne = Convert.ToByte(result.AssessmentLayerOne);
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,126 @@
+// 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.Create.Piping;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Update.Piping
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class PipingFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this PipingFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.PipingProbabilityAssessmentInput.Update(registry, context);
+
+ UpdateSoilModels(mechanism, registry, context, entity);
+ UpdateSurfaceLines(mechanism, registry, context, entity);
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+ mechanism.CalculationsGroup.Update(registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateSectionResults(PipingFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).PipingSectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+
+ private static void UpdateSoilModels(PipingFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context, FailureMechanismEntity entity)
+ {
+ foreach (var stochasticSoilModel in mechanism.StochasticSoilModels)
+ {
+ if (stochasticSoilModel.IsNew())
+ {
+ entity.StochasticSoilModelEntities.Add(stochasticSoilModel.Create(registry));
+ }
+ else
+ {
+ stochasticSoilModel.Update(registry, context);
+ }
+ }
+ }
+
+ private static void UpdateSurfaceLines(PipingFailureMechanism failureMechanism, PersistenceRegistry registry, IRingtoetsEntities context, FailureMechanismEntity entity)
+ {
+ foreach (RingtoetsPipingSurfaceLine surfaceLine in failureMechanism.SurfaceLines)
+ {
+ if (surfaceLine.IsNew())
+ {
+ entity.SurfaceLineEntities.Add(surfaceLine.Create(registry));
+ }
+ else
+ {
+ surfaceLine.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingProbabilityAssessmentInputUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingProbabilityAssessmentInputUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingProbabilityAssessmentInputUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,71 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Update.Piping
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class PipingProbabilityAssessmentInputUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The piping probability assessment input to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this PipingProbabilityAssessmentInput probabilityAssessmentInput, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ PipingFailureMechanismMetaEntity entity = probabilityAssessmentInput.GetCorrespondingEntity(
+ context.PipingFailureMechanismMetaEntities,
+ o => o.PipingFailureMechanismMetaEntityId);
+
+ entity.A = Convert.ToDecimal(probabilityAssessmentInput.A);
+
+ registry.Register(entity, probabilityAssessmentInput);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingSoilLayerUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingSoilLayerUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingSoilLayerUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -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.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Update.Piping
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class PipingSoilLayerUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The layer to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this PipingSoilLayer layer, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ SoilLayerEntity entity = layer.GetCorrespondingEntity(
+ context.SoilLayerEntities,
+ o => o.SoilLayerEntityId);
+
+ entity.IsAquifer = Convert.ToByte(layer.IsAquifer);
+ entity.Top = layer.Top;
+ entity.Color = layer.Color.ToArgb();
+ entity.MaterialName = layer.MaterialName;
+ entity.BelowPhreaticLevelMean = layer.BelowPhreaticLevelMean.ToNaNAsNull();
+ entity.BelowPhreaticLevelDeviation = layer.BelowPhreaticLevelDeviation.ToNaNAsNull();
+ entity.BelowPhreaticLevelShift = layer.BelowPhreaticLevelShift.ToNaNAsNull();
+ entity.DiameterD70Mean = layer.DiameterD70Mean.ToNaNAsNull();
+ entity.DiameterD70Deviation = layer.DiameterD70Deviation.ToNaNAsNull();
+ entity.PermeabilityMean = layer.PermeabilityMean.ToNaNAsNull();
+ entity.PermeabilityDeviation = layer.PermeabilityDeviation.ToNaNAsNull();
+
+ registry.Register(entity, layer);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingSoilProfileUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingSoilProfileUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/PipingSoilProfileUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,85 @@
+// 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.Create.Piping;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Update.Piping
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class PipingSoilProfileUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The profile to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this PipingSoilProfile profile, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ SoilProfileEntity entity = profile.GetCorrespondingEntity(
+ context.SoilProfileEntities,
+ o => o.SoilProfileEntityId);
+
+ entity.Name = profile.Name;
+ entity.Bottom = Convert.ToDecimal(profile.Bottom);
+
+ foreach (var pipingSoilLayer in profile.Layers)
+ {
+ if (pipingSoilLayer.IsNew())
+ {
+ entity.SoilLayerEntities.Add(pipingSoilLayer.Create(registry));
+ }
+ else
+ {
+ pipingSoilLayer.Update(registry, context);
+ }
+ }
+
+ registry.Register(entity, profile);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/RingtoetsPipingSurfaceLineUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/RingtoetsPipingSurfaceLineUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/RingtoetsPipingSurfaceLineUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,177 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+
+using Core.Common.Base.Geometry;
+
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Update.Piping
+{
+ ///
+ /// Extension methods for related to updating
+ /// an .
+ ///
+ internal static class RingtoetsPipingSurfaceLineUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information
+ /// of the .
+ ///
+ /// The piping surfaceline to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When no
+ /// can be found in that matches .
+ internal static void Update(this RingtoetsPipingSurfaceLine surfaceLine, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+
+ SurfaceLineEntity entity = surfaceLine.GetCorrespondingEntity(
+ context.SurfaceLineEntities,
+ o => o.SurfaceLineEntityId);
+
+ entity.Name = surfaceLine.Name;
+ entity.ReferenceLineIntersectionX = Convert.ToDecimal(surfaceLine.ReferenceLineIntersectionWorldPoint.X);
+ entity.ReferenceLineIntersectionY = Convert.ToDecimal(surfaceLine.ReferenceLineIntersectionWorldPoint.Y);
+
+ UpdateGeometry(surfaceLine, entity, registry);
+ UpdateCharacteristicPoints(surfaceLine, entity, registry);
+
+ registry.Register(entity, surfaceLine);
+ }
+
+ private static void UpdateGeometry(RingtoetsPipingSurfaceLine surfaceLine, SurfaceLineEntity entity, PersistenceRegistry registry)
+ {
+ if (HasGeometryChanges(surfaceLine, entity))
+ {
+ foreach (SurfaceLinePointEntity pointEntity in entity.SurfaceLinePointEntities.ToArray())
+ {
+ entity.SurfaceLinePointEntities.Remove(pointEntity);
+ }
+ UpdateGeometryPoints(surfaceLine, entity, registry);
+ }
+ else
+ {
+ var orderedPointEntities = entity.SurfaceLinePointEntities.OrderBy(pe => pe.Order).ToArray();
+ for (int i = 0; i < surfaceLine.Points.Length; i++)
+ {
+ registry.Register(orderedPointEntities[i], surfaceLine.Points[i]);
+ }
+ }
+ }
+
+ private static bool HasGeometryChanges(RingtoetsPipingSurfaceLine surfaceLine, SurfaceLineEntity entity)
+ {
+ if (surfaceLine.Points.Length != entity.SurfaceLinePointEntities.Count)
+ {
+ return true;
+ }
+ var existingSurfaceLinePointEntities = entity.SurfaceLinePointEntities.OrderBy(pe => pe.Order).ToArray();
+ for (int i = 0; i < surfaceLine.Points.Length; i++)
+ {
+ // Note: Point3D is immutable, therefore checking for identity is enough.
+ if (surfaceLine.Points[i].StorageId != existingSurfaceLinePointEntities[i].SurfaceLinePointEntityId)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static void UpdateGeometryPoints(RingtoetsPipingSurfaceLine surfaceLine, SurfaceLineEntity entity, PersistenceRegistry registry)
+ {
+ int order = 0;
+ foreach (Point3D geometryPoint in surfaceLine.Points)
+ {
+ entity.SurfaceLinePointEntities.Add(geometryPoint.CreateSurfaceLinePointEntity(registry, order++));
+ }
+ }
+
+ private static void UpdateCharacteristicPoints(RingtoetsPipingSurfaceLine surfaceLine, SurfaceLineEntity entity, PersistenceRegistry registry)
+ {
+ CharacteristicPointEntity[] currentCharacteristicPointEntities = entity.SurfaceLinePointEntities
+ .SelectMany(pe => pe.CharacteristicPointEntities)
+ .ToArray();
+
+ UpdateCharacteristicPoint(surfaceLine.DikeToeAtRiver, CharacteristicPointType.DikeToeAtRiver,
+ currentCharacteristicPointEntities, registry);
+ UpdateCharacteristicPoint(surfaceLine.DikeToeAtPolder, CharacteristicPointType.DikeToeAtPolder,
+ currentCharacteristicPointEntities, registry);
+ UpdateCharacteristicPoint(surfaceLine.DitchDikeSide, CharacteristicPointType.DitchDikeSide,
+ currentCharacteristicPointEntities, registry);
+ UpdateCharacteristicPoint(surfaceLine.BottomDitchDikeSide, CharacteristicPointType.BottomDitchDikeSide,
+ currentCharacteristicPointEntities, registry);
+ UpdateCharacteristicPoint(surfaceLine.BottomDitchPolderSide, CharacteristicPointType.BottomDitchPolderSide,
+ currentCharacteristicPointEntities, registry);
+ UpdateCharacteristicPoint(surfaceLine.DitchPolderSide, CharacteristicPointType.DitchPolderSide,
+ currentCharacteristicPointEntities, registry);
+ }
+
+ private static void UpdateCharacteristicPoint(Point3D currentCharacteristicPoint, CharacteristicPointType type,
+ CharacteristicPointEntity[] currentCharacteristicPointEntities,
+ PersistenceRegistry registry)
+ {
+ short typeValue = (short)type;
+ CharacteristicPointEntity characteristicPointEntity = currentCharacteristicPointEntities
+ .FirstOrDefault(cpe => cpe.CharacteristicPointType == typeValue);
+
+ if (currentCharacteristicPoint == null && characteristicPointEntity != null)
+ {
+ characteristicPointEntity.SurfaceLinePointEntity = null;
+ }
+ else if (currentCharacteristicPoint != null)
+ {
+ SurfaceLinePointEntity geometryPointEntity = registry.GetSurfaceLinePoint(currentCharacteristicPoint);
+ if (characteristicPointEntity == null)
+ {
+ characteristicPointEntity = new CharacteristicPointEntity
+ {
+ CharacteristicPointType = typeValue
+ };
+ geometryPointEntity.CharacteristicPointEntities.Add(characteristicPointEntity);
+ }
+ else if (characteristicPointEntity.SurfaceLinePointEntity != geometryPointEntity)
+ {
+ characteristicPointEntity.SurfaceLinePointEntity = geometryPointEntity;
+ }
+ registry.Register(characteristicPointEntity, currentCharacteristicPoint);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/StochasticSoilModelUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/StochasticSoilModelUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/StochasticSoilModelUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,133 @@
+// 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.Piping;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Core.Common.Base.Geometry;
+
+using Ringtoets.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Update.Piping
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class StochasticSoilModelUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The model to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this StochasticSoilModel model, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ StochasticSoilModelEntity entity = model.GetCorrespondingEntity(
+ context.StochasticSoilModelEntities,
+ o => o.StochasticSoilModelEntityId);
+
+ entity.Name = model.Name;
+ entity.SegmentName = model.SegmentName;
+
+ UpdateStochasticSoilProfiles(model, entity, registry, context);
+ UpdateSoilModelSegment(model, entity);
+
+ registry.Register(entity, model);
+ }
+
+ private static void UpdateStochasticSoilProfiles(StochasticSoilModel model, StochasticSoilModelEntity entity, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var stochasticSoilProfile in model.StochasticSoilProfiles)
+ {
+ if (stochasticSoilProfile.IsNew())
+ {
+ entity.StochasticSoilProfileEntities.Add(stochasticSoilProfile.Create(registry));
+ }
+ else
+ {
+ stochasticSoilProfile.Update(registry, context);
+ }
+ }
+ }
+
+ private static void UpdateSoilModelSegment(StochasticSoilModel model, StochasticSoilModelEntity entity)
+ {
+ if (HasChanges(entity.StochasticSoilModelSegmentPointEntities, model.Geometry))
+ {
+ entity.StochasticSoilModelSegmentPointEntities.Clear();
+ UpdateSegmentPoints(model, entity);
+ }
+ }
+
+ private static bool HasChanges(ICollection existingPointEntities, List geometry)
+ {
+ StochasticSoilModelSegmentPointEntity[] existingPoints = existingPointEntities.OrderBy(pe => pe.Order).ToArray();
+ if (existingPoints.Length != geometry.Count)
+ {
+ return true;
+ }
+ for (int i = 0; i < existingPoints.Length; i++)
+ {
+ Point2D existingPoint = new Point2D(Convert.ToDouble(existingPoints[i].X),
+ Convert.ToDouble(existingPoints[i].Y));
+ if (!Math2D.AreEqualPoints(existingPoint, geometry[i]))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static void UpdateSegmentPoints(StochasticSoilModel model, StochasticSoilModelEntity entity)
+ {
+ for (int i = 0; i < model.Geometry.Count; i++)
+ {
+ Point2D point = model.Geometry[i];
+ StochasticSoilModelSegmentPointEntity pointEntity = point.CreateStochasticSoilModelSegmentPointEntity(i);
+ entity.StochasticSoilModelSegmentPointEntities.Add(pointEntity);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/StochasticSoilProfileUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/StochasticSoilProfileUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/StochasticSoilProfileUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -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.Create;
+using Application.Ringtoets.Storage.Create.Piping;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Update.Piping
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class StochasticSoilProfileUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The profile to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this StochasticSoilProfile profile, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ StochasticSoilProfileEntity entity = profile.GetCorrespondingEntity(
+ context.StochasticSoilProfileEntities,
+ o => o.StochasticSoilProfileEntityId);
+
+ entity.Probability = Convert.ToDecimal(profile.Probability);
+
+ if (profile.SoilProfile.IsNew())
+ {
+ entity.SoilProfileEntity = profile.SoilProfile.Create(registry);
+ }
+ else
+ {
+ profile.SoilProfile.Update(registry, context);
+ }
+
+ registry.Register(entity, profile);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingCalculationScenarioUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingProbabilityAssessmentInputUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingSoilLayerUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingSoilProfileUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingStructure/PipingStructureFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingStructure/PipingStructureFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingStructure/PipingStructureFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,74 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Update.PipingStructure
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class PipingStructureFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this PipingStructureFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ PipingStructureSectionResultEntity entity = result.GetCorrespondingEntity(
+ context.PipingStructureSectionResultEntities,
+ s => s.PipingStructureSectionResultEntityId);
+
+ entity.LayerOne = Convert.ToByte(result.AssessmentLayerOne);
+ entity.LayerTwoA = Convert.ToByte(result.AssessmentLayerTwoA);
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingStructure/PipingStructureFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingStructure/PipingStructureFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingStructure/PipingStructureFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,90 @@
+// 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.Create.PipingStructure;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Update.PipingStructure
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class PipingStructureFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this PipingStructureFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateSectionResults(PipingStructureFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).PipingStructureSectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingStructureFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingStructureFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/RingtoetsPipingSurfaceLineUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StabilityStoneCover/StabilityStoneCoverFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StabilityStoneCover/StabilityStoneCoverFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StabilityStoneCover/StabilityStoneCoverFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,73 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Update.StabilityStoneCover
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class StabilityStoneCoverFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this StabilityStoneCoverFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ StabilityStoneCoverSectionResultEntity entity = result.GetCorrespondingEntity(
+ context.StabilityStoneCoverSectionResultEntities,
+ s => s.StabilityStoneCoverSectionResultEntityId);
+
+ entity.LayerTwoA = Convert.ToByte(result.AssessmentLayerTwoA);
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StabilityStoneCover/StabilityStoneCoverFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StabilityStoneCover/StabilityStoneCoverFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StabilityStoneCover/StabilityStoneCoverFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,90 @@
+// 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.Create.StabilityStoneCover;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Update.StabilityStoneCover
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class StabilityStoneCoverFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this StabilityStoneCoverFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateSectionResults(StabilityStoneCoverFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).StabilityStoneCoverSectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StabilityStoneCoverFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StabilityStoneCoverFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StochasticSoilModelUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StochasticSoilProfileUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityLengthwiseConstruction/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityLengthwiseConstruction/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityLengthwiseConstruction/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,73 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Update.StrengthStabilityLengthwiseConstruction
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ StrengthStabilityLengthwiseConstructionSectionResultEntity entity = result.GetCorrespondingEntity(
+ context.StrengthStabilityLengthwiseConstructionSectionResultEntities,
+ o => o.StrengthStabilityLengthwiseConstructionSectionResultEntityId);
+
+ entity.LayerOne = Convert.ToByte(result.AssessmentLayerOne);
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityLengthwiseConstruction/StrengthStabilityLengthwiseConstructionFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityLengthwiseConstruction/StrengthStabilityLengthwiseConstructionFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityLengthwiseConstruction/StrengthStabilityLengthwiseConstructionFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,90 @@
+// 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.Create.StrengthStabilityLengthwise;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Update.StrengthStabilityLengthwiseConstruction
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class StrengthStabilityLengthwiseConstructionFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this StrengthStabilityLengthwiseConstructionFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateSectionResults(StrengthStabilityLengthwiseConstructionFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).StrengthStabilityLengthwiseConstructionSectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityLengthwiseConstructionFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,73 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Update.StrengthStabilityPointConstruction
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class StrengthStabilityPointConstructionFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this StrengthStabilityPointConstructionFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ StrengthStabilityPointConstructionSectionResultEntity entity = result.GetCorrespondingEntity(
+ context.StrengthStabilityPointConstructionSectionResultEntities,
+ s => s.StrengthStabilityPointConstructionSectionResultEntityId);
+
+ entity.LayerTwoA = result.AssessmentLayerTwoA.ToNullableDecimal();
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,90 @@
+// 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.Create.StrengthStabilityPointConstruction;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Update.StrengthStabilityPointConstruction
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class StrengthStabilityPointConstructionFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this StrengthStabilityPointConstructionFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateSectionResults(StrengthStabilityPointConstructionFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).StrengthStabilityPointConstructionSectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityPointConstructionFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityPointConstructionFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/TechnicalInnovation/TechnicalInnovationFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/TechnicalInnovation/TechnicalInnovationFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/TechnicalInnovation/TechnicalInnovationFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,73 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Update.TechnicalInnovation
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class TechnicalInnovationFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this TechnicalInnovationFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ TechnicalInnovationSectionResultEntity entity = result.GetCorrespondingEntity(
+ context.TechnicalInnovationSectionResultEntities,
+ o => o.TechnicalInnovationSectionResultEntityId);
+
+ entity.LayerOne = Convert.ToByte(result.AssessmentLayerOne);
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/TechnicalInnovation/TechnicalInnovationFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/TechnicalInnovation/TechnicalInnovationFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/TechnicalInnovation/TechnicalInnovationFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,90 @@
+// 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.Create.TechnicalInnovation;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Update.TechnicalInnovation
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class TechnicalInnovationFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this TechnicalInnovationFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateSectionResults(TechnicalInnovationFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).TechnicalInnovationSectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/TechnicalInnovationFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/TechnicalInnovationFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,73 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Update.WaterPressureAsphaltCover
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class WaterPressureAsphaltCoverFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this WaterPressureAsphaltCoverFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ WaterPressureAsphaltCoverSectionResultEntity entity = result.GetCorrespondingEntity(
+ context.WaterPressureAsphaltCoverSectionResultEntities,
+ o => o.WaterPressureAsphaltCoverSectionResultEntityId);
+
+ entity.LayerOne = Convert.ToByte(result.AssessmentLayerOne);
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,90 @@
+// 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.Create.WaterPressureAsphaltCover;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Update.WaterPressureAsphaltCover
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class WaterPressureAsphaltCoverFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this WaterPressureAsphaltCoverFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateSectionResults(WaterPressureAsphaltCoverFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).WaterPressureAsphaltCoverSectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaterPressureAsphaltCoverFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaterPressureAsphaltCoverFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismSectionResultUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,74 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Update.WaveImpactAsphaltCover
+{
+ ///
+ /// Extension methods for related to updating a
+ /// .
+ ///
+ internal static class WaveImpactAsphaltCoverFailureMechanismSectionResultUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The result to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this WaveImpactAsphaltCoverFailureMechanismSectionResult result, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ WaveImpactAsphaltCoverSectionResultEntity entity = result.GetCorrespondingEntity(
+ context.WaveImpactAsphaltCoverSectionResultEntities,
+ s => s.WaveImpactAsphaltCoverSectionResultEntityId);
+
+ entity.LayerOne = Convert.ToByte(result.AssessmentLayerOne);
+ entity.LayerTwoA = result.AssessmentLayerTwoA.Value.ToNullableDecimal();
+ entity.LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal();
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismUpdateExtensions.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,90 @@
+// 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.Create.WaveImpactAsphaltCover;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Update.WaveImpactAsphaltCover
+{
+ ///
+ /// Extension methods for related to updating a .
+ ///
+ internal static class WaveImpactAsphaltCoverFailureMechanismUpdateExtensions
+ {
+ ///
+ /// Updates a in the database based on the information of the
+ /// .
+ ///
+ /// The mechanism to update the database entity for.
+ /// The object keeping track of update operations.
+ /// The context to obtain the existing entity from.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ /// When
+ /// does not have a corresponding entity in the database.
+ internal static void Update(this WaveImpactAsphaltCoverFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException("context");
+ }
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+
+ FailureMechanismEntity entity = mechanism.GetCorrespondingEntity(
+ context.FailureMechanismEntities,
+ o => o.FailureMechanismEntityId);
+
+ entity.IsRelevant = Convert.ToByte(mechanism.IsRelevant);
+
+ mechanism.UpdateFailureMechanismSections(registry, entity, context);
+ UpdateSectionResults(mechanism, registry, context);
+
+ registry.Register(entity, mechanism);
+ }
+
+ private static void UpdateSectionResults(WaveImpactAsphaltCoverFailureMechanism mechanism, PersistenceRegistry registry, IRingtoetsEntities context)
+ {
+ foreach (var sectionResult in mechanism.SectionResults)
+ {
+ if (sectionResult.IsNew())
+ {
+ registry.Get(sectionResult.Section).WaveImpactAsphaltCoverSectionResultEntities.Add(sectionResult.Create(registry));
+ }
+ else
+ {
+ sectionResult.Update(registry, context);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaveImpactAsphaltCoverFailureMechanismSectionResultUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaveImpactAsphaltCoverFailureMechanismUpdateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj
===================================================================
diff -u -r01ff2c58c13df8f42661ae3e446dc2caaa94247e -ra5714fc0488030773fff50dfc82041c6cb9edc2f
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -146,15 +146,28 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -163,26 +176,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -192,55 +192,55 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/DikeProfileEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/DikeProfileEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/DikeProfileEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/DikeProfileEntityReadExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,145 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections;
+
+using Application.Ringtoets.Storage.BinaryConverters;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Read.GrassCoverErosionInwards;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Application.Ringtoets.Storage.Test.Read.GrassCoverErosionInwards
+{
+ [TestFixture]
+ public class DikeProfileEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_DikeProfileEntityWithBreakWaterPropertiesNull_ReturnDikeProfileWithoutBreakWater()
+ {
+ // Setup
+ var foreshorePoints = new[]
+ {
+ new Point2D(-9.9, 8.8),
+ new Point2D(-7.7, 5.5)
+ };
+ var roughnessPoints = new[]
+ {
+ new RoughnessPoint(new Point2D(-7.7, 5.5), 1.0),
+ new RoughnessPoint(new Point2D(5.5, 6.6), 0.5)
+ };
+ var entity = new DikeProfileEntity
+ {
+ DikeProfileEntityId = 9842,
+ Name = "Just saved",
+ Orientation = 45.67,
+ BreakWaterHeight = null,
+ BreakWaterType = null,
+ ForeShoreData = new Point2DBinaryConverter().ToBytes(foreshorePoints),
+ DikeGeometryData = new RoughnessPointBinaryConverter().ToBytes(roughnessPoints),
+ DikeHeight = 1.2,
+ X = 3.4,
+ Y = 5.6,
+ X0 = -7.8
+ };
+
+ // Call
+ DikeProfile dikeProfile = entity.Read();
+
+ // Assert
+ Assert.AreEqual(entity.DikeProfileEntityId, dikeProfile.StorageId);
+ Assert.AreEqual(entity.Name, dikeProfile.Name);
+ Assert.AreEqual(entity.Orientation, dikeProfile.Orientation.Value);
+ CollectionAssert.AreEqual(foreshorePoints, dikeProfile.ForeshoreGeometry);
+ CollectionAssert.AreEqual(roughnessPoints, dikeProfile.DikeGeometry, new RoughnessPointComparer());
+ Assert.AreEqual(entity.X, dikeProfile.WorldReferencePoint.X);
+ Assert.AreEqual(entity.Y, dikeProfile.WorldReferencePoint.Y);
+ Assert.AreEqual(entity.X0, dikeProfile.X0);
+
+ Assert.IsFalse(dikeProfile.HasBreakWater);
+ }
+
+ [Test]
+ [TestCase(BreakWaterType.Caisson, 1.1)]
+ [TestCase(BreakWaterType.Dam, -22.2)]
+ [TestCase(BreakWaterType.Wall, 45.67)]
+ public void Read_DikeProfileEntityWithBreakWater_ReturnDikeProfileWithBreakWater(BreakWaterType type, double height)
+ {
+ // Setup
+ var foreshorePoints = new Point2D[0];
+ var roughnessPoints = new[]
+ {
+ new RoughnessPoint(new Point2D(1.1, 2.2), 1.0),
+ new RoughnessPoint(new Point2D(3.3, 4.4), 0.6),
+ new RoughnessPoint(new Point2D(5.5, 6.6), 1.0),
+ new RoughnessPoint(new Point2D(7.7, 8.8), 0.5)
+ };
+ var entity = new DikeProfileEntity
+ {
+ DikeProfileEntityId = 8678,
+ Name = "I have a Breakwater!",
+ Orientation = 360.0,
+ BreakWaterHeight = height,
+ BreakWaterType = Convert.ToByte(type),
+ ForeShoreData = new Point2DBinaryConverter().ToBytes(foreshorePoints),
+ DikeGeometryData = new RoughnessPointBinaryConverter().ToBytes(roughnessPoints),
+ DikeHeight = 4.5,
+ X = 93.0,
+ Y = 945.6,
+ X0 = 9.34
+ };
+
+ // Call
+ DikeProfile dikeProfile = entity.Read();
+
+ // Assert
+ Assert.AreEqual(entity.DikeProfileEntityId, dikeProfile.StorageId);
+ Assert.AreEqual(entity.Name, dikeProfile.Name);
+ Assert.AreEqual(entity.Orientation, dikeProfile.Orientation.Value);
+ CollectionAssert.AreEqual(foreshorePoints, dikeProfile.ForeshoreGeometry);
+ CollectionAssert.AreEqual(roughnessPoints, dikeProfile.DikeGeometry, new RoughnessPointComparer());
+ Assert.AreEqual(entity.X, dikeProfile.WorldReferencePoint.X);
+ Assert.AreEqual(entity.Y, dikeProfile.WorldReferencePoint.Y);
+ Assert.AreEqual(entity.X0, dikeProfile.X0);
+
+ Assert.AreEqual(height, dikeProfile.BreakWater.Height.Value);
+ Assert.AreEqual(type, dikeProfile.BreakWater.Type);
+ }
+
+ private class RoughnessPointComparer : IComparer {
+ public int Compare(object x, object y)
+ {
+ var p1 = (RoughnessPoint)x;
+ var p2 = (RoughnessPoint)y;
+ if (p1.Point.Equals(p2.Point) && p1.Roughness.Equals(p2.Roughness))
+ {
+ return 0;
+ }
+ return 1;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,71 @@
+// 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.GrassCoverErosionInwards;
+
+using NUnit.Framework;
+
+using Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Application.Ringtoets.Storage.Test.Read.GrassCoverErosionInwards
+{
+ [TestFixture]
+ public class GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_GeneralInputIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var entity = new GrassCoverErosionInwardsFailureMechanismMetaEntity();
+
+ // Call
+ TestDelegate call = () => entity.Read(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("input", paramName);
+ }
+
+ [Test]
+ public void Read_ValidEntity_ReturnGeneralGrassCoverErosionInwardsInput(
+ [Random(1, 20, 1)]int n,
+ [Random(1, 56, 1)]int id)
+ {
+ // Setup
+ var entity = new GrassCoverErosionInwardsFailureMechanismMetaEntity
+ {
+ GrassCoverErosionInwardsFailureMechanismMetaEntityId = id,
+ N = n
+ };
+ var inputToUpdate = new GeneralGrassCoverErosionInwardsInput();
+
+ // Call
+ entity.Read(inputToUpdate);
+
+ // Assert
+ Assert.AreEqual(n, inputToUpdate.N);
+ Assert.AreEqual(id, inputToUpdate.StorageId);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsSectionResultEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsSectionResultEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsSectionResultEntityReadExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,122 @@
+// 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.GrassCoverErosionInwards;
+using Application.Ringtoets.Storage.TestUtil;
+
+using NUnit.Framework;
+
+using Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Application.Ringtoets.Storage.Test.Read.GrassCoverErosionInwards
+{
+ [TestFixture]
+ public class GrassCoverErosionInwardsSectionResultEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_SectionResultIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var entity = new GrassCoverErosionInwardsSectionResultEntity();
+
+ // Call
+ TestDelegate call = () => entity.Read(null, new ReadConversionCollector());
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("sectionResult", paramName);
+ }
+
+ [Test]
+ public void Read_CollectorIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var entity = new GrassCoverErosionInwardsSectionResultEntity();
+
+ // Call
+ TestDelegate call = () => entity.Read(new GrassCoverErosionInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()), null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("collector", paramName);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Read_WithDecimalParameterValues_ReturnGrassCoverErosionInwardsSectionResultWithDoubleParameterValues(bool layerOne)
+ {
+ // Setup
+ var random = new Random(21);
+ var entityId = random.Next(1, 502);
+ double layerThree = random.NextDouble();
+ var collector = new ReadConversionCollector();
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity();
+ collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection());
+ var entity = new GrassCoverErosionInwardsSectionResultEntity
+ {
+ GrassCoverErosionInwardsSectionResultEntityId = entityId,
+ LayerThree = Convert.ToDecimal(layerThree),
+ LayerOne = Convert.ToByte(layerOne),
+ FailureMechanismSectionEntity = failureMechanismSectionEntity
+ };
+ var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ entity.Read(sectionResult, collector);
+
+ // Assert
+ Assert.IsNotNull(sectionResult);
+ Assert.AreEqual(entityId, sectionResult.StorageId);
+ Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne);
+ Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Read_WithNullParameterValues_ReturnGrassCoverErosionInwardsSectionResultWithNullParameters(bool layerOne)
+ {
+ // Setup
+ var collector = new ReadConversionCollector();
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity();
+ collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection());
+ var entity = new GrassCoverErosionInwardsSectionResultEntity
+ {
+ LayerOne = Convert.ToByte(layerOne),
+ LayerThree = null,
+ FailureMechanismSectionEntity = failureMechanismSectionEntity
+ };
+ var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ entity.Read(sectionResult, collector);
+
+ // Assert
+ Assert.IsNaN(sectionResult.AssessmentLayerThree);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwardsSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingCalculationEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingCalculationEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingCalculationEntityReadExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,440 @@
+// 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.Piping;
+
+using Core.Common.Base.Data;
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Test.Read.Piping
+{
+ [TestFixture]
+ public class PipingCalculationEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_CollectorIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var entity = new PipingCalculationEntity();
+
+ // Call
+ TestDelegate call = () => entity.Read(null, new GeneralPipingInput());
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("collector", paramName);
+ }
+
+ [Test]
+ [TestCase(3456789, true, 0.98, "haha", "hihi", 0.0, 3.4, 123)]
+ [TestCase(234, false, 0.0, null, null, double.NaN, double.NaN, 321)]
+ public void Read_ValidEntity_ReturnPipingCalculationScenario(long id, bool isRelevant, double contribution,
+ string name, string comments, double entryPoint, double exitPoint, int seed)
+ {
+ // Setup
+ var random = new Random(seed);
+
+ var entity = new PipingCalculationEntity
+ {
+ PipingCalculationEntityId = id,
+ RelevantForScenario = Convert.ToByte(isRelevant),
+ ScenarioContribution = Convert.ToDecimal(contribution),
+ Name = name,
+ Comments = comments,
+ EntryPointL = entryPoint.ToNullableDecimal(),
+ ExitPointL = exitPoint.ToNullableDecimal(),
+ PhreaticLevelExitMean = GetRandomDecimalInRange(random, -9999.99, 9999.99),
+ PhreaticLevelExitStandardDeviation = GetRandomDecimalInRange(random, 0, 9999.99),
+ DampingFactorExitMean = GetRandomDecimalInRange(random, 1e-6, 9999.99),
+ DampingFactorExitStandardDeviation = GetRandomDecimalInRange(random, 0, 9999.99),
+ SaturatedVolumicWeightOfCoverageLayerMean = GetRandomDecimalInRange(random, 1e-6, 9999.99),
+ SaturatedVolumicWeightOfCoverageLayerStandardDeviation = GetRandomDecimalInRange(random, 0, 9999.99),
+ SaturatedVolumicWeightOfCoverageLayerShift = GetRandomDecimalInRange(random, -9999.99, 9999.99),
+ Diameter70Mean = GetRandomDecimalInRange(random, 1e-6, 9999.99),
+ Diameter70StandardDeviation = GetRandomDecimalInRange(random, 0.0, 9999.99),
+ DarcyPermeabilityMean = GetRandomDecimalInRange(random, 1e-6, 9999.99),
+ DarcyPermeabilityStandardDeviation = GetRandomDecimalInRange(random, 0.0, 9999.99)
+ };
+
+ var collector = new ReadConversionCollector();
+ var generalInputParameters = new GeneralPipingInput();
+
+ // Call
+ PipingCalculationScenario calculation = entity.Read(collector, generalInputParameters);
+
+ // Assert
+ Assert.AreEqual(id, calculation.StorageId);
+ Assert.AreEqual(isRelevant, calculation.IsRelevant);
+ Assert.AreEqual(contribution, calculation.Contribution, 1e-6);
+ Assert.AreEqual(name, calculation.Name);
+ Assert.AreEqual(comments, calculation.Comments);
+
+ Assert.AreEqual(generalInputParameters.BeddingAngle, calculation.InputParameters.BeddingAngle);
+ Assert.AreEqual(generalInputParameters.CriticalHeaveGradient, calculation.InputParameters.CriticalHeaveGradient);
+ Assert.AreEqual(generalInputParameters.Gravity, calculation.InputParameters.Gravity);
+ Assert.AreEqual(generalInputParameters.MeanDiameter70, calculation.InputParameters.MeanDiameter70);
+ Assert.AreEqual(generalInputParameters.SandParticlesVolumicWeight, calculation.InputParameters.SandParticlesVolumicWeight);
+ Assert.AreEqual(generalInputParameters.SellmeijerModelFactor, calculation.InputParameters.SellmeijerModelFactor);
+ Assert.AreEqual(generalInputParameters.SellmeijerReductionFactor, calculation.InputParameters.SellmeijerReductionFactor);
+ Assert.AreEqual(generalInputParameters.UpliftModelFactor, calculation.InputParameters.UpliftModelFactor);
+ Assert.AreEqual(generalInputParameters.WaterKinematicViscosity, calculation.InputParameters.WaterKinematicViscosity);
+ Assert.AreEqual(generalInputParameters.WaterVolumetricWeight, calculation.InputParameters.WaterVolumetricWeight);
+ Assert.AreEqual(generalInputParameters.WhitesDragCoefficient, calculation.InputParameters.WhitesDragCoefficient);
+
+ AssertRoundedDouble(entryPoint, calculation.InputParameters.EntryPointL);
+ AssertRoundedDouble(exitPoint, calculation.InputParameters.ExitPointL);
+ AssertRoundedDouble(entity.PhreaticLevelExitMean, calculation.InputParameters.PhreaticLevelExit.Mean);
+ AssertRoundedDouble(entity.PhreaticLevelExitStandardDeviation, calculation.InputParameters.PhreaticLevelExit.StandardDeviation);
+ AssertRoundedDouble(entity.DampingFactorExitMean, calculation.InputParameters.DampingFactorExit.Mean);
+ AssertRoundedDouble(entity.DampingFactorExitStandardDeviation, calculation.InputParameters.DampingFactorExit.StandardDeviation);
+ AssertRoundedDouble(entity.SaturatedVolumicWeightOfCoverageLayerMean, calculation.InputParameters.SaturatedVolumicWeightOfCoverageLayer.Mean);
+ AssertRoundedDouble(entity.SaturatedVolumicWeightOfCoverageLayerStandardDeviation, calculation.InputParameters.SaturatedVolumicWeightOfCoverageLayer.StandardDeviation);
+ AssertRoundedDouble(entity.SaturatedVolumicWeightOfCoverageLayerShift, calculation.InputParameters.SaturatedVolumicWeightOfCoverageLayer.Shift);
+ AssertRoundedDouble(entity.Diameter70Mean, calculation.InputParameters.Diameter70.Mean);
+ AssertRoundedDouble(entity.Diameter70StandardDeviation, calculation.InputParameters.Diameter70.StandardDeviation);
+ AssertRoundedDouble(entity.DarcyPermeabilityMean, calculation.InputParameters.DarcyPermeability.Mean);
+ AssertRoundedDouble(entity.DarcyPermeabilityStandardDeviation, calculation.InputParameters.DarcyPermeability.StandardDeviation);
+
+ Assert.IsNull(calculation.InputParameters.SurfaceLine);
+ Assert.IsNull(calculation.InputParameters.HydraulicBoundaryLocation);
+ Assert.IsNull(calculation.InputParameters.StochasticSoilModel);
+ Assert.IsNull(calculation.InputParameters.StochasticSoilProfile);
+ Assert.IsNull(calculation.Output);
+ Assert.IsNull(calculation.SemiProbabilisticOutput);
+ }
+
+ [Test]
+ public void Read_EntityWithSurfaceLineInCollector_CalculationHasAlreadyReadSurfaceLine()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(1, 2, 3),
+ new Point3D(4, 5, 6)
+ });
+ var surfaceLineEntity = new SurfaceLineEntity();
+ var entity = new PipingCalculationEntity
+ {
+ SurfaceLineEntity = surfaceLineEntity,
+ EntryPointL = 1m,
+ ExitPointL = 2m,
+ DampingFactorExitMean = 1,
+ SaturatedVolumicWeightOfCoverageLayerMean = 1,
+ Diameter70Mean = 1,
+ DarcyPermeabilityMean = 1
+ };
+
+ var collector = new ReadConversionCollector();
+ collector.Read(surfaceLineEntity, surfaceLine);
+
+ // Call
+ PipingCalculationScenario calculation = entity.Read(collector, new GeneralPipingInput());
+
+ // Assert
+ Assert.AreSame(surfaceLine, calculation.InputParameters.SurfaceLine);
+ Assert.AreEqual(1, calculation.InputParameters.EntryPointL, 1e-6);
+ Assert.AreEqual(2, calculation.InputParameters.ExitPointL, 1e-6);
+ }
+
+ [Test]
+ public void Read_EntityWithSurfaceLineNotYetInCollector_CalculationWithCreatedSurfaceLineAndRegisteredNewEntities()
+ {
+ // Setup
+ var pointEntity1 = new SurfaceLinePointEntity
+ {
+ Order = 0,
+ SurfaceLinePointEntityId = 1,
+ X = 1m,
+ Y = 3m,
+ Z = 4m
+ };
+ var pointEntity2 = new SurfaceLinePointEntity
+ {
+ Order = 1,
+ SurfaceLinePointEntityId = 2,
+ X = 7m,
+ Y = 10m,
+ Z = 11m
+ };
+
+ var surfaceLineEntity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = 123,
+ SurfaceLinePointEntities =
+ {
+ pointEntity1,
+ pointEntity2
+ }
+ };
+
+ var entity = new PipingCalculationEntity
+ {
+ SurfaceLineEntity = surfaceLineEntity,
+ EntryPointL = 1m,
+ ExitPointL = 2m,
+ DampingFactorExitMean = 1,
+ SaturatedVolumicWeightOfCoverageLayerMean = 1,
+ Diameter70Mean = 1,
+ DarcyPermeabilityMean = 1
+ };
+
+ var collector = new ReadConversionCollector();
+
+ // Call
+ PipingCalculationScenario calculation = entity.Read(collector, new GeneralPipingInput());
+
+ // Assert
+ Assert.AreEqual(surfaceLineEntity.SurfaceLineEntityId, calculation.InputParameters.SurfaceLine.StorageId);
+ Assert.IsTrue(collector.Contains(surfaceLineEntity));
+ Assert.IsTrue(collector.Contains(pointEntity1));
+ Assert.IsTrue(collector.Contains(pointEntity2));
+ }
+
+ [Test]
+ public void Read_EntityWithHydraulicBoundaryLocationInCollector_CalculationHasAlreadyReadHydraulicBoundaryLocation()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "A", 1.1, 2.2);
+ var hydraulicLocationEntity = new HydraulicLocationEntity();
+ var entity = new PipingCalculationEntity
+ {
+ HydraulicLocationEntity = hydraulicLocationEntity,
+ EntryPointL = 1m,
+ ExitPointL = 2m,
+ DampingFactorExitMean = 1,
+ SaturatedVolumicWeightOfCoverageLayerMean = 1,
+ Diameter70Mean = 1,
+ DarcyPermeabilityMean = 1
+ };
+
+ var collector = new ReadConversionCollector();
+ collector.Read(hydraulicLocationEntity, hydraulicBoundaryLocation);
+
+ // Call
+ PipingCalculationScenario calculation = entity.Read(collector, new GeneralPipingInput());
+
+ // Assert
+ Assert.AreSame(hydraulicBoundaryLocation, calculation.InputParameters.HydraulicBoundaryLocation);
+ }
+
+ [Test]
+ public void Read_EntityWithHydraulicBoundaryLocationNotYetInCollector_CalculationWithCreatedHydraulicBoundaryLocationAndRegisteredNewEntities()
+ {
+ // Setup
+ var hydraulicLocationEntity = new HydraulicLocationEntity
+ {
+ HydraulicLocationEntityId = 123,
+ Name = "A"
+ };
+
+ var entity = new PipingCalculationEntity
+ {
+ HydraulicLocationEntity = hydraulicLocationEntity,
+ EntryPointL = 1m,
+ ExitPointL = 2m,
+ DampingFactorExitMean = 1,
+ SaturatedVolumicWeightOfCoverageLayerMean = 1,
+ Diameter70Mean = 1,
+ DarcyPermeabilityMean = 1
+ };
+
+ var collector = new ReadConversionCollector();
+
+ // Call
+ PipingCalculationScenario calculation = entity.Read(collector, new GeneralPipingInput());
+
+ // Assert
+ Assert.AreEqual(hydraulicLocationEntity.HydraulicLocationEntityId, calculation.InputParameters.HydraulicBoundaryLocation.StorageId);
+ Assert.IsTrue(collector.Contains(hydraulicLocationEntity));
+ }
+
+ [Test]
+ public void Read_EntityWithStochasticSoilModelEntityInCollector_CalculationHasAlreadyReadStochasticSoilModel()
+ {
+ // Setup
+ var stochasticSoilModel = new StochasticSoilModel(1, "A", "B");
+ var stochasticSoilModelEntity = new StochasticSoilModelEntity();
+
+ var stochasticSoilProfile = new StochasticSoilProfile(1, SoilProfileType.SoilProfile1D, 1);
+ var stochasticSoilProfileEntity = new StochasticSoilProfileEntity
+ {
+ StochasticSoilModelEntity = stochasticSoilModelEntity
+ };
+
+ var entity = new PipingCalculationEntity
+ {
+ StochasticSoilProfileEntity = stochasticSoilProfileEntity,
+ EntryPointL = 1m,
+ ExitPointL = 2m,
+ DampingFactorExitMean = 1,
+ SaturatedVolumicWeightOfCoverageLayerMean = 1,
+ Diameter70Mean = 1,
+ DarcyPermeabilityMean = 1
+ };
+
+ var collector = new ReadConversionCollector();
+ collector.Read(stochasticSoilProfileEntity, stochasticSoilProfile);
+ collector.Read(stochasticSoilModelEntity, stochasticSoilModel);
+
+ // Call
+ PipingCalculationScenario calculation = entity.Read(collector, new GeneralPipingInput());
+
+ // Assert
+ Assert.AreSame(stochasticSoilProfile, calculation.InputParameters.StochasticSoilProfile);
+ Assert.AreSame(stochasticSoilModel, calculation.InputParameters.StochasticSoilModel);
+ }
+
+ [Test]
+ public void Read_EntityWithStochasticSoilProfileEntityNotYetInCollector_CalculationWithCreatedStochasticSoilProfileAndRegisteredNewEntities()
+ {
+ // Setup
+ var stochasticSoilProfileEntity = new StochasticSoilProfileEntity
+ {
+ StochasticSoilProfileEntityId = 546,
+ SoilProfileEntity = new SoilProfileEntity
+ {
+ SoilLayerEntities =
+ {
+ new SoilLayerEntity()
+ }
+ }
+ };
+
+ var stochasticSoilModelEntity = new StochasticSoilModelEntity
+ {
+ StochasticSoilModelEntityId = 75,
+ StochasticSoilProfileEntities =
+ {
+ stochasticSoilProfileEntity
+ }
+ };
+ stochasticSoilProfileEntity.StochasticSoilModelEntity = stochasticSoilModelEntity;
+
+ var entity = new PipingCalculationEntity
+ {
+ StochasticSoilProfileEntity = stochasticSoilProfileEntity,
+ EntryPointL = 1m,
+ ExitPointL = 2m,
+ DampingFactorExitMean = 1,
+ SaturatedVolumicWeightOfCoverageLayerMean = 1,
+ Diameter70Mean = 1,
+ DarcyPermeabilityMean = 1
+ };
+
+ var collector = new ReadConversionCollector();
+
+ // Call
+ PipingCalculationScenario calculation = entity.Read(collector, new GeneralPipingInput());
+
+ // Assert
+ Assert.AreEqual(stochasticSoilProfileEntity.StochasticSoilProfileEntityId, calculation.InputParameters.StochasticSoilProfile.StorageId);
+ Assert.AreEqual(stochasticSoilModelEntity.StochasticSoilModelEntityId, calculation.InputParameters.StochasticSoilModel.StorageId);
+ Assert.IsTrue(collector.Contains(stochasticSoilProfileEntity));
+ Assert.IsTrue(collector.Contains(stochasticSoilModelEntity));
+ }
+
+ [Test]
+ public void Read_EntityWithPipingCalculationOutputEntity_CalculationWithPipingOutput()
+ {
+ // Setup
+ const int outputId = 4578;
+ var entity = new PipingCalculationEntity
+ {
+ EntryPointL = 1m,
+ ExitPointL = 2m,
+ DampingFactorExitMean = 1,
+ SaturatedVolumicWeightOfCoverageLayerMean = 1,
+ Diameter70Mean = 1,
+ DarcyPermeabilityMean = 1,
+ PipingCalculationOutputEntity = new PipingCalculationOutputEntity
+ {
+ PipingCalculationOutputEntityId = outputId
+ }
+ };
+
+ var collector = new ReadConversionCollector();
+
+ // Call
+ PipingCalculationScenario calculation = entity.Read(collector, new GeneralPipingInput());
+
+ // Assert
+ Assert.IsNotNull(calculation.Output);
+ Assert.AreEqual(outputId, calculation.Output.StorageId);
+ }
+
+ [Test]
+ public void Read_EntityWithPipingSemiProbabilisticOutputEntity_CalculationWithPipingSemiProbabilisticOutput()
+ {
+ // Setup
+ const int outputId = 675;
+ var entity = new PipingCalculationEntity
+ {
+ EntryPointL = 1m,
+ ExitPointL = 2m,
+ DampingFactorExitMean = 1,
+ SaturatedVolumicWeightOfCoverageLayerMean = 1,
+ Diameter70Mean = 1,
+ DarcyPermeabilityMean = 1,
+ PipingSemiProbabilisticOutputEntity = new PipingSemiProbabilisticOutputEntity
+ {
+ PipingSemiProbabilisticOutputEntityId = outputId
+ }
+ };
+
+ var collector = new ReadConversionCollector();
+
+ // Call
+ PipingCalculationScenario calculation = entity.Read(collector, new GeneralPipingInput());
+
+ // Assert
+ Assert.IsNotNull(calculation.SemiProbabilisticOutput);
+ Assert.AreEqual(outputId, calculation.SemiProbabilisticOutput.StorageId);
+ }
+
+ private void AssertRoundedDouble(decimal expectedValue, RoundedDouble actualValue)
+ {
+ Assert.AreEqual(Convert.ToDouble(expectedValue), actualValue, actualValue.GetAccuracy());
+ }
+
+ private static void AssertRoundedDouble(double expectedValue, RoundedDouble actualValue)
+ {
+ Assert.AreEqual(expectedValue, actualValue, actualValue.GetAccuracy());
+ }
+
+ private static decimal GetRandomDecimalInRange(Random random, double lowerLimit, double upperLimit)
+ {
+ var difference = upperLimit - lowerLimit;
+ return Convert.ToDecimal(lowerLimit + random.NextDouble() * difference);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingCalculationOutputEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingCalculationOutputEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingCalculationOutputEntityReadExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,90 @@
+// 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 Application.Ringtoets.Storage.Read.Piping;
+
+using NUnit.Framework;
+
+using Ringtoets.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Test.Read.Piping
+{
+ [TestFixture]
+ public class PipingCalculationOutputEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_ValidEntity_ReturnPipingOutput()
+ {
+ // Setup
+ var entity = new PipingCalculationOutputEntity
+ {
+ PipingCalculationOutputEntityId = 123,
+ HeaveFactorOfSafety = 9.8m,
+ HeaveZValue = 7.6m,
+ UpliftZValue = 5.4m,
+ UpliftFactorOfSafety = 3.2m,
+ SellmeijerZValue = 1.9m,
+ SellmeijerFactorOfSafety = 8.7m
+ };
+
+ // Call
+ PipingOutput output = entity.Read();
+
+ // Assert
+ Assert.AreEqual(entity.PipingCalculationOutputEntityId, output.StorageId);
+ Assert.AreEqual(entity.HeaveFactorOfSafety, output.HeaveFactorOfSafety);
+ Assert.AreEqual(entity.HeaveZValue, output.HeaveZValue);
+ Assert.AreEqual(entity.SellmeijerFactorOfSafety, output.SellmeijerFactorOfSafety);
+ Assert.AreEqual(entity.SellmeijerZValue, output.SellmeijerZValue);
+ Assert.AreEqual(entity.UpliftZValue, output.UpliftZValue);
+ Assert.AreEqual(entity.UpliftFactorOfSafety, output.UpliftFactorOfSafety);
+ }
+
+ [Test]
+ public void Read_ValidEntityWithNullParameterValues_ReturnPipingOutput()
+ {
+ // Setup
+ var entity = new PipingCalculationOutputEntity
+ {
+ PipingCalculationOutputEntityId = 645,
+ HeaveFactorOfSafety = null,
+ HeaveZValue = null,
+ UpliftZValue = null,
+ UpliftFactorOfSafety = null,
+ SellmeijerZValue = null,
+ SellmeijerFactorOfSafety = null
+ };
+
+ // Call
+ PipingOutput output = entity.Read();
+
+ // Assert
+ Assert.AreEqual(entity.PipingCalculationOutputEntityId, output.StorageId);
+ Assert.IsNaN(output.HeaveFactorOfSafety);
+ Assert.IsNaN(output.HeaveZValue);
+ Assert.IsNaN(output.SellmeijerFactorOfSafety);
+ Assert.IsNaN(output.SellmeijerZValue);
+ Assert.IsNaN(output.UpliftZValue);
+ Assert.IsNaN(output.UpliftFactorOfSafety);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingFailureMechanismMetaEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingFailureMechanismMetaEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingFailureMechanismMetaEntityReadExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -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 Application.Ringtoets.Storage.Read.Piping;
+
+using NUnit.Framework;
+
+using Ringtoets.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Test.Read.Piping
+{
+ [TestFixture]
+ public class PipingFailureMechanismMetaEntityReadExtensionsTest
+ {
+ [Test]
+ public void ReadAsPipingProbabilityAssessmentInput_Always_ReturnsNewPipingProbabilityAssessmentInputWithPropertiesSet()
+ {
+ // Setup
+ var entityId = new Random(21).Next(1, 502);
+ var entity = new PipingFailureMechanismMetaEntity
+ {
+ PipingFailureMechanismMetaEntityId = entityId,
+ A = new decimal(0.95)
+ };
+
+ // Call
+ PipingProbabilityAssessmentInput pipingProbabilityAssessmentInput = entity.Read();
+
+ // Assert
+ Assert.IsNotNull(pipingProbabilityAssessmentInput);
+ Assert.AreEqual(entityId, pipingProbabilityAssessmentInput.StorageId);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingSectionResultEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingSectionResultEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingSectionResultEntityReadExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,123 @@
+// 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.Piping;
+using Application.Ringtoets.Storage.TestUtil;
+
+using NUnit.Framework;
+
+using Ringtoets.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Test.Read.Piping
+{
+ [TestFixture]
+ public class PipingSectionResultEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_CollectorIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var entity = new PipingSectionResultEntity();
+
+ // Call
+ TestDelegate call = () => entity.Read(new PipingFailureMechanismSectionResult(new TestFailureMechanismSection()), null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("collector", paramName);
+ }
+
+ [Test]
+ public void Read_SectionResultIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var entity = new ClosingStructureSectionResultEntity();
+
+ // Call
+ TestDelegate call = () => entity.Read(null, new ReadConversionCollector());
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("sectionResult", paramName);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Read_WithDecimalParameterValues_ReturnPipingSectionResultWithDoubleParameterValues(bool layerOne)
+ {
+ // Setup
+ var random = new Random(21);
+ var entityId = random.Next(1, 502);
+ double layerThree = random.NextDouble();
+ var collector = new ReadConversionCollector();
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity();
+ collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection());
+ var entity = new PipingSectionResultEntity
+ {
+ PipingSectionResultEntityId = entityId,
+ LayerThree = Convert.ToDecimal(layerThree),
+ LayerOne = Convert.ToByte(layerOne),
+ FailureMechanismSectionEntity = failureMechanismSectionEntity
+ };
+
+ var sectionResult = new PipingFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ entity.Read(sectionResult, collector);
+
+ // Assert
+ Assert.IsNotNull(sectionResult);
+ Assert.AreEqual(entityId, sectionResult.StorageId);
+ Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne);
+ Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Read_WithNullParameterValues_ReturnPipingSectionResultWithNullParameters(bool layerOne)
+ {
+ // Setup
+ var collector = new ReadConversionCollector();
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity();
+ collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection());
+ var entity = new PipingSectionResultEntity
+ {
+ LayerOne = Convert.ToByte(layerOne),
+ LayerThree = null,
+ FailureMechanismSectionEntity = failureMechanismSectionEntity
+ };
+ var sectionResult = new PipingFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ entity.Read(sectionResult, collector);
+
+ // Assert
+ Assert.IsNaN(sectionResult.AssessmentLayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingSemiProbabilisticOutputEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingSemiProbabilisticOutputEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingSemiProbabilisticOutputEntityReadExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,116 @@
+using System;
+
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Read.Piping;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Test.Read.Piping
+{
+ [TestFixture]
+ public class PipingSemiProbabilisticOutputEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_EntityWithValues_ReturnPipingSemiProbabilisticOutput()
+ {
+ // Setup
+ var entity = new PipingSemiProbabilisticOutputEntity
+ {
+ PipingSemiProbabilisticOutputEntityId = 5867,
+ HeaveFactorOfSafety = 1.1m,
+ HeaveProbability = 0.2m,
+ HeaveReliability = 3.3m,
+ PipingFactorOfSafety = 4.4m,
+ PipingProbability = 0.5m,
+ PipingReliability = 6.6m,
+ UpliftFactorOfSafety = 7.7m,
+ UpliftProbability = 0.8m,
+ UpliftReliability = 9.9m,
+ SellmeijerFactorOfSafety = 10.10m,
+ SellmeijerProbability = 0.11m,
+ SellmeijerReliability = 12.12m,
+ RequiredProbability = 0.13m,
+ RequiredReliability = 14.14m
+ };
+
+ // Call
+ PipingSemiProbabilisticOutput pipingSemiProbabilisticOutput = entity.Read();
+
+ // Assert
+ Assert.AreEqual(entity.PipingSemiProbabilisticOutputEntityId, pipingSemiProbabilisticOutput.StorageId);
+ AssertAreEqual(entity.HeaveFactorOfSafety, pipingSemiProbabilisticOutput.HeaveFactorOfSafety);
+ AssertAreEqual(entity.HeaveProbability, pipingSemiProbabilisticOutput.HeaveProbability);
+ AssertAreEqual(entity.HeaveReliability, pipingSemiProbabilisticOutput.HeaveReliability);
+ AssertAreEqual(entity.PipingFactorOfSafety, pipingSemiProbabilisticOutput.PipingFactorOfSafety);
+ AssertAreEqual(entity.PipingProbability, pipingSemiProbabilisticOutput.PipingProbability);
+ AssertAreEqual(entity.PipingReliability, pipingSemiProbabilisticOutput.PipingReliability);
+ AssertAreEqual(entity.UpliftFactorOfSafety, pipingSemiProbabilisticOutput.UpliftFactorOfSafety);
+ AssertAreEqual(entity.UpliftProbability, pipingSemiProbabilisticOutput.UpliftProbability);
+ AssertAreEqual(entity.UpliftReliability, pipingSemiProbabilisticOutput.UpliftReliability);
+ AssertAreEqual(entity.SellmeijerFactorOfSafety, pipingSemiProbabilisticOutput.SellmeijerFactorOfSafety);
+ AssertAreEqual(entity.SellmeijerProbability, pipingSemiProbabilisticOutput.SellmeijerProbability);
+ AssertAreEqual(entity.SellmeijerReliability, pipingSemiProbabilisticOutput.SellmeijerReliability);
+ AssertAreEqual(entity.RequiredProbability, pipingSemiProbabilisticOutput.RequiredProbability);
+ AssertAreEqual(entity.RequiredReliability, pipingSemiProbabilisticOutput.RequiredReliability);
+ }
+
+ [Test]
+ public void Read_EntityWithNullValues_ReturnPipingSemiProbabilisticOutput()
+ {
+ // Setup
+ var entity = new PipingSemiProbabilisticOutputEntity
+ {
+ PipingSemiProbabilisticOutputEntityId = 670,
+ HeaveFactorOfSafety = null,
+ HeaveProbability = null,
+ HeaveReliability = null,
+ PipingFactorOfSafety = null,
+ PipingProbability = null,
+ PipingReliability = null,
+ UpliftFactorOfSafety = null,
+ UpliftProbability = null,
+ UpliftReliability = null,
+ SellmeijerFactorOfSafety = null,
+ SellmeijerProbability = null,
+ SellmeijerReliability = null,
+ RequiredProbability = null,
+ RequiredReliability = null
+ };
+
+ // Call
+ PipingSemiProbabilisticOutput pipingSemiProbabilisticOutput = entity.Read();
+
+ // Assert
+ Assert.AreEqual(entity.PipingSemiProbabilisticOutputEntityId, pipingSemiProbabilisticOutput.StorageId);
+ Assert.IsNaN(pipingSemiProbabilisticOutput.HeaveFactorOfSafety);
+ Assert.IsNaN(pipingSemiProbabilisticOutput.HeaveProbability);
+ Assert.IsNaN(pipingSemiProbabilisticOutput.HeaveReliability);
+ Assert.IsNaN(pipingSemiProbabilisticOutput.PipingFactorOfSafety);
+ Assert.IsNaN(pipingSemiProbabilisticOutput.PipingProbability);
+ Assert.IsNaN(pipingSemiProbabilisticOutput.PipingReliability);
+ Assert.IsNaN(pipingSemiProbabilisticOutput.UpliftFactorOfSafety);
+ Assert.IsNaN(pipingSemiProbabilisticOutput.UpliftProbability);
+ Assert.IsNaN(pipingSemiProbabilisticOutput.UpliftReliability);
+ Assert.IsNaN(pipingSemiProbabilisticOutput.SellmeijerFactorOfSafety);
+ Assert.IsNaN(pipingSemiProbabilisticOutput.SellmeijerProbability);
+ Assert.IsNaN(pipingSemiProbabilisticOutput.SellmeijerReliability);
+ Assert.IsNaN(pipingSemiProbabilisticOutput.RequiredProbability);
+ Assert.IsNaN(pipingSemiProbabilisticOutput.RequiredReliability);
+ }
+
+ private static void AssertAreEqual(decimal? expectedParamterValue, double actualParameterValue)
+ {
+ Assert.AreEqual(Convert.ToDouble(expectedParamterValue), actualParameterValue);
+ }
+
+ private static void AssertAreEqual(decimal? expectedParamterValue, RoundedDouble actualParameterValue)
+ {
+ Assert.AreEqual(Convert.ToDouble(expectedParamterValue), actualParameterValue, actualParameterValue.GetAccuracy());
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingStructureSectionResultEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingStructureSectionResultEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingStructureSectionResultEntityReadExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,128 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Read;
+using Application.Ringtoets.Storage.Read.Piping;
+using Application.Ringtoets.Storage.TestUtil;
+
+using NUnit.Framework;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Read.Piping
+{
+ [TestFixture]
+ public class PipingStructureSectionResultEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_CollectorIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var entity = new PipingStructureSectionResultEntity();
+
+ // Call
+ TestDelegate call = () => entity.Read(new PipingStructureFailureMechanismSectionResult(new TestFailureMechanismSection()), null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("collector", paramName);
+ }
+
+ [Test]
+ public void Read_SectionResultIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var entity = new PipingStructureSectionResultEntity();
+
+ // Call
+ TestDelegate call = () => entity.Read(null, new ReadConversionCollector());
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("sectionResult", paramName);
+ }
+
+ [Test]
+ [TestCase(true, AssessmentLayerTwoAResult.Failed)]
+ [TestCase(false, AssessmentLayerTwoAResult.Successful)]
+ [TestCase(false, AssessmentLayerTwoAResult.Failed)]
+ public void Read_WithDecimalParameterValues_ReturnPipingStructureSectionResultWithDoubleParameterValues(bool layerOne, AssessmentLayerTwoAResult layerTwoA)
+ {
+ // Setup
+ var random = new Random(21);
+ var entityId = random.Next(1, 502);
+ double layerThree = random.NextDouble();
+ var collector = new ReadConversionCollector();
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity();
+ collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection());
+ var entity = new PipingStructureSectionResultEntity
+ {
+ PipingStructureSectionResultEntityId = entityId,
+ LayerThree = Convert.ToDecimal(layerThree),
+ LayerTwoA = Convert.ToByte(layerTwoA),
+ LayerOne = Convert.ToByte(layerOne),
+ FailureMechanismSectionEntity = failureMechanismSectionEntity
+ };
+ var sectionResult = new PipingStructureFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ entity.Read(sectionResult, collector);
+
+ // Assert
+ Assert.IsNotNull(sectionResult);
+ Assert.AreEqual(entityId, sectionResult.StorageId);
+ Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne);
+ Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA);
+ Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6);
+ }
+
+ [Test]
+ [TestCase(true, AssessmentLayerTwoAResult.Failed)]
+ [TestCase(false, AssessmentLayerTwoAResult.Successful)]
+ [TestCase(false, AssessmentLayerTwoAResult.Failed)]
+ public void Read_WithNullLayerThree_ReturnPipingStructureSectionResultWithNullParameters(bool layerOne, AssessmentLayerTwoAResult layerTwoA)
+ {
+ // Setup
+ var collector = new ReadConversionCollector();
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity();
+ collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection());
+ var entity = new PipingStructureSectionResultEntity
+ {
+ LayerOne = Convert.ToByte(layerOne),
+ LayerTwoA = Convert.ToByte(layerTwoA),
+ LayerThree = null,
+ FailureMechanismSectionEntity = failureMechanismSectionEntity
+ };
+ var sectionResult = new PipingStructureFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ entity.Read(sectionResult, collector);
+
+ // Assert
+ Assert.IsNaN(sectionResult.AssessmentLayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/SoilLayerEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/SoilLayerEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/SoilLayerEntityReadExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,93 @@
+// 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.Drawing;
+
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Read.Piping;
+
+using NUnit.Framework;
+
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Test.Read.Piping
+{
+ [TestFixture]
+ public class SoilLayerEntityReadExtensionsTest
+ {
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Read_WithValues_ReturnPipingSoilLayerWithDoubleParameterValues(bool isAquifer)
+ {
+ // Setup
+ var random = new Random(21);
+ var entityId = random.Next(1, 502);
+ double top = random.NextDouble();
+ int color = Color.AliceBlue.ToArgb();
+ string materialName = "sand";
+
+ var belowPhreaticLevelMean = random.NextDouble();
+ var belowPhreaticLevelDeviation = random.NextDouble();
+ var belowPhreaticLevelShift = random.NextDouble();
+ var diameterD70Mean = random.NextDouble();
+ var diameterD70Deviation = random.NextDouble();
+ var permeabilityMean = random.NextDouble();
+ var permeabilityDeviation = random.NextDouble();
+
+ var entity = new SoilLayerEntity
+ {
+ SoilLayerEntityId = entityId,
+ Top = top,
+ IsAquifer = Convert.ToByte(isAquifer),
+ Color = color,
+ MaterialName = materialName,
+ BelowPhreaticLevelMean = belowPhreaticLevelMean,
+ BelowPhreaticLevelDeviation = belowPhreaticLevelDeviation,
+ BelowPhreaticLevelShift = belowPhreaticLevelShift,
+ DiameterD70Mean = diameterD70Mean,
+ DiameterD70Deviation = diameterD70Deviation,
+ PermeabilityMean = permeabilityMean,
+ PermeabilityDeviation = permeabilityDeviation
+ };
+
+ // Call
+ PipingSoilLayer layer = entity.Read();
+
+ // Assert
+ Assert.IsNotNull(layer);
+ Assert.AreEqual(entityId, layer.StorageId);
+ Assert.AreEqual(top, layer.Top, 1e-6);
+ Assert.AreEqual(isAquifer, layer.IsAquifer);
+ Assert.AreEqual(Color.FromArgb(color), layer.Color);
+ Assert.AreEqual(materialName, layer.MaterialName);
+
+ Assert.AreEqual(belowPhreaticLevelMean, layer.BelowPhreaticLevelMean);
+ Assert.AreEqual(belowPhreaticLevelDeviation, layer.BelowPhreaticLevelDeviation);
+ Assert.AreEqual(belowPhreaticLevelShift, layer.BelowPhreaticLevelShift);
+ Assert.AreEqual(diameterD70Mean, layer.DiameterD70Mean);
+ Assert.AreEqual(diameterD70Deviation, layer.DiameterD70Deviation);
+ Assert.AreEqual(permeabilityMean, layer.PermeabilityMean);
+ Assert.AreEqual(permeabilityDeviation, layer.PermeabilityDeviation);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/SoilProfileEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/SoilProfileEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/SoilProfileEntityReadExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,125 @@
+// 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.Piping;
+
+using NUnit.Framework;
+
+namespace Application.Ringtoets.Storage.Test.Read.Piping
+{
+ [TestFixture]
+ public class SoilProfileEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_WithoutCollector_ThrowsArgumentNullException()
+ {
+ // Setup
+ var entity = new SoilProfileEntity();
+
+ // Call
+ TestDelegate test = () => entity.Read(null);
+
+ // Assert
+ var parameter = Assert.Throws(test).ParamName;
+ Assert.AreEqual("collector", parameter);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Read_WithCollector_ReturnsNewPipingSoilProfileWithPropertiesSet(bool isRelevant)
+ {
+ // Setup
+ string testName = "testName";
+ var random = new Random(21);
+ var entityId = random.Next(1, 502);
+ double bottom = random.NextDouble();
+ var entity = new SoilProfileEntity
+ {
+ SoilProfileEntityId = entityId,
+ Name = testName,
+ Bottom = Convert.ToDecimal(bottom),
+ SoilLayerEntities =
+ {
+ new SoilLayerEntity{ Top = bottom + 0.5 },
+ new SoilLayerEntity{ Top = bottom + 1.2 }
+ }
+ };
+ var collector = new ReadConversionCollector();
+
+ // Call
+ var failureMechanism = entity.Read(collector);
+
+ // Assert
+ Assert.IsNotNull(failureMechanism);
+ Assert.AreEqual(entityId, failureMechanism.StorageId);
+ Assert.AreEqual(testName, failureMechanism.Name);
+ Assert.AreEqual(bottom, failureMechanism.Bottom, 1e-6);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Read_WithCollectorWithoutLayers_ThrowsArgumentException(bool isRelevant)
+ {
+ // Setup
+ var entity = new SoilProfileEntity();
+ var collector = new ReadConversionCollector();
+
+ // Call
+ TestDelegate test = () => entity.Read(collector);
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ [Test]
+ public void Read_WithCollectorReadTwice_ReturnsSamePipingSoilProfile()
+ {
+ // Setup
+ string testName = "testName";
+ double bottom = new Random(21).NextDouble();
+ var entity = new SoilProfileEntity
+ {
+ Name = testName,
+ Bottom = Convert.ToDecimal(bottom),
+ SoilLayerEntities =
+ {
+ new SoilLayerEntity{ Top = bottom + 0.5 },
+ new SoilLayerEntity{ Top = bottom + 1.2 }
+ }
+ };
+ var collector = new ReadConversionCollector();
+
+ var firstFailureMechanism = entity.Read(collector);
+
+ // Call
+ var secondFailureMechanism = entity.Read(collector);
+
+ // Assert
+ Assert.AreSame(firstFailureMechanism, secondFailureMechanism);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/StochasticSoilModelEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/StochasticSoilModelEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/StochasticSoilModelEntityReadExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,152 @@
+// 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.Piping;
+
+using NUnit.Framework;
+
+using Ringtoets.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Test.Read.Piping
+{
+ [TestFixture]
+ public class StochasticSoilModelEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_WithoutCollector_ThrowsArgumentNullException()
+ {
+ // Setup
+ var entity = new StochasticSoilModelEntity();
+
+ // Call
+ TestDelegate test = () => entity.Read(null);
+
+ // Assert
+ var parameter = Assert.Throws(test).ParamName;
+ Assert.AreEqual("collector", parameter);
+ }
+
+ [Test]
+ public void Read_WithCollector_ReturnsNewStochasticSoilModelWithPropertiesSet()
+ {
+ // Setup
+ var entityId = new Random(21).Next(1, 502);
+ string testName = "testName";
+ string testSegmentName = "testSegmentName";
+ var entity = new StochasticSoilModelEntity
+ {
+ StochasticSoilModelEntityId = entityId,
+ Name = testName,
+ SegmentName = testSegmentName,
+ };
+ var collector = new ReadConversionCollector();
+
+ // Call
+ var model = entity.Read(collector);
+
+ // Assert
+ Assert.IsNotNull(model);
+ Assert.AreEqual(entityId, model.StorageId);
+ Assert.AreEqual(testName, model.Name);
+ Assert.AreEqual(testSegmentName, model.SegmentName);
+ }
+
+ [Test]
+ public void Read_WithCollectorWithStochasticSoilProfiles_ReturnsNewStochasticSoilModelWithStochasticSoilProfiles()
+ {
+ // Setup
+ var entity = new StochasticSoilModelEntity
+ {
+ StochasticSoilProfileEntities =
+ {
+ new StochasticSoilProfileEntity
+ {
+ SoilProfileEntity = new SoilProfileEntity
+ {
+ SoilLayerEntities =
+ {
+ new SoilLayerEntity()
+ }
+ }
+ },
+ new StochasticSoilProfileEntity
+ {
+ SoilProfileEntity = new SoilProfileEntity
+ {
+ SoilLayerEntities =
+ {
+ new SoilLayerEntity()
+ }
+ }
+ }
+ }
+ };
+ var collector = new ReadConversionCollector();
+
+ // Call
+ var model = entity.Read(collector);
+
+ // Assert
+ Assert.AreEqual(2, model.StochasticSoilProfiles.Count);
+ }
+
+ [Test]
+ public void Read_WithCollectorWithStochasticSoilModelSegmentPointEntity_ReturnsNewStochasticSoilModelWithGeometryPoints()
+ {
+ // Setup
+ var entity = new StochasticSoilModelEntity
+ {
+ StochasticSoilModelSegmentPointEntities =
+ {
+ new StochasticSoilModelSegmentPointEntity(),
+ new StochasticSoilModelSegmentPointEntity()
+ }
+ };
+ var collector = new ReadConversionCollector();
+
+ // Call
+ var model = entity.Read(collector);
+
+ // Assert
+ Assert.AreEqual(2, model.Geometry.Count);
+ }
+
+ [Test]
+ public void Read_SameStochasticSoilModelEntityMultipleTimes_ReturnSameStochasticSoilModel()
+ {
+ // Setup
+ var entity = new StochasticSoilModelEntity();
+
+ var collector = new ReadConversionCollector();
+
+ // Call
+ StochasticSoilModel soilModel1 = entity.Read(collector);
+ StochasticSoilModel soilModel2 = entity.Read(collector);
+
+ // Assert
+ Assert.AreSame(soilModel1, soilModel2);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/StochasticSoilModelSegmentPointEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/StochasticSoilModelSegmentPointEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/StochasticSoilModelSegmentPointEntityReadExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,35 @@
+using System;
+
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Read.Piping;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+namespace Application.Ringtoets.Storage.Test.Read.Piping
+{
+ [TestFixture]
+ public class StochasticSoilModelSegmentPointEntityReadExtensionsTest
+ {
+ [Test]
+ [TestCase(1.1, -2.2)]
+ [TestCase(-3.3, 4.4)]
+ public void Read_ValidEntity_ReturnPoint2D(double x, double y)
+ {
+ // Setup
+ var entity = new StochasticSoilModelSegmentPointEntity
+ {
+ X = Convert.ToDecimal(x),
+ Y = Convert.ToDecimal(y)
+ };
+
+ // Call
+ Point2D point = entity.Read();
+
+ // Assert
+ Assert.AreEqual(x, point.X);
+ Assert.AreEqual(y, point.Y);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/StochasticSoilProfileEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/StochasticSoilProfileEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/StochasticSoilProfileEntityReadExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,140 @@
+// 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.Piping;
+
+using NUnit.Framework;
+
+using Ringtoets.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Test.Read.Piping
+{
+ [TestFixture]
+ public class StochasticSoilProfileEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_WithoutCollector_ThrowsArgumentNullException()
+ {
+ // Setup
+ var entity = new StochasticSoilProfileEntity();
+
+ // Call
+ TestDelegate test = () => entity.Read(null);
+
+ // Assert
+ var parameter = Assert.Throws(test).ParamName;
+ Assert.AreEqual("collector", parameter);
+ }
+
+ [Test]
+ public void Read_WithCollector_ReturnsNewStochasticSoilProfileWithPropertiesSet()
+ {
+ // Setup
+ var random = new Random(21);
+ double probability = random.NextDouble();
+ var entityId = random.Next(1, 502);
+ var entity = new StochasticSoilProfileEntity
+ {
+ StochasticSoilProfileEntityId = entityId,
+ Probability = Convert.ToDecimal(probability),
+ SoilProfileEntity = new SoilProfileEntity
+ {
+ SoilLayerEntities =
+ {
+ new SoilLayerEntity()
+ }
+ }
+ };
+ var collector = new ReadConversionCollector();
+
+ // Call
+ var profile = entity.Read(collector);
+
+ // Assert
+ Assert.IsNotNull(profile);
+ Assert.AreEqual(entityId, profile.StorageId);
+ Assert.AreEqual(probability, profile.Probability, 1e-6);
+ }
+
+ [Test]
+ public void Read_WithCollectorDifferentStochasticSoilProfileEntitiesWithSameSoilProfileEntity_ReturnsStochasticSoilProfilesWithSamePipingSoilProfile()
+ {
+ // Setup
+ double probability = new Random(21).NextDouble();
+ var soilProfileEntity = new SoilProfileEntity
+ {
+ SoilLayerEntities =
+ {
+ new SoilLayerEntity()
+ }
+ };
+ var firstEntity = new StochasticSoilProfileEntity
+ {
+ Probability = Convert.ToDecimal(probability),
+ SoilProfileEntity = soilProfileEntity
+ };
+ var secondEntity = new StochasticSoilProfileEntity
+ {
+ Probability = 1- Convert.ToDecimal(probability),
+ SoilProfileEntity = soilProfileEntity
+ };
+ var collector = new ReadConversionCollector();
+
+ var firstProfile = firstEntity.Read(collector);
+
+ // Call
+ var secondProfile = secondEntity.Read(collector);
+
+ // Assert
+ Assert.AreNotSame(firstProfile, secondProfile);
+ Assert.AreSame(firstProfile.SoilProfile, secondProfile.SoilProfile);
+ }
+
+ [Test]
+ public void Read_SameStochasticSoilProfileEntityMultipleTimes_ReturnSameStochasticSoilProfile()
+ {
+ // Setup
+ var entity = new StochasticSoilProfileEntity
+ {
+ SoilProfileEntity = new SoilProfileEntity
+ {
+ SoilLayerEntities =
+ {
+ new SoilLayerEntity()
+ }
+ }
+ };
+
+ var collector = new ReadConversionCollector();
+
+ // Call
+ StochasticSoilProfile profile1 = entity.Read(collector);
+ StochasticSoilProfile profile2 = entity.Read(collector);
+
+ // Assert
+ Assert.AreSame(profile1, profile2);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/SurfaceLineEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/SurfaceLineEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/SurfaceLineEntityReadExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,449 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Read;
+using Application.Ringtoets.Storage.Read.Piping;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Test.Read.Piping
+{
+ [TestFixture]
+ public class SurfaceLineEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_ReadConversionCollectorIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var entity = new SurfaceLineEntity();
+
+ // Call
+ TestDelegate call = () => entity.Read(null);
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ [Test]
+ public void Read_SurfaceLineEntityWithoutGeometryPointEntities_ReturnSurfaceLine()
+ {
+ // Setup
+ var collector = new ReadConversionCollector();
+
+ const long id = 5317846874;
+ const string name = "nice name!";
+ const decimal intersectionX = 1.1m;
+ const decimal intersectionY = 2.2m;
+
+ var entity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = id,
+ Name = name,
+ ReferenceLineIntersectionX = intersectionX,
+ ReferenceLineIntersectionY = intersectionY
+ };
+
+ // Call
+ RingtoetsPipingSurfaceLine surfaceLine = entity.Read(collector);
+
+ // Assert
+ Assert.AreEqual(id, surfaceLine.StorageId);
+ Assert.AreEqual(name, surfaceLine.Name);
+ Assert.AreEqual(intersectionX, surfaceLine.ReferenceLineIntersectionWorldPoint.X);
+ Assert.AreEqual(intersectionY, surfaceLine.ReferenceLineIntersectionWorldPoint.Y);
+
+ CollectionAssert.IsEmpty(surfaceLine.Points);
+
+ Assert.IsNull(surfaceLine.BottomDitchDikeSide);
+ Assert.IsNull(surfaceLine.BottomDitchPolderSide);
+ Assert.IsNull(surfaceLine.DikeToeAtPolder);
+ Assert.IsNull(surfaceLine.DikeToeAtRiver);
+ Assert.IsNull(surfaceLine.DitchDikeSide);
+ Assert.IsNull(surfaceLine.DitchPolderSide);
+ }
+
+ [Test]
+ public void Read_SurfaceLineEntityWithGeometryPointEntitiesButNoCharacteristicPoints_ReturnSurfaceLineGeometry()
+ {
+ // Setup
+ var collector = new ReadConversionCollector();
+
+ const long id = 489357;
+ const string name = "Better name.";
+ const decimal intersectionX = 3.4m;
+ const decimal intersectionY = 7.5m;
+
+ var point1Entity = new SurfaceLinePointEntity
+ {
+ X = 1.1m,
+ Y = 2.2m,
+ Z = 3.3m,
+ Order = 0,
+ SurfaceLinePointEntityId = 1
+ };
+ var point2Entity = new SurfaceLinePointEntity
+ {
+ X = 4.4m,
+ Y = 5.5m,
+ Z = 6.6m,
+ Order = 1,
+ SurfaceLinePointEntityId = 2
+ };
+ var point3Entity = new SurfaceLinePointEntity
+ {
+ X = 7.7m,
+ Y = 8.8m,
+ Z = 9.9m,
+ Order = 2,
+ SurfaceLinePointEntityId = 3
+ };
+ var sourceCollection = new[]
+ {
+ point1Entity,
+ point2Entity,
+ point3Entity
+ };
+
+ var entity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = id,
+ Name = name,
+ ReferenceLineIntersectionX = intersectionX,
+ ReferenceLineIntersectionY = intersectionY
+ };
+ foreach (SurfaceLinePointEntity pointEntity in sourceCollection)
+ {
+ entity.SurfaceLinePointEntities.Add(pointEntity);
+ }
+
+ // Call
+ RingtoetsPipingSurfaceLine surfaceLine = entity.Read(collector);
+
+ // Assert
+ Assert.AreEqual(id, surfaceLine.StorageId);
+ Assert.AreEqual(name, surfaceLine.Name);
+ Assert.AreEqual(intersectionX, surfaceLine.ReferenceLineIntersectionWorldPoint.X);
+ Assert.AreEqual(intersectionY, surfaceLine.ReferenceLineIntersectionWorldPoint.Y);
+
+ Point3D[] geometry = surfaceLine.Points.ToArray();
+ Assert.AreEqual(sourceCollection.Length, geometry.Length);
+ for (int i = 0; i < sourceCollection.Length; i++)
+ {
+ SurfaceLinePointEntity sourceEntity = sourceCollection[i];
+ Point3D geometryPoint = geometry[i];
+
+ Assert.AreEqual(sourceEntity.X, geometryPoint.X);
+ Assert.AreEqual(sourceEntity.Y, geometryPoint.Y);
+ Assert.AreEqual(sourceEntity.Z, geometryPoint.Z);
+ Assert.AreEqual(sourceEntity.SurfaceLinePointEntityId, geometryPoint.StorageId);
+ }
+
+ Assert.IsNull(surfaceLine.BottomDitchDikeSide);
+ Assert.IsNull(surfaceLine.BottomDitchPolderSide);
+ Assert.IsNull(surfaceLine.DikeToeAtPolder);
+ Assert.IsNull(surfaceLine.DikeToeAtRiver);
+ Assert.IsNull(surfaceLine.DitchDikeSide);
+ Assert.IsNull(surfaceLine.DitchPolderSide);
+ }
+
+ [Test]
+ public void Read_SurfaceLineEntityWithGeometryPointEntitiesAndCharacteristicPoints_ReturnFullSurfaceLine()
+ {
+ // Setup
+ var collector = new ReadConversionCollector();
+
+ const long id = 489357;
+ const string name = "Better name.";
+ const decimal intersectionX = 3.4m;
+ const decimal intersectionY = 7.5m;
+
+ var point1Entity = new SurfaceLinePointEntity
+ {
+ X = 1.1m,
+ Y = 2.2m,
+ Z = 3.3m,
+ Order = 0,
+ SurfaceLinePointEntityId = 1
+ };
+ var point2Entity = new SurfaceLinePointEntity
+ {
+ X = 4.4m,
+ Y = 5.5m,
+ Z = 6.6m,
+ Order = 1,
+ SurfaceLinePointEntityId = 2
+ };
+ var point3Entity = new SurfaceLinePointEntity
+ {
+ X = 7.7m,
+ Y = 8.8m,
+ Z = 9.9m,
+ Order = 2,
+ SurfaceLinePointEntityId = 3
+ };
+ var point4Entity = new SurfaceLinePointEntity
+ {
+ X = 10.10m,
+ Y = 11.11m,
+ Z = 12.12m,
+ Order = 3,
+ SurfaceLinePointEntityId = 4
+ };
+ var point5Entity = new SurfaceLinePointEntity
+ {
+ X = 13.13m,
+ Y = 14.14m,
+ Z = 15.15m,
+ Order = 4,
+ SurfaceLinePointEntityId = 5
+ };
+ var point6Entity = new SurfaceLinePointEntity
+ {
+ X = 16.16m,
+ Y = 17.17m,
+ Z = 18.18m,
+ Order = 5,
+ SurfaceLinePointEntityId = 6
+ };
+ var point7Entity = new SurfaceLinePointEntity
+ {
+ X = 19.19m,
+ Y = 20.20m,
+ Z = 21.21m,
+ Order = 6,
+ SurfaceLinePointEntityId = 7
+ };
+ var point8Entity = new SurfaceLinePointEntity
+ {
+ X = 22.22m,
+ Y = 23.23m,
+ Z = 24.24m,
+ Order = 7,
+ SurfaceLinePointEntityId = 8
+ };
+ var sourceCollection = new[]
+ {
+ point1Entity,
+ point2Entity,
+ point3Entity,
+ point4Entity,
+ point5Entity,
+ point6Entity,
+ point7Entity,
+ point8Entity
+ };
+
+ var entity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = id,
+ Name = name,
+ ReferenceLineIntersectionX = intersectionX,
+ ReferenceLineIntersectionY = intersectionY
+ };
+ foreach (SurfaceLinePointEntity pointEntity in sourceCollection)
+ {
+ entity.SurfaceLinePointEntities.Add(pointEntity);
+ }
+ point2Entity.CharacteristicPointEntities.Add(new CharacteristicPointEntity
+ {
+ CharacteristicPointType = (short)CharacteristicPointType.BottomDitchDikeSide,
+ SurfaceLinePointEntity = point2Entity
+ });
+ point3Entity.CharacteristicPointEntities.Add(new CharacteristicPointEntity
+ {
+ CharacteristicPointType = (short)CharacteristicPointType.BottomDitchPolderSide,
+ SurfaceLinePointEntity = point3Entity
+ });
+ point4Entity.CharacteristicPointEntities.Add(new CharacteristicPointEntity
+ {
+ CharacteristicPointType = (short)CharacteristicPointType.DikeToeAtPolder,
+ SurfaceLinePointEntity = point4Entity
+ });
+ point5Entity.CharacteristicPointEntities.Add(new CharacteristicPointEntity
+ {
+ CharacteristicPointType = (short)CharacteristicPointType.DikeToeAtRiver,
+ SurfaceLinePointEntity = point5Entity
+ });
+ point6Entity.CharacteristicPointEntities.Add(new CharacteristicPointEntity
+ {
+ CharacteristicPointType = (short)CharacteristicPointType.DitchDikeSide,
+ SurfaceLinePointEntity = point6Entity
+ });
+ point7Entity.CharacteristicPointEntities.Add(new CharacteristicPointEntity
+ {
+ CharacteristicPointType = (short)CharacteristicPointType.DitchPolderSide,
+ SurfaceLinePointEntity = point7Entity
+ });
+
+ // Call
+ RingtoetsPipingSurfaceLine surfaceLine = entity.Read(collector);
+
+ // Assert
+ Assert.AreEqual(id, surfaceLine.StorageId);
+ Assert.AreEqual(name, surfaceLine.Name);
+ Assert.AreEqual(intersectionX, surfaceLine.ReferenceLineIntersectionWorldPoint.X);
+ Assert.AreEqual(intersectionY, surfaceLine.ReferenceLineIntersectionWorldPoint.Y);
+
+ Point3D[] geometry = surfaceLine.Points.ToArray();
+ Assert.AreEqual(sourceCollection.Length, geometry.Length);
+ for (int i = 0; i < sourceCollection.Length; i++)
+ {
+ SurfaceLinePointEntity sourceEntity = sourceCollection[i];
+ Point3D geometryPoint = geometry[i];
+
+ Assert.AreEqual(sourceEntity.X, geometryPoint.X);
+ Assert.AreEqual(sourceEntity.Y, geometryPoint.Y);
+ Assert.AreEqual(sourceEntity.Z, geometryPoint.Z);
+ Assert.AreEqual(sourceEntity.SurfaceLinePointEntityId, geometryPoint.StorageId);
+ }
+
+ Assert.AreSame(geometry[1], surfaceLine.BottomDitchDikeSide);
+ Assert.AreSame(geometry[2], surfaceLine.BottomDitchPolderSide);
+ Assert.AreSame(geometry[3], surfaceLine.DikeToeAtPolder);
+ Assert.AreSame(geometry[4], surfaceLine.DikeToeAtRiver);
+ Assert.AreSame(geometry[5], surfaceLine.DitchDikeSide);
+ Assert.AreSame(geometry[6], surfaceLine.DitchPolderSide);
+ }
+
+ [Test]
+ public void Read_SurfaceLineEntityWithGeometryPointEntityMarkedForAllCharacteristicPoints_ReturnFullSurfaceLineWithCharacteristicPointsToOneGeometryPoint()
+ {
+ // Setup
+ var collector = new ReadConversionCollector();
+
+ const long id = 489357;
+ const string name = "Better name.";
+ const decimal intersectionX = 3.4m;
+ const decimal intersectionY = 7.5m;
+
+ var surfaceLinePointEntity1 = new SurfaceLinePointEntity
+ {
+ X = 1.0m,
+ Y = 2.0m,
+ Z = 3.0m,
+ Order = 0,
+ SurfaceLinePointEntityId = 1,
+ CharacteristicPointEntities =
+ {
+ new CharacteristicPointEntity
+ {
+ CharacteristicPointType = (short)CharacteristicPointType.BottomDitchDikeSide
+ },
+ new CharacteristicPointEntity
+ {
+ CharacteristicPointType = (short)CharacteristicPointType.BottomDitchPolderSide
+ },
+ new CharacteristicPointEntity
+ {
+ CharacteristicPointType = (short)CharacteristicPointType.DikeToeAtPolder
+ },
+ new CharacteristicPointEntity
+ {
+ CharacteristicPointType = (short)CharacteristicPointType.DikeToeAtPolder
+ },
+ new CharacteristicPointEntity
+ {
+ CharacteristicPointType = (short)CharacteristicPointType.DikeToeAtRiver
+ },
+ new CharacteristicPointEntity
+ {
+ CharacteristicPointType = (short)CharacteristicPointType.DitchDikeSide
+ },
+ new CharacteristicPointEntity
+ {
+ CharacteristicPointType = (short)CharacteristicPointType.DitchPolderSide
+ }
+ }
+ };
+ foreach (CharacteristicPointEntity characteristicPointEntity in surfaceLinePointEntity1.CharacteristicPointEntities)
+ {
+ characteristicPointEntity.SurfaceLinePointEntity = surfaceLinePointEntity1;
+ }
+ var surfaceLinePointEntity2 = new SurfaceLinePointEntity
+ {
+ X = 5.0m,
+ Y = 6.0m,
+ Z = 7.0m,
+ Order = 1,
+ SurfaceLinePointEntityId = 2
+ };
+
+ var entity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = id,
+ Name = name,
+ ReferenceLineIntersectionX = intersectionX,
+ ReferenceLineIntersectionY = intersectionY
+ };
+ entity.SurfaceLinePointEntities.Add(surfaceLinePointEntity1);
+ entity.SurfaceLinePointEntities.Add(surfaceLinePointEntity2);
+
+ // Call
+ RingtoetsPipingSurfaceLine surfaceLine = entity.Read(collector);
+
+ // Assert
+ Assert.AreEqual(id, surfaceLine.StorageId);
+ Assert.AreEqual(name, surfaceLine.Name);
+ Assert.AreEqual(intersectionX, surfaceLine.ReferenceLineIntersectionWorldPoint.X);
+ Assert.AreEqual(intersectionY, surfaceLine.ReferenceLineIntersectionWorldPoint.Y);
+
+ Point3D[] geometry = surfaceLine.Points.ToArray();
+ Assert.AreEqual(2, geometry.Length);
+ Point3D geometryPoint = geometry[0];
+
+ Assert.AreSame(geometryPoint, surfaceLine.BottomDitchDikeSide);
+ Assert.AreSame(geometryPoint, surfaceLine.BottomDitchPolderSide);
+ Assert.AreSame(geometryPoint, surfaceLine.DikeToeAtPolder);
+ Assert.AreSame(geometryPoint, surfaceLine.DikeToeAtRiver);
+ Assert.AreSame(geometryPoint, surfaceLine.DitchDikeSide);
+ Assert.AreSame(geometryPoint, surfaceLine.DitchPolderSide);
+ }
+
+ [Test]
+ public void Read_SurfaceLineEntityReadMultipleTimes_ReturnSameSurfaceLine()
+ {
+ // Setup
+ var collector = new ReadConversionCollector();
+
+ const long id = 9348765;
+
+ var entity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = id
+ };
+
+ // Call
+ RingtoetsPipingSurfaceLine surfaceLine1 = entity.Read(collector);
+ RingtoetsPipingSurfaceLine surfaceLine2 = entity.Read(collector);
+
+ // Assert
+ Assert.AreSame(surfaceLine1, surfaceLine2);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/SurfaceLinePointEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/SurfaceLinePointEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/SurfaceLinePointEntityReadExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,96 @@
+// 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.Piping;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+namespace Application.Ringtoets.Storage.Test.Read.Piping
+{
+ [TestFixture]
+ public class SurfaceLinePointEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_ReadConversionCollectorIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var entity = new SurfaceLinePointEntity();
+
+ // Call
+ TestDelegate call = () => entity.Read(null);
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ [Test]
+ public void Read_ValidEntity_ReturnPoint3D()
+ {
+ // Setup
+ var collector = new ReadConversionCollector();
+
+ var entity = new SurfaceLinePointEntity
+ {
+ X = 1.1m,
+ Y = 3.3m,
+ Z = 5.5m,
+ SurfaceLinePointEntityId = 538246839
+ };
+
+ // Call
+ Point3D geometryPoint = entity.Read(collector);
+
+ // Assert
+ Assert.AreEqual(entity.X, geometryPoint.X);
+ Assert.AreEqual(entity.Y, geometryPoint.Y);
+ Assert.AreEqual(entity.Z, geometryPoint.Z);
+ Assert.AreEqual(entity.SurfaceLinePointEntityId, geometryPoint.StorageId);
+ }
+
+ [Test]
+ public void Read_ReadingSameEntityTwice_ReturnedInstanceAreIdentical()
+ {
+ // Setup
+ var collector = new ReadConversionCollector();
+
+ var entity = new SurfaceLinePointEntity
+ {
+ X = 1.1m,
+ Y = 3.3m,
+ Z = 5.5m,
+ SurfaceLinePointEntityId = 538246839
+ };
+
+ // Call
+ Point3D geometryPoint1 = entity.Read(collector);
+ Point3D geometryPoint2 = entity.Read(collector);
+
+ // Assert
+ Assert.AreSame(geometryPoint1, geometryPoint2);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/PipingCalculationEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/PipingCalculationOutputEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/PipingFailureMechanismMetaEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/PipingSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/PipingSemiProbabilisticOutputEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/PipingStructureSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/SoilLayerEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/SoilProfileEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StochasticSoilModelEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StochasticSoilModelSegmentPointEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StochasticSoilProfileEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/SurfaceLineEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/SurfaceLinePointEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/ClosingStructure/ClosingStructureFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/ClosingStructure/ClosingStructureFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/ClosingStructure/ClosingStructureFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,202 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.ClosingStructure;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Update.ClosingStructure
+{
+ [TestFixture]
+ public class ClosingStructureFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new ClosingStructureFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new ClosingStructureFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoClosingStructureSectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new ClosingStructureFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'ClosingStructureSectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoClosingStructureSectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new ClosingStructureFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.ClosingStructureSectionResultEntities.Add(new ClosingStructureSectionResultEntity
+ {
+ ClosingStructureSectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'ClosingStructureSectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithClosingStructureSectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new ClosingStructureFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerTwoA = (RoundedDouble) 0.4,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new ClosingStructureSectionResultEntity
+ {
+ ClosingStructureSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerTwoA = 2.1m,
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.ClosingStructureSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), sectionResultEntity.LayerOne);
+ Assert.AreEqual(sectionResult.AssessmentLayerTwoA.ToNullableDecimal(), sectionResultEntity.LayerTwoA);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new ClosingStructureFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerTwoA = (RoundedDouble)double.NaN,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new ClosingStructureSectionResultEntity
+ {
+ ClosingStructureSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerTwoA = 2.1m,
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.ClosingStructureSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerTwoA);
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/ClosingStructure/ClosingStructureFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/ClosingStructure/ClosingStructureFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/ClosingStructure/ClosingStructureFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,247 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.ClosingStructure;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Test.Update.ClosingStructure
+{
+ [TestFixture]
+ public class ClosingStructureFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new ClosingStructureFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new ClosingStructureFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoClosingStructureFailureMechanism_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new ClosingStructureFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoClosingStructureFailureMechanismWithId_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new ClosingStructureFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithClosingStructureFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new ClosingStructureFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true
+ };
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ IsRelevant = Convert.ToByte(false)
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new ClosingStructureFailureMechanism
+ {
+ StorageId = 1
+ };
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.ClosingStructureSectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new ClosingStructureFailureMechanism
+ {
+ StorageId = 1
+ };
+ var testName = "testName";
+ failureMechanism.AddSection(new FailureMechanismSection(testName, new[]
+ {
+ new Point2D(0, 0)
+ })
+ {
+ StorageId = 1
+ });
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = 1,
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.ClosingStructureSectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/ClosingStructureFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/ClosingStructureFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/DikeProfileUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/DuneErosion/DuneErosionFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/DuneErosion/DuneErosionFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/DuneErosion/DuneErosionFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,195 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.DuneErosion;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Update.DuneErosion
+{
+ [TestFixture]
+ public class DuneErosionFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new DuneErosionFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new DuneErosionFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoDuneErosionSectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new DuneErosionFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'DuneErosionSectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoDuneErosionSectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new DuneErosionFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.DuneErosionSectionResultEntities.Add(new DuneErosionSectionResultEntity
+ {
+ DuneErosionSectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'DuneErosionSectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithDuneErosionSectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new DuneErosionFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new DuneErosionSectionResultEntity
+ {
+ DuneErosionSectionResultEntityId = sectionResult.StorageId,
+ LayerTwoA = Convert.ToByte(AssessmentLayerTwoAResult.Successful),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.DuneErosionSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerTwoA), sectionResultEntity.LayerTwoA);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new DuneErosionFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new DuneErosionSectionResultEntity
+ {
+ DuneErosionSectionResultEntityId = sectionResult.StorageId,
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.DuneErosionSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/DuneErosion/DuneErosionFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/DuneErosion/DuneErosionFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/DuneErosion/DuneErosionFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,247 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.DuneErosion;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Test.Update.DuneErosion
+{
+ [TestFixture]
+ public class DuneErosionFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new DuneErosionFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new DuneErosionFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoDuneErosionFailureMechanism_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new DuneErosionFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoDuneErosionFailureMechanismWithId_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new DuneErosionFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithDuneErosionFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new DuneErosionFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true
+ };
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ IsRelevant = Convert.ToByte(false)
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new DuneErosionFailureMechanism
+ {
+ StorageId = 1
+ };
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.DuneErosionSectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new DuneErosionFailureMechanism
+ {
+ StorageId = 1
+ };
+ var testName = "testName";
+ failureMechanism.AddSection(new FailureMechanismSection(testName, new[]
+ {
+ new Point2D(0, 0)
+ })
+ {
+ StorageId = 1
+ });
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = 1,
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.DuneErosionSectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/DuneErosionFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/DuneErosionFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GeneralGrassCoverErosionInwardsInputUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwards/DikeProfileUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwards/DikeProfileUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwards/DikeProfileUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,178 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.GrassCoverErosionInwards;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Application.Ringtoets.Storage.Test.Update.GrassCoverErosionInwards
+{
+ [TestFixture]
+ public class DikeProfileUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_PersistenceRegistryNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var ringtoetsEntities = mocks.Stub();
+ mocks.ReplayAll();
+
+ DikeProfile profile = CreateSimpleDikeProfile();
+
+ // Call
+ TestDelegate call = () => profile.Update(null, ringtoetsEntities);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("registry", paramName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_RingtoetsEntitiesNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var registry = new PersistenceRegistry();
+ DikeProfile profile = CreateSimpleDikeProfile();
+
+ // Call
+ TestDelegate call = () => profile.Update(registry, null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoDikeProfileEntity_ThrowEntityNotFoundException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ IRingtoetsEntities ringtoetsEntitites = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var registry = new PersistenceRegistry();
+ DikeProfile profile = CreateSimpleDikeProfile();
+
+ // Call
+ TestDelegate call = () => profile.Update(registry, ringtoetsEntitites);
+
+ // Assert
+ string expectedMessage = string.Format("Het object 'DikeProfileEntity' met id '{0}' is niet gevonden.",
+ profile.StorageId);
+ var exception = Assert.Throws(call);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNoDikeProfileEntityWithId_ThrowEntityNotFoundException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ IRingtoetsEntities ringtoetsEntitites = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var registry = new PersistenceRegistry();
+ DikeProfile profile = CreateSimpleDikeProfile();
+
+ ringtoetsEntitites.DikeProfileEntities.Add(new DikeProfileEntity
+ {
+ DikeProfileEntityId = 1
+ });
+
+ // Call
+ TestDelegate call = () => profile.Update(registry, ringtoetsEntitites);
+
+ // Assert
+ string expectedMessage = string.Format("Het object 'DikeProfileEntity' met id '{0}' is niet gevonden.",
+ profile.StorageId);
+ var exception = Assert.Throws(call);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithOrphanEntity_OrphanIsUntouchedOnUpdate()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ IRingtoetsEntities ringtoetsEntitites = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var registry = new PersistenceRegistry();
+ DikeProfile profile = CreateSimpleDikeProfile();
+
+ var orphanedEntity = new DikeProfileEntity
+ {
+ DikeProfileEntityId = 1
+ };
+ var persistentEntity = new DikeProfileEntity
+ {
+ DikeProfileEntityId = profile.StorageId
+ };
+
+ ringtoetsEntitites.DikeProfileEntities.Add(orphanedEntity);
+ ringtoetsEntitites.DikeProfileEntities.Add(persistentEntity);
+
+ // Call
+ profile.Update(registry, ringtoetsEntitites);
+
+ // Assert
+ registry.RemoveUntouched(ringtoetsEntitites);
+ CollectionAssert.Contains(ringtoetsEntitites.DikeProfileEntities, persistentEntity);
+ CollectionAssert.DoesNotContain(ringtoetsEntitites.DikeProfileEntities, orphanedEntity);
+ mocks.VerifyAll();
+ }
+
+ private static DikeProfile CreateSimpleDikeProfile()
+ {
+ return new DikeProfile(new Point2D(0, 0),
+ new[]
+ {
+ new RoughnessPoint(new Point2D(1, 2), 0.75),
+ new RoughnessPoint(new Point2D(3, 4), 0.75)
+ },
+ new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 2)
+ },
+ null, new DikeProfile.ConstructionProperties())
+ {
+ StorageId = 49654
+ };
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,162 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.GrassCoverErosionInwards;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Application.Ringtoets.Storage.Test.Update.GrassCoverErosionInwards
+{
+ [TestFixture]
+ public class GeneralGrassCoverErosionInwardsInputUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_RingtoetsEntitiesIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var input = new GeneralGrassCoverErosionInwardsInput();
+ var registry = new PersistenceRegistry();
+
+ // Call
+ TestDelegate call = () => input.Update(registry, null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_PersistenceRegistryIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var ringtoetsEntities = mocks.Stub();
+ mocks.ReplayAll();
+
+ var input = new GeneralGrassCoverErosionInwardsInput();
+
+ // Call
+ TestDelegate call = () => input.Update(null, ringtoetsEntities);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("registry", paramName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithoutGrassCoverErosionInwardsFailureMechanismMetaEntity_EntityNotFoundException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var ringtoetsEntities = mocks.Stub();
+ mocks.ReplayAll();
+
+ var registry = new PersistenceRegistry();
+
+ var input = new GeneralGrassCoverErosionInwardsInput();
+
+ // Call
+ TestDelegate call = () => input.Update(registry, ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'GrassCoverErosionInwardsFailureMechanismMetaEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(call);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoGrassCoverErosionInwardsFailureMechanismMetaEntityWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var input = new GeneralGrassCoverErosionInwardsInput
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.GrassCoverErosionInwardsFailureMechanismMetaEntities.Add(new GrassCoverErosionInwardsFailureMechanismMetaEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => input.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'GrassCoverErosionInwardsFailureMechanismMetaEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithGrassCoverErosionInwardsFailureMechanismMetaEntity_PropertiesUpdated(
+ [Random(1, 20, 1)]int n)
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ const int storageId = 1;
+ var input = new GeneralGrassCoverErosionInwardsInput
+ {
+ N = n,
+ StorageId = storageId
+ };
+
+ var entity = new GrassCoverErosionInwardsFailureMechanismMetaEntity
+ {
+ GrassCoverErosionInwardsFailureMechanismMetaEntityId = input.StorageId,
+ };
+ ringtoetsEntities.GrassCoverErosionInwardsFailureMechanismMetaEntities.Add(entity);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ input.Update(registry, ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(n, entity.N);
+
+ registry.RemoveUntouched(ringtoetsEntities);
+ CollectionAssert.Contains(ringtoetsEntities.GrassCoverErosionInwardsFailureMechanismMetaEntities, entity);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,196 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.GrassCoverErosionInwards;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Application.Ringtoets.Storage.Test.Update.GrassCoverErosionInwards
+{
+ [TestFixture]
+ public class GrassCoverErosionInwardsFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoCoverErosionInwardsSectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'GrassCoverErosionInwardsSectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoCoverErosionInwardsSectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.GrassCoverErosionInwardsSectionResultEntities.Add(new GrassCoverErosionInwardsSectionResultEntity
+ {
+ GrassCoverErosionInwardsSectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'GrassCoverErosionInwardsSectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithGrassCoverErosionInwardsSectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new GrassCoverErosionInwardsSectionResultEntity
+ {
+ GrassCoverErosionInwardsSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.GrassCoverErosionInwardsSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), sectionResultEntity.LayerOne);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new GrassCoverErosionInwardsSectionResultEntity
+ {
+ GrassCoverErosionInwardsSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.GrassCoverErosionInwardsSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,586 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.GrassCoverErosionInwards;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Application.Ringtoets.Storage.Test.Update.GrassCoverErosionInwards
+{
+ [TestFixture]
+ public class GrassCoverErosionInwardsFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoGrassCoverErosionInwardsFailureMechanism_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoGrassCoverErosionInwardsFailureMechanismWithId_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithGrassCoverErosionInwardsFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true,
+ GeneralInput =
+ {
+ StorageId = 62981,
+ N = 13
+ },
+ CalculationsGroup =
+ {
+ StorageId = 209
+ }
+ };
+
+ var generalInputEntity = new GrassCoverErosionInwardsFailureMechanismMetaEntity
+ {
+ GrassCoverErosionInwardsFailureMechanismMetaEntityId = failureMechanism.GeneralInput.StorageId,
+ N = 2
+ };
+ var rootCalculationGroup = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = failureMechanism.CalculationsGroup.StorageId
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = failureMechanism.StorageId,
+ IsRelevant = Convert.ToByte(false),
+ GrassCoverErosionInwardsFailureMechanismMetaEntities =
+ {
+ generalInputEntity
+ },
+ CalculationGroupEntity = rootCalculationGroup
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(rootCalculationGroup);
+ ringtoetsEntities.GrassCoverErosionInwardsFailureMechanismMetaEntities.Add(generalInputEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+ Assert.AreEqual(failureMechanism.GeneralInput.N, generalInputEntity.N);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewDikeProfiles_DikeProfilesAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism
+ {
+ StorageId = 1,
+ GeneralInput =
+ {
+ StorageId = 2
+ },
+ DikeProfiles =
+ {
+ new DikeProfile(new Point2D(0, 0),
+ new[]
+ {
+ new RoughnessPoint(new Point2D(0, 0), 1),
+ new RoughnessPoint(new Point2D(1, 1), 1)
+ },
+ new Point2D[0], null, new DikeProfile.ConstructionProperties()),
+ new DikeProfile(new Point2D(2, 2),
+ new[]
+ {
+ new RoughnessPoint(new Point2D(3, 3), 1),
+ new RoughnessPoint(new Point2D(4, 4), 1)
+ },
+ new Point2D[0], null, new DikeProfile.ConstructionProperties())
+ },
+ CalculationsGroup =
+ {
+ StorageId = 765
+ }
+ };
+
+ var rootGroupEntity = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = failureMechanism.CalculationsGroup.StorageId
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = failureMechanism.StorageId,
+ CalculationGroupEntity = rootGroupEntity
+ };
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(rootGroupEntity);
+ ringtoetsEntities.GrassCoverErosionInwardsFailureMechanismMetaEntities.Add(new GrassCoverErosionInwardsFailureMechanismMetaEntity
+ {
+ GrassCoverErosionInwardsFailureMechanismMetaEntityId = failureMechanism.GeneralInput.StorageId
+ });
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(2, failureMechanismEntity.DikeProfileEntities.Count);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedDikeProfiles_NoNewDikeProfilesAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism
+ {
+ StorageId = 1,
+ GeneralInput =
+ {
+ StorageId = 2
+ },
+ DikeProfiles =
+ {
+ new DikeProfile(new Point2D(0, 0),
+ new[]
+ {
+ new RoughnessPoint(new Point2D(0, 0), 1),
+ new RoughnessPoint(new Point2D(1, 1), 1)
+ },
+ new Point2D[0], null, new DikeProfile.ConstructionProperties())
+ {
+ StorageId = 3
+ },
+ new DikeProfile(new Point2D(2, 2),
+ new[]
+ {
+ new RoughnessPoint(new Point2D(3, 3), 1),
+ new RoughnessPoint(new Point2D(4, 4), 1)
+ },
+ new Point2D[0], null, new DikeProfile.ConstructionProperties())
+ {
+ StorageId = 4
+ }
+ },
+ CalculationsGroup =
+ {
+ StorageId = 405986
+ }
+ };
+
+ var rootGroupEntity = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = failureMechanism.CalculationsGroup.StorageId
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = failureMechanism.StorageId,
+ CalculationGroupEntity = rootGroupEntity
+ };
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(rootGroupEntity);
+ ringtoetsEntities.GrassCoverErosionInwardsFailureMechanismMetaEntities.Add(new GrassCoverErosionInwardsFailureMechanismMetaEntity
+ {
+ GrassCoverErosionInwardsFailureMechanismMetaEntityId = failureMechanism.GeneralInput.StorageId
+ });
+ ringtoetsEntities.DikeProfileEntities.Add(new DikeProfileEntity
+ {
+ DikeProfileEntityId = failureMechanism.DikeProfiles[0].StorageId,
+ Name = "A"
+ });
+ ringtoetsEntities.DikeProfileEntities.Add(new DikeProfileEntity
+ {
+ DikeProfileEntityId = failureMechanism.DikeProfiles[1].StorageId,
+ Name = "B"
+ });
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(2, ringtoetsEntities.DikeProfileEntities.Count());
+ Assert.AreEqual("A", ringtoetsEntities.DikeProfileEntities.ElementAt(0).Name);
+ Assert.AreEqual("B", ringtoetsEntities.DikeProfileEntities.ElementAt(1).Name);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism
+ {
+ StorageId = 1,
+ GeneralInput =
+ {
+ StorageId = 2
+ },
+ CalculationsGroup =
+ {
+ StorageId = 30495
+ }
+ };
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+
+ var rootGroupEntity = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = failureMechanism.CalculationsGroup.StorageId
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = failureMechanism.StorageId,
+ CalculationGroupEntity = rootGroupEntity
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(rootGroupEntity);
+ ringtoetsEntities.GrassCoverErosionInwardsFailureMechanismMetaEntities.Add(new GrassCoverErosionInwardsFailureMechanismMetaEntity
+ {
+ GrassCoverErosionInwardsFailureMechanismMetaEntityId = failureMechanism.GeneralInput.StorageId
+ });
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverErosionInwardsSectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism
+ {
+ StorageId = 1,
+ GeneralInput =
+ {
+ StorageId = 2
+ },
+ CalculationsGroup =
+ {
+ StorageId = 4968
+ }
+ };
+ var testName = "testName";
+ failureMechanism.AddSection(new FailureMechanismSection(testName, new[]
+ {
+ new Point2D(0, 0)
+ })
+ {
+ StorageId = 1
+ });
+
+ var rootGroupEntity = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = failureMechanism.CalculationsGroup.StorageId
+ };
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = 1
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ },
+ CalculationGroupEntity = rootGroupEntity
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(rootGroupEntity);
+ ringtoetsEntities.GrassCoverErosionInwardsFailureMechanismMetaEntities.Add(new GrassCoverErosionInwardsFailureMechanismMetaEntity
+ {
+ GrassCoverErosionInwardsFailureMechanismMetaEntityId = failureMechanism.GeneralInput.StorageId
+ });
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverErosionInwardsSectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewCalculationGroup_CalculationGroupEntityAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism
+ {
+ StorageId = 1,
+ CalculationsGroup =
+ {
+ StorageId = 1
+ },
+ GeneralInput =
+ {
+ StorageId = 2
+ }
+ };
+ var newCalculationGroup = new CalculationGroup
+ {
+ Name = "new group"
+ };
+ failureMechanism.CalculationsGroup.Children.Add(newCalculationGroup);
+
+ var rootCalculationGroupEntity = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = failureMechanism.CalculationsGroup.StorageId,
+ Name = "Berekeningen",
+ IsEditable = 0,
+ Order = 0
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = failureMechanism.StorageId,
+ CalculationGroupEntity = rootCalculationGroupEntity
+ };
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(rootCalculationGroupEntity);
+ ringtoetsEntities.GrassCoverErosionInwardsFailureMechanismMetaEntities.Add(new GrassCoverErosionInwardsFailureMechanismMetaEntity
+ {
+ GrassCoverErosionInwardsFailureMechanismMetaEntityId = failureMechanism.GeneralInput.StorageId,
+ FailureMechanismEntityId = failureMechanism.StorageId
+ });
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ failureMechanism.Update(registry, ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, rootCalculationGroupEntity.CalculationGroupEntity1.Count);
+ CalculationGroupEntity newlyAddedGroupEntity = rootCalculationGroupEntity.CalculationGroupEntity1.First();
+ Assert.AreEqual(newCalculationGroup.Name, newlyAddedGroupEntity.Name);
+ Assert.AreEqual(1, newlyAddedGroupEntity.IsEditable);
+ Assert.AreEqual(0, newlyAddedGroupEntity.Order);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUnchangedCalculationGroup_NoNewCalculationGroupEntityAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism
+ {
+ StorageId = 1,
+ CalculationsGroup =
+ {
+ StorageId = 1
+ },
+ GeneralInput =
+ {
+ StorageId = 1
+ }
+ };
+ var alreadySavedChildGroup = new CalculationGroup
+ {
+ Name = "saved child group",
+ StorageId = 2
+ };
+ failureMechanism.CalculationsGroup.Children.Add(alreadySavedChildGroup);
+
+ var childGroupEntity = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = alreadySavedChildGroup.StorageId,
+ Name = alreadySavedChildGroup.Name,
+ IsEditable = 1,
+ Order = 0
+ };
+ var rootCalculationGroupEntity = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = failureMechanism.CalculationsGroup.StorageId,
+ Name = "Berekeningen",
+ IsEditable = 0,
+ Order = 0,
+ CalculationGroupEntity1 =
+ {
+ childGroupEntity
+ }
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = failureMechanism.StorageId,
+ CalculationGroupEntity = rootCalculationGroupEntity
+ };
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(rootCalculationGroupEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(childGroupEntity);
+ ringtoetsEntities.GrassCoverErosionInwardsFailureMechanismMetaEntities.Add(new GrassCoverErosionInwardsFailureMechanismMetaEntity
+ {
+ GrassCoverErosionInwardsFailureMechanismMetaEntityId = failureMechanism.GeneralInput.StorageId,
+ FailureMechanismEntityId = failureMechanism.StorageId
+ });
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ failureMechanism.Update(registry, ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, rootCalculationGroupEntity.CalculationGroupEntity1.Count);
+ CalculationGroupEntity retainedCalculationGroupEntity = rootCalculationGroupEntity.CalculationGroupEntity1.First();
+ Assert.AreEqual(alreadySavedChildGroup.Name, retainedCalculationGroupEntity.Name);
+ Assert.AreEqual(1, retainedCalculationGroupEntity.IsEditable);
+ Assert.AreEqual(0, retainedCalculationGroupEntity.Order);
+ Assert.AreEqual(alreadySavedChildGroup.StorageId, retainedCalculationGroupEntity.CalculationGroupEntityId);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwardsFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwardsFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,200 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.GrassCoverErosionOutwards;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Update.GrassCoverErosionOutwards
+{
+ [TestFixture]
+ public class GrassCoverErosionOutwardsFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new GrassCoverErosionOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new GrassCoverErosionOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoGrassCoverErosionOutwardsSectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new GrassCoverErosionOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'GrassCoverErosionOutwardsSectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoGrassCoverErosionOutwardsSectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new GrassCoverErosionOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.GrassCoverErosionOutwardsSectionResultEntities.Add(new GrassCoverErosionOutwardsSectionResultEntity
+ {
+ GrassCoverErosionOutwardsSectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'GrassCoverErosionOutwardsSectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithGrassCoverErosionOutwardsSectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new GrassCoverErosionOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new GrassCoverErosionOutwardsSectionResultEntity
+ {
+ GrassCoverErosionOutwardsSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerTwoA = Convert.ToByte(AssessmentLayerTwoAResult.Successful),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.GrassCoverErosionOutwardsSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), sectionResultEntity.LayerOne);
+ Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerTwoA), sectionResultEntity.LayerTwoA);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new GrassCoverErosionOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new GrassCoverErosionOutwardsSectionResultEntity
+ {
+ GrassCoverErosionOutwardsSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.GrassCoverErosionOutwardsSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,247 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.GrassCoverErosionOutwards;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Test.Update.GrassCoverErosionOutwards
+{
+ [TestFixture]
+ public class GrassCoverErosionOutwardsFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoGrassCoverErosionOutwardsFailureMechanism_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoGrassCoverErosionOutwardsFailureMechanismWithId_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithGrassCoverErosionOutwardsFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true
+ };
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ IsRelevant = Convert.ToByte(false)
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism
+ {
+ StorageId = 1
+ };
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverErosionOutwardsSectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism
+ {
+ StorageId = 1
+ };
+ var testName = "testName";
+ failureMechanism.AddSection(new FailureMechanismSection(testName, new[]
+ {
+ new Point2D(0, 0)
+ })
+ {
+ StorageId = 1
+ });
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = 1,
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverErosionOutwardsSectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionOutwardsFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionOutwardsFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,200 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.GrassCoverSlipOffInwards;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Update.GrassCoverSlipOffInwards
+{
+ [TestFixture]
+ public class GrassCoverSlipOffInwardsFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new GrassCoverSlipOffInwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new GrassCoverSlipOffInwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoGrassCoverSlipOffInwardsSectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new GrassCoverSlipOffInwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'GrassCoverSlipOffInwardsSectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoGrassCoverSlipOffInwardsSectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new GrassCoverSlipOffInwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.GrassCoverSlipOffInwardsSectionResultEntities.Add(new GrassCoverSlipOffInwardsSectionResultEntity
+ {
+ GrassCoverSlipOffInwardsSectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'GrassCoverSlipOffInwardsSectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithGrassCoverSlipOffInwardsSectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new GrassCoverSlipOffInwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new GrassCoverSlipOffInwardsSectionResultEntity
+ {
+ GrassCoverSlipOffInwardsSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerTwoA = Convert.ToByte(AssessmentLayerTwoAResult.Successful),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.GrassCoverSlipOffInwardsSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), sectionResultEntity.LayerOne);
+ Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerTwoA), sectionResultEntity.LayerTwoA);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new GrassCoverSlipOffInwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new GrassCoverSlipOffInwardsSectionResultEntity
+ {
+ GrassCoverSlipOffInwardsSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.GrassCoverSlipOffInwardsSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,247 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.GrassCoverSlipOffInwards;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Test.Update.GrassCoverSlipOffInwards
+{
+ [TestFixture]
+ public class GrassCoverSlipOffInwardsFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoGrassCoverSlipOffInwardsFailureMechanism_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoGrassCoverSlipOffInwardsFailureMechanismWithId_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithGrassCoverSlipOffInwardsFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true
+ };
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ IsRelevant = Convert.ToByte(false)
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism
+ {
+ StorageId = 1
+ };
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverSlipOffInwardsSectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism
+ {
+ StorageId = 1
+ };
+ var testName = "testName";
+ failureMechanism.AddSection(new FailureMechanismSection(testName, new[]
+ {
+ new Point2D(0, 0)
+ })
+ {
+ StorageId = 1
+ });
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = 1,
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverSlipOffInwardsSectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverSlipOffInwardsFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverSlipOffInwardsFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,200 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.GrassCoverSlipOffOutwards;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Update.GrassCoverSlipOffOutwards
+{
+ [TestFixture]
+ public class GrassCoverSlipOffOutwardsFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoGrassCoverSlipOffOutwardsSectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'GrassCoverSlipOffOutwardsSectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoGrassCoverSlipOffOutwardsSectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.GrassCoverSlipOffOutwardsSectionResultEntities.Add(new GrassCoverSlipOffOutwardsSectionResultEntity
+ {
+ GrassCoverSlipOffOutwardsSectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'GrassCoverSlipOffOutwardsSectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithGrassCoverSlipOffOutwardsSectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new GrassCoverSlipOffOutwardsSectionResultEntity
+ {
+ GrassCoverSlipOffOutwardsSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerTwoA = Convert.ToByte(AssessmentLayerTwoAResult.Successful),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.GrassCoverSlipOffOutwardsSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), sectionResultEntity.LayerOne);
+ Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerTwoA), sectionResultEntity.LayerTwoA);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new GrassCoverSlipOffOutwardsSectionResultEntity
+ {
+ GrassCoverSlipOffOutwardsSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.GrassCoverSlipOffOutwardsSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,247 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.GrassCoverSlipOffOutwards;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Test.Update.GrassCoverSlipOffOutwards
+{
+ [TestFixture]
+ public class GrassCoverSlipOffOutwardsFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoGrassCoverSlipOffOutwardsFailureMechanism_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoGrassCoverSlipOffOutwardsFailureMechanismWithId_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithGrassCoverSlipOffOutwardsFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true
+ };
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ IsRelevant = Convert.ToByte(false)
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism
+ {
+ StorageId = 1
+ };
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverSlipOffOutwardsSectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism
+ {
+ StorageId = 1
+ };
+ var testName = "testName";
+ failureMechanism.AddSection(new FailureMechanismSection(testName, new[]
+ {
+ new Point2D(0, 0)
+ })
+ {
+ StorageId = 1
+ });
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = 1,
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverSlipOffOutwardsSectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverSlipOffOutwardsFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverSlipOffOutwardsFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/HeightStructures/HeightStructuresFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/HeightStructures/HeightStructuresFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/HeightStructures/HeightStructuresFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,196 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.HeightStructures;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.HeightStructures.Data;
+
+namespace Application.Ringtoets.Storage.Test.Update.HeightStructures
+{
+ [TestFixture]
+ public class HeightStructuresFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new HeightStructuresFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new HeightStructuresFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoHeightStructuresSectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new HeightStructuresFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'HeightStructuresSectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoHeightStructuresSectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new HeightStructuresFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.HeightStructuresSectionResultEntities.Add(new HeightStructuresSectionResultEntity
+ {
+ HeightStructuresSectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'HeightStructuresSectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithHeightStructuresSectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new HeightStructuresFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new HeightStructuresSectionResultEntity
+ {
+ HeightStructuresSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.HeightStructuresSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), sectionResultEntity.LayerOne);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new HeightStructuresFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new HeightStructuresSectionResultEntity
+ {
+ HeightStructuresSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.HeightStructuresSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/HeightStructures/HeightStructuresFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/HeightStructures/HeightStructuresFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/HeightStructures/HeightStructuresFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,247 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.HeightStructures;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.HeightStructures.Data;
+
+namespace Application.Ringtoets.Storage.Test.Update.HeightStructures
+{
+ [TestFixture]
+ public class HeightStructuresFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new HeightStructuresFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new HeightStructuresFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoHeightStructuresFailureMechanism_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new HeightStructuresFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoHeightStructuresFailureMechanismWithId_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new HeightStructuresFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithHeightStructuresFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new HeightStructuresFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true
+ };
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ IsRelevant = Convert.ToByte(false)
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new HeightStructuresFailureMechanism
+ {
+ StorageId = 1
+ };
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.HeightStructuresSectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new HeightStructuresFailureMechanism
+ {
+ StorageId = 1
+ };
+ var testName = "testName";
+ failureMechanism.AddSection(new FailureMechanismSection(testName, new[]
+ {
+ new Point2D(0, 0)
+ })
+ {
+ StorageId = 1
+ });
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = 1,
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.HeightStructuresSectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/HeightStructuresFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/HeightStructuresFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,202 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.MacrostabilityInwards;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Update.MacrostabilityInwards
+{
+ [TestFixture]
+ public class MacrostabilityInwardsFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new MacrostabilityInwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new MacrostabilityInwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoMacrostabilityInwardsSectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new MacrostabilityInwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'MacrostabilityInwardsSectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoMacrostabilityInwardsSectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new MacrostabilityInwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.MacrostabilityInwardsSectionResultEntities.Add(new MacrostabilityInwardsSectionResultEntity
+ {
+ MacrostabilityInwardsSectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'MacrostabilityInwardsSectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithMacrostabilityInwardsSectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new MacrostabilityInwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerTwoA = (RoundedDouble) 0.4,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new MacrostabilityInwardsSectionResultEntity
+ {
+ MacrostabilityInwardsSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerTwoA = 2.1m,
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.MacrostabilityInwardsSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), sectionResultEntity.LayerOne);
+ Assert.AreEqual(sectionResult.AssessmentLayerTwoA.ToNullableDecimal(), sectionResultEntity.LayerTwoA);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new MacrostabilityInwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerTwoA = (RoundedDouble)double.NaN,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new MacrostabilityInwardsSectionResultEntity
+ {
+ MacrostabilityInwardsSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerTwoA = 2.1m,
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.MacrostabilityInwardsSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerTwoA);
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,247 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.MacrostabilityInwards;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Test.Update.MacrostabilityInwards
+{
+ [TestFixture]
+ public class MacrostabilityInwardsFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new MacrostabilityInwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new MacrostabilityInwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoMacrostabilityInwardsFailureMechanism_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new MacrostabilityInwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoMacrostabilityInwardsFailureMechanismWithId_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new MacrostabilityInwardsFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithMacrostabilityInwardsFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new MacrostabilityInwardsFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true
+ };
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ IsRelevant = Convert.ToByte(false)
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new MacrostabilityInwardsFailureMechanism
+ {
+ StorageId = 1
+ };
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.MacrostabilityInwardsSectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new MacrostabilityInwardsFailureMechanism
+ {
+ StorageId = 1
+ };
+ var testName = "testName";
+ failureMechanism.AddSection(new FailureMechanismSection(testName, new[]
+ {
+ new Point2D(0, 0)
+ })
+ {
+ StorageId = 1
+ });
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = 1,
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.MacrostabilityInwardsSectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MacrostabilityInwardsFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MacrostabilityInwardsFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,202 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.MacrostabilityOutwards;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Update.MacrostabilityOutwards
+{
+ [TestFixture]
+ public class MacrostabilityOutwardsFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new MacrostabilityOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new MacrostabilityOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoMacrostabilityOutwardsSectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new MacrostabilityOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'MacrostabilityOutwardsSectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoMacrostabilityOutwardsSectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new MacrostabilityOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.MacrostabilityOutwardsSectionResultEntities.Add(new MacrostabilityOutwardsSectionResultEntity
+ {
+ MacrostabilityOutwardsSectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'MacrostabilityOutwardsSectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithMacrostabilityOutwardsSectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new MacrostabilityOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerTwoA = (RoundedDouble) 0.4,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new MacrostabilityOutwardsSectionResultEntity
+ {
+ MacrostabilityOutwardsSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerTwoA = 2.1m,
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.MacrostabilityOutwardsSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), sectionResultEntity.LayerOne);
+ Assert.AreEqual(sectionResult.AssessmentLayerTwoA.ToNullableDecimal(), sectionResultEntity.LayerTwoA);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new MacrostabilityOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerTwoA = (RoundedDouble)double.NaN,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new MacrostabilityOutwardsSectionResultEntity
+ {
+ MacrostabilityOutwardsSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerTwoA = 2.1m,
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.MacrostabilityOutwardsSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerTwoA);
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,247 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.MacrostabilityOutwards;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Test.Update.MacrostabilityOutwards
+{
+ [TestFixture]
+ public class MacrostabilityOutwardsFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new MacrostabilityOutwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new MacrostabilityOutwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoMacrostabilityOutwardsFailureMechanism_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new MacrostabilityOutwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoMacrostabilityOutwardsFailureMechanismWithId_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new MacrostabilityOutwardsFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithMacrostabilityOutwardsFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new MacrostabilityOutwardsFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true
+ };
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ IsRelevant = Convert.ToByte(false)
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new MacrostabilityOutwardsFailureMechanism
+ {
+ StorageId = 1
+ };
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.MacrostabilityOutwardsSectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new MacrostabilityOutwardsFailureMechanism
+ {
+ StorageId = 1
+ };
+ var testName = "testName";
+ failureMechanism.AddSection(new FailureMechanismSection(testName, new[]
+ {
+ new Point2D(0, 0)
+ })
+ {
+ StorageId = 1
+ });
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = 1,
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.MacrostabilityOutwardsSectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MacrostabilityOutwardsFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MacrostabilityOutwardsFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Microstability/MicrostabilityFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Microstability/MicrostabilityFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Microstability/MicrostabilityFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,200 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.Microstability;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Update.Microstability
+{
+ [TestFixture]
+ public class MicrostabilityFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new MicrostabilityFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new MicrostabilityFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoMicrostabilitySectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new MicrostabilityFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'MicrostabilitySectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoMicrostabilitySectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new MicrostabilityFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.MicrostabilitySectionResultEntities.Add(new MicrostabilitySectionResultEntity
+ {
+ MicrostabilitySectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'MicrostabilitySectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithMicrostabilitySectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new MicrostabilityFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new MicrostabilitySectionResultEntity
+ {
+ MicrostabilitySectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerTwoA = Convert.ToByte(AssessmentLayerTwoAResult.Successful),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.MicrostabilitySectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), sectionResultEntity.LayerOne);
+ Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerTwoA), sectionResultEntity.LayerTwoA);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new MicrostabilityFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new MicrostabilitySectionResultEntity
+ {
+ MicrostabilitySectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.MicrostabilitySectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Microstability/MicrostabilityFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Microstability/MicrostabilityFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Microstability/MicrostabilityFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,247 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.Microstability;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Test.Update.Microstability
+{
+ [TestFixture]
+ public class MicrostabilityFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new MicrostabilityFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new MicrostabilityFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoMicrostabilityFailureMechanism_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new MicrostabilityFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoMicrostabilityFailureMechanismWithId_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new MicrostabilityFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithMicrostabilityFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new MicrostabilityFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true
+ };
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ IsRelevant = Convert.ToByte(false)
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new MicrostabilityFailureMechanism
+ {
+ StorageId = 1
+ };
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.MicrostabilitySectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new MicrostabilityFailureMechanism
+ {
+ StorageId = 1
+ };
+ var testName = "testName";
+ failureMechanism.AddSection(new FailureMechanismSection(testName, new[]
+ {
+ new Point2D(0, 0)
+ })
+ {
+ StorageId = 1
+ });
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = 1,
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.MicrostabilitySectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MicrostabilityFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/MicrostabilityFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingCalculationScenarioUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingCalculationScenarioUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingCalculationScenarioUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,961 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.Piping;
+
+using Core.Common.Base.Data;
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.HydraRing.Data;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Test.Update.Piping
+{
+ [TestFixture]
+ public class PipingCalculationScenarioUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_PersistenceRegistryIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var calculation = new PipingCalculationScenario(new GeneralPipingInput());
+
+ // Call
+ TestDelegate call = () => calculation.Update(null, context);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("registry", paramName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_RingtoetsEntitiesIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var calculation = new PipingCalculationScenario(new GeneralPipingInput());
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ TestDelegate call = () => calculation.Update(registry, null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_PipingCalculationScenarioNotSavedYet_ThrowEntityNotFoundException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var registry = new PersistenceRegistry();
+
+ var calculation = new PipingCalculationScenario(new GeneralPipingInput());
+
+ // Call
+ TestDelegate call = () => calculation.Update(registry, context);
+
+ // Assert
+ Assert.Throws(call);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_PipingCalculationScenarioChanged_EntityUpdated()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var entity = new PipingCalculationEntity
+ {
+ PipingCalculationEntityId = 456
+ };
+ context.PipingCalculationEntities.Add(entity);
+
+ var registry = new PersistenceRegistry();
+
+ var calculation = new PipingCalculationScenario(new GeneralPipingInput())
+ {
+ StorageId = entity.PipingCalculationEntityId,
+ IsRelevant = true,
+ Contribution = (RoundedDouble)0.56,
+ Name = "New name!",
+ Comments = "Better comments!",
+ InputParameters =
+ {
+ EntryPointL = (RoundedDouble)1.1,
+ ExitPointL = (RoundedDouble)2.2,
+ PhreaticLevelExit =
+ {
+ Mean = (RoundedDouble)3.3,
+ StandardDeviation = (RoundedDouble) 4.4
+ },
+ DampingFactorExit =
+ {
+ Mean = (RoundedDouble)5.5,
+ StandardDeviation = (RoundedDouble)6.6
+ },
+ SaturatedVolumicWeightOfCoverageLayer =
+ {
+ Mean = (RoundedDouble)7.7,
+ StandardDeviation = (RoundedDouble)8.8,
+ Shift = (RoundedDouble)9.9
+ },
+ Diameter70 =
+ {
+ Mean = (RoundedDouble)10.10,
+ StandardDeviation = (RoundedDouble)11.11
+ },
+ DarcyPermeability =
+ {
+ Mean = (RoundedDouble)12.12,
+ StandardDeviation = (RoundedDouble)13.13
+ }
+ }
+ };
+
+ // Call
+ calculation.Update(registry, context);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(calculation.IsRelevant), entity.RelevantForScenario);
+ Assert.AreEqual(Convert.ToDecimal(calculation.Contribution), entity.ScenarioContribution);
+ Assert.AreEqual(calculation.Name, entity.Name);
+ Assert.AreEqual(calculation.Comments, entity.Comments);
+
+ PipingInput inputParameters = calculation.InputParameters;
+ Assert.AreEqual(inputParameters.EntryPointL.Value.ToNullableDecimal(), entity.EntryPointL);
+ Assert.AreEqual(inputParameters.ExitPointL.Value.ToNullableDecimal(), entity.ExitPointL);
+
+ Assert.AreEqual(inputParameters.PhreaticLevelExit.Mean.Value, entity.PhreaticLevelExitMean);
+ Assert.AreEqual(inputParameters.PhreaticLevelExit.StandardDeviation.Value, entity.PhreaticLevelExitStandardDeviation);
+ Assert.AreEqual(inputParameters.DampingFactorExit.Mean.Value, entity.DampingFactorExitMean);
+ Assert.AreEqual(inputParameters.DampingFactorExit.StandardDeviation.Value, entity.DampingFactorExitStandardDeviation);
+ Assert.AreEqual(inputParameters.SaturatedVolumicWeightOfCoverageLayer.Mean.Value, entity.SaturatedVolumicWeightOfCoverageLayerMean);
+ Assert.AreEqual(inputParameters.SaturatedVolumicWeightOfCoverageLayer.StandardDeviation.Value, entity.SaturatedVolumicWeightOfCoverageLayerStandardDeviation);
+ Assert.AreEqual(inputParameters.SaturatedVolumicWeightOfCoverageLayer.Shift.Value, entity.SaturatedVolumicWeightOfCoverageLayerShift);
+ Assert.AreEqual(inputParameters.Diameter70.Mean.Value, entity.Diameter70Mean);
+ Assert.AreEqual(inputParameters.Diameter70.StandardDeviation.Value, entity.Diameter70StandardDeviation);
+ Assert.AreEqual(inputParameters.DarcyPermeability.Mean.Value, entity.DarcyPermeabilityMean);
+ Assert.AreEqual(inputParameters.DarcyPermeability.StandardDeviation.Value, entity.DarcyPermeabilityStandardDeviation);
+
+ registry.RemoveUntouched(context);
+ CollectionAssert.Contains(context.PipingCalculationEntities, entity);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_PipingCalculationScenarioWithReplacedSurfaceLine_PipingCalculationEntityUpdated()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var originalSurfaceLineEntity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = 345,
+ Name = "Original"
+ };
+ var replacementSurfaceLineEntity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = 897,
+ Name = "Replacement"
+ };
+ var entity = new PipingCalculationEntity
+ {
+ PipingCalculationEntityId = 453,
+ SurfaceLineEntity = originalSurfaceLineEntity
+ };
+ context.PipingCalculationEntities.Add(entity);
+ context.SurfaceLineEntities.Add(originalSurfaceLineEntity);
+ context.SurfaceLineEntities.Add(replacementSurfaceLineEntity);
+
+ var replacementSurfaceLine = new RingtoetsPipingSurfaceLine
+ {
+ Name = replacementSurfaceLineEntity.Name,
+ StorageId = replacementSurfaceLineEntity.SurfaceLineEntityId,
+ ReferenceLineIntersectionWorldPoint = new Point2D(1, 2)
+ };
+ replacementSurfaceLine.SetGeometry(new[]
+ {
+ new Point3D(1, 2, 3),
+ new Point3D(4, 5, 6)
+ });
+
+ var registry = new PersistenceRegistry();
+ registry.Register(originalSurfaceLineEntity, new RingtoetsPipingSurfaceLine());
+ registry.Register(replacementSurfaceLineEntity, replacementSurfaceLine);
+
+ var calculation = new PipingCalculationScenario(new GeneralPipingInput())
+ {
+ StorageId = entity.PipingCalculationEntityId,
+ InputParameters =
+ {
+ EntryPointL = (RoundedDouble)1.1,
+ ExitPointL = (RoundedDouble)2.2,
+ DampingFactorExit =
+ {
+ Mean = (RoundedDouble)1
+ },
+ SaturatedVolumicWeightOfCoverageLayer =
+ {
+ Mean = (RoundedDouble)1
+ },
+ Diameter70 =
+ {
+ Mean = (RoundedDouble)1
+ },
+ DarcyPermeability =
+ {
+ Mean = (RoundedDouble)1
+ },
+ SurfaceLine = replacementSurfaceLine
+ }
+ };
+
+ // Call
+ calculation.Update(registry, context);
+
+ // Assert
+ Assert.IsNotNull(entity.SurfaceLineEntity);
+ Assert.AreSame(replacementSurfaceLineEntity, entity.SurfaceLineEntity);
+
+ registry.RemoveUntouched(context);
+ CollectionAssert.Contains(context.PipingCalculationEntities, entity);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_PipingCalculationScenarioWithClearedSurfaceLine_PipingCalculationEntityUpdated()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var surfaceLineEntity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = 345,
+ Name = "Original"
+ };
+ var entity = new PipingCalculationEntity
+ {
+ PipingCalculationEntityId = 453,
+ SurfaceLineEntity = surfaceLineEntity
+ };
+ context.PipingCalculationEntities.Add(entity);
+
+ var registry = new PersistenceRegistry();
+ registry.Register(surfaceLineEntity, new RingtoetsPipingSurfaceLine());
+
+ var calculation = new PipingCalculationScenario(new GeneralPipingInput())
+ {
+ StorageId = entity.PipingCalculationEntityId,
+ InputParameters =
+ {
+ EntryPointL = (RoundedDouble)1.1,
+ ExitPointL = (RoundedDouble)2.2,
+ DampingFactorExit =
+ {
+ Mean = (RoundedDouble)1
+ },
+ SaturatedVolumicWeightOfCoverageLayer =
+ {
+ Mean = (RoundedDouble)1
+ },
+ Diameter70 =
+ {
+ Mean = (RoundedDouble)1
+ },
+ DarcyPermeability =
+ {
+ Mean = (RoundedDouble)1
+ },
+ SurfaceLine = null
+ }
+ };
+
+ // Call
+ calculation.Update(registry, context);
+
+ // Assert
+ Assert.IsNull(entity.SurfaceLineEntity);
+
+ registry.RemoveUntouched(context);
+ CollectionAssert.Contains(context.PipingCalculationEntities, entity);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_PipingCalculationScenarioWithReplacedHydraulicBoundarLocation_PipingCalculationEntityUpdated()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var originalHydraulicLocationEntity = new HydraulicLocationEntity
+ {
+ HydraulicLocationEntityId = 345,
+ Name = "Original"
+ };
+ var replacementHydraulicLocationEntity = new HydraulicLocationEntity
+ {
+ HydraulicLocationEntityId = 897,
+ Name = "Replacement"
+ };
+ var entity = new PipingCalculationEntity
+ {
+ PipingCalculationEntityId = 453,
+ HydraulicLocationEntity = originalHydraulicLocationEntity
+ };
+ context.PipingCalculationEntities.Add(entity);
+ context.HydraulicLocationEntities.Add(originalHydraulicLocationEntity);
+ context.HydraulicLocationEntities.Add(replacementHydraulicLocationEntity);
+
+ var replacementBoundaryLocation = new HydraulicBoundaryLocation(1, replacementHydraulicLocationEntity.Name, 1, 2)
+ {
+ StorageId = replacementHydraulicLocationEntity.HydraulicLocationEntityId,
+ };
+
+ var registry = new PersistenceRegistry();
+ registry.Register(originalHydraulicLocationEntity,
+ new HydraulicBoundaryLocation(2, originalHydraulicLocationEntity.Name, 3, 4));
+ registry.Register(replacementHydraulicLocationEntity, replacementBoundaryLocation);
+
+ var calculation = new PipingCalculationScenario(new GeneralPipingInput())
+ {
+ StorageId = entity.PipingCalculationEntityId,
+ InputParameters =
+ {
+ EntryPointL = (RoundedDouble)1.1,
+ ExitPointL = (RoundedDouble)2.2,
+ DampingFactorExit =
+ {
+ Mean = (RoundedDouble)1
+ },
+ SaturatedVolumicWeightOfCoverageLayer =
+ {
+ Mean = (RoundedDouble)1
+ },
+ Diameter70 =
+ {
+ Mean = (RoundedDouble)1
+ },
+ DarcyPermeability =
+ {
+ Mean = (RoundedDouble)1
+ },
+ HydraulicBoundaryLocation = replacementBoundaryLocation
+ }
+ };
+
+ // Call
+ calculation.Update(registry, context);
+
+ // Assert
+ Assert.AreSame(replacementHydraulicLocationEntity, entity.HydraulicLocationEntity);
+
+ registry.RemoveUntouched(context);
+ CollectionAssert.Contains(context.PipingCalculationEntities, entity);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_PipingCalculationScenarioWithClearedHydraulicBoundaryLocation_PipingCalculationEntityUpdated()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var hydraulicLocationEntity = new HydraulicLocationEntity
+ {
+ HydraulicLocationEntityId = 5675,
+ Name = "Original"
+ };
+ var entity = new PipingCalculationEntity
+ {
+ PipingCalculationEntityId = 453,
+ HydraulicLocationEntity = hydraulicLocationEntity
+ };
+ context.PipingCalculationEntities.Add(entity);
+ context.HydraulicLocationEntities.Add(hydraulicLocationEntity);
+
+ var registry = new PersistenceRegistry();
+ registry.Register(hydraulicLocationEntity, new HydraulicBoundaryLocation(1, hydraulicLocationEntity.Name, 1, 3));
+
+ var calculation = new PipingCalculationScenario(new GeneralPipingInput())
+ {
+ StorageId = entity.PipingCalculationEntityId,
+ InputParameters =
+ {
+ EntryPointL = (RoundedDouble)1.1,
+ ExitPointL = (RoundedDouble)2.2,
+ DampingFactorExit =
+ {
+ Mean = (RoundedDouble)1
+ },
+ SaturatedVolumicWeightOfCoverageLayer =
+ {
+ Mean = (RoundedDouble)1
+ },
+ Diameter70 =
+ {
+ Mean = (RoundedDouble)1
+ },
+ DarcyPermeability =
+ {
+ Mean = (RoundedDouble)1
+ },
+ HydraulicBoundaryLocation = null
+ }
+ };
+
+ // Call
+ calculation.Update(registry, context);
+
+ // Assert
+ Assert.IsNull(entity.HydraulicLocationEntity);
+
+ registry.RemoveUntouched(context);
+ CollectionAssert.Contains(context.PipingCalculationEntities, entity);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_PipingCalculationScenarioWithReplacedStochasticSoilProfile_PipingCalculationEntityUpdated()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var originalStochasticSoilProfileEntity = new StochasticSoilProfileEntity
+ {
+ StochasticSoilProfileEntityId = 490865
+ };
+ var replacementStochasticSoilProfileEntity = new StochasticSoilProfileEntity
+ {
+ StochasticSoilProfileEntityId = 57,
+ };
+ var entity = new PipingCalculationEntity
+ {
+ PipingCalculationEntityId = 453,
+ StochasticSoilProfileEntity = originalStochasticSoilProfileEntity
+ };
+ context.PipingCalculationEntities.Add(entity);
+ context.StochasticSoilProfileEntities.Add(originalStochasticSoilProfileEntity);
+ context.StochasticSoilProfileEntities.Add(replacementStochasticSoilProfileEntity);
+
+ var replacementSurfaceLine = new StochasticSoilProfile(0.6, SoilProfileType.SoilProfile1D, 34)
+ {
+ StorageId = replacementStochasticSoilProfileEntity.StochasticSoilProfileEntityId,
+ };
+
+ var registry = new PersistenceRegistry();
+ registry.Register(originalStochasticSoilProfileEntity,
+ new StochasticSoilProfile(0.6, SoilProfileType.SoilProfile2D, 131));
+ registry.Register(replacementStochasticSoilProfileEntity, replacementSurfaceLine);
+
+ var calculation = new PipingCalculationScenario(new GeneralPipingInput())
+ {
+ StorageId = entity.PipingCalculationEntityId,
+ InputParameters =
+ {
+ EntryPointL = (RoundedDouble)1.1,
+ ExitPointL = (RoundedDouble)2.2,
+ DampingFactorExit =
+ {
+ Mean = (RoundedDouble)1
+ },
+ SaturatedVolumicWeightOfCoverageLayer =
+ {
+ Mean = (RoundedDouble)1
+ },
+ Diameter70 =
+ {
+ Mean = (RoundedDouble)1
+ },
+ DarcyPermeability =
+ {
+ Mean = (RoundedDouble)1
+ },
+ StochasticSoilProfile = replacementSurfaceLine
+ }
+ };
+
+ // Call
+ calculation.Update(registry, context);
+
+ // Assert
+ Assert.AreSame(replacementStochasticSoilProfileEntity, entity.StochasticSoilProfileEntity);
+
+ registry.RemoveUntouched(context);
+ CollectionAssert.Contains(context.PipingCalculationEntities, entity);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_PipingCalculationScenarioWithClearedStochasticSoilProfile_PipingCalculationEntityUpdated()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var stochasticSoilProfileEntity = new StochasticSoilProfileEntity
+ {
+ StochasticSoilProfileEntityId = 6,
+ };
+ var entity = new PipingCalculationEntity
+ {
+ PipingCalculationEntityId = 453,
+ StochasticSoilProfileEntity = stochasticSoilProfileEntity
+ };
+ context.PipingCalculationEntities.Add(entity);
+
+ var registry = new PersistenceRegistry();
+
+ var calculation = new PipingCalculationScenario(new GeneralPipingInput())
+ {
+ StorageId = entity.PipingCalculationEntityId,
+ InputParameters =
+ {
+ EntryPointL = (RoundedDouble)1.1,
+ ExitPointL = (RoundedDouble)2.2,
+ DampingFactorExit =
+ {
+ Mean = (RoundedDouble)1
+ },
+ SaturatedVolumicWeightOfCoverageLayer =
+ {
+ Mean = (RoundedDouble)1
+ },
+ Diameter70 =
+ {
+ Mean = (RoundedDouble)1
+ },
+ DarcyPermeability =
+ {
+ Mean = (RoundedDouble)1
+ },
+ StochasticSoilProfile = null
+ }
+ };
+
+ // Call
+ calculation.Update(registry, context);
+
+ // Assert
+ Assert.IsNull(entity.StochasticSoilProfileEntity);
+
+ registry.RemoveUntouched(context);
+ CollectionAssert.Contains(context.PipingCalculationEntities, entity);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_PipingCalculationWithNewPipingOutput_PipingCalculationEntityUpdated()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var entity = new PipingCalculationEntity
+ {
+ PipingCalculationEntityId = 453
+ };
+ context.PipingCalculationEntities.Add(entity);
+
+ var registry = new PersistenceRegistry();
+
+ var calculation = new PipingCalculationScenario(new GeneralPipingInput())
+ {
+ StorageId = entity.PipingCalculationEntityId,
+ Output = new PipingOutput(1,1,1,1,1,1),
+ InputParameters =
+ {
+ EntryPointL = (RoundedDouble)1.1,
+ ExitPointL = (RoundedDouble)2.2,
+ DampingFactorExit =
+ {
+ Mean = (RoundedDouble)1
+ },
+ SaturatedVolumicWeightOfCoverageLayer =
+ {
+ Mean = (RoundedDouble)1
+ },
+ Diameter70 =
+ {
+ Mean = (RoundedDouble)1
+ },
+ DarcyPermeability =
+ {
+ Mean = (RoundedDouble)1
+ }
+ }
+ };
+
+ // Call
+ calculation.Update(registry, context);
+
+ // Assert
+ PipingCalculationOutputEntity pipingCalculationOutputEntity = entity.PipingCalculationOutputEntity;
+ pipingCalculationOutputEntity.PipingCalculationOutputEntityId = 495876;
+ registry.TransferIds();
+ Assert.AreEqual(pipingCalculationOutputEntity.PipingCalculationOutputEntityId, calculation.Output.StorageId,
+ "New PipingCalculationOutputEntity should be registered to PersistenceRegistry.");
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_PipingCalculationWithUnchangedPipingOutput_PipingCalculationOutputEntityIsRegistered()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var calculationOutputEntity = new PipingCalculationOutputEntity
+ {
+ PipingCalculationOutputEntityId = 45
+ };
+ var entity = new PipingCalculationEntity
+ {
+ PipingCalculationEntityId = 453,
+ PipingCalculationOutputEntity = calculationOutputEntity
+ };
+ context.PipingCalculationEntities.Add(entity);
+ context.PipingCalculationOutputEntities.Add(calculationOutputEntity);
+
+ var registry = new PersistenceRegistry();
+
+ var calculation = new PipingCalculationScenario(new GeneralPipingInput())
+ {
+ StorageId = entity.PipingCalculationEntityId,
+ Output = new PipingOutput(1, 1, 1, 1, 1, 1)
+ {
+ StorageId = calculationOutputEntity.PipingCalculationOutputEntityId
+ },
+ InputParameters =
+ {
+ EntryPointL = (RoundedDouble)1.1,
+ ExitPointL = (RoundedDouble)2.2,
+ DampingFactorExit =
+ {
+ Mean = (RoundedDouble)1
+ },
+ SaturatedVolumicWeightOfCoverageLayer =
+ {
+ Mean = (RoundedDouble)1
+ },
+ Diameter70 =
+ {
+ Mean = (RoundedDouble)1
+ },
+ DarcyPermeability =
+ {
+ Mean = (RoundedDouble)1
+ }
+ }
+ };
+
+ // Call
+ calculation.Update(registry, context);
+
+ // Assert
+ CollectionAssert.Contains(context.PipingCalculationOutputEntities, calculationOutputEntity);
+ registry.RemoveUntouched(context);
+ CollectionAssert.Contains(context.PipingCalculationOutputEntities, calculationOutputEntity);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_PipingCalculationWithRemovedPipingOutput_PipingCalculationEntityUpdated()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var calculationOutputEntity = new PipingCalculationOutputEntity
+ {
+ PipingCalculationOutputEntityId = 45
+ };
+ var entity = new PipingCalculationEntity
+ {
+ PipingCalculationEntityId = 453,
+ PipingCalculationOutputEntity = calculationOutputEntity
+ };
+ context.PipingCalculationEntities.Add(entity);
+ context.PipingCalculationOutputEntities.Add(calculationOutputEntity);
+
+ var registry = new PersistenceRegistry();
+
+ var calculation = new PipingCalculationScenario(new GeneralPipingInput())
+ {
+ StorageId = entity.PipingCalculationEntityId,
+ Output = null,
+ InputParameters =
+ {
+ EntryPointL = (RoundedDouble)1.1,
+ ExitPointL = (RoundedDouble)2.2,
+ DampingFactorExit =
+ {
+ Mean = (RoundedDouble)1
+ },
+ SaturatedVolumicWeightOfCoverageLayer =
+ {
+ Mean = (RoundedDouble)1
+ },
+ Diameter70 =
+ {
+ Mean = (RoundedDouble)1
+ },
+ DarcyPermeability =
+ {
+ Mean = (RoundedDouble)1
+ }
+ }
+ };
+
+ // Call
+ calculation.Update(registry, context);
+
+ // Assert
+ Assert.IsNull(entity.PipingCalculationOutputEntity);
+
+ registry.RemoveUntouched(context);
+ CollectionAssert.DoesNotContain(context.PipingCalculationOutputEntities, calculationOutputEntity);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_PipingCalculationWithNewSemiProbabilisticOutput_PipingCalculationEntityUpdated()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var entity = new PipingCalculationEntity
+ {
+ PipingCalculationEntityId = 453
+ };
+ context.PipingCalculationEntities.Add(entity);
+
+ var registry = new PersistenceRegistry();
+
+ var calculation = new PipingCalculationScenario(new GeneralPipingInput())
+ {
+ StorageId = entity.PipingCalculationEntityId,
+ SemiProbabilisticOutput = new PipingSemiProbabilisticOutput(1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1,
+ 1, 1, 1),
+ InputParameters =
+ {
+ EntryPointL = (RoundedDouble)1.1,
+ ExitPointL = (RoundedDouble)2.2,
+ DampingFactorExit =
+ {
+ Mean = (RoundedDouble)1
+ },
+ SaturatedVolumicWeightOfCoverageLayer =
+ {
+ Mean = (RoundedDouble)1
+ },
+ Diameter70 =
+ {
+ Mean = (RoundedDouble)1
+ },
+ DarcyPermeability =
+ {
+ Mean = (RoundedDouble)1
+ }
+ }
+ };
+
+ // Call
+ calculation.Update(registry, context);
+
+ // Assert
+ PipingSemiProbabilisticOutputEntity semiProbabilisticOutputEntity = entity.PipingSemiProbabilisticOutputEntity;
+ semiProbabilisticOutputEntity.PipingSemiProbabilisticOutputEntityId = 546;
+ registry.TransferIds();
+ Assert.AreEqual(semiProbabilisticOutputEntity.PipingSemiProbabilisticOutputEntityId, calculation.SemiProbabilisticOutput.StorageId,
+ "New PipingSemiProbabilisticOutputEntity should be registered to PersistenceRegistry.");
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_PipingCalculationWithUnchangedSemiProbabilisticOutput_PipingSemiProbabilisticOutputEntityIsRegistered()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var semiProbabilisticOutputEntity = new PipingSemiProbabilisticOutputEntity
+ {
+ PipingSemiProbabilisticOutputEntityId = 549876
+ };
+ var entity = new PipingCalculationEntity
+ {
+ PipingCalculationEntityId = 453,
+ PipingSemiProbabilisticOutputEntity = semiProbabilisticOutputEntity
+ };
+ context.PipingCalculationEntities.Add(entity);
+ context.PipingSemiProbabilisticOutputEntities.Add(semiProbabilisticOutputEntity);
+
+ var registry = new PersistenceRegistry();
+
+ var calculation = new PipingCalculationScenario(new GeneralPipingInput())
+ {
+ StorageId = entity.PipingCalculationEntityId,
+ SemiProbabilisticOutput = new PipingSemiProbabilisticOutput(1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1,
+ 1, 1, 1)
+ {
+ StorageId = semiProbabilisticOutputEntity.PipingSemiProbabilisticOutputEntityId
+ },
+ InputParameters =
+ {
+ EntryPointL = (RoundedDouble)1.1,
+ ExitPointL = (RoundedDouble)2.2,
+ DampingFactorExit =
+ {
+ Mean = (RoundedDouble)1
+ },
+ SaturatedVolumicWeightOfCoverageLayer =
+ {
+ Mean = (RoundedDouble)1
+ },
+ Diameter70 =
+ {
+ Mean = (RoundedDouble)1
+ },
+ DarcyPermeability =
+ {
+ Mean = (RoundedDouble)1
+ }
+ }
+ };
+
+ // Call
+ calculation.Update(registry, context);
+
+ // Assert
+ CollectionAssert.Contains(context.PipingSemiProbabilisticOutputEntities, semiProbabilisticOutputEntity);
+ registry.RemoveUntouched(context);
+ CollectionAssert.Contains(context.PipingSemiProbabilisticOutputEntities, semiProbabilisticOutputEntity);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_PipingCalculationWithRemovedSemiProbabilisticOutput_PipingCalculationEntityUpdated()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var semiProbabilisticOutputEntity = new PipingSemiProbabilisticOutputEntity
+ {
+ PipingSemiProbabilisticOutputEntityId = 54976
+ };
+ var entity = new PipingCalculationEntity
+ {
+ PipingCalculationEntityId = 453,
+ PipingSemiProbabilisticOutputEntity = semiProbabilisticOutputEntity
+ };
+ context.PipingCalculationEntities.Add(entity);
+ context.PipingSemiProbabilisticOutputEntities.Add(semiProbabilisticOutputEntity);
+
+ var registry = new PersistenceRegistry();
+
+ var calculation = new PipingCalculationScenario(new GeneralPipingInput())
+ {
+ StorageId = entity.PipingCalculationEntityId,
+ SemiProbabilisticOutput = null,
+ InputParameters =
+ {
+ EntryPointL = (RoundedDouble)1.1,
+ ExitPointL = (RoundedDouble)2.2,
+ DampingFactorExit =
+ {
+ Mean = (RoundedDouble)1
+ },
+ SaturatedVolumicWeightOfCoverageLayer =
+ {
+ Mean = (RoundedDouble)1
+ },
+ Diameter70 =
+ {
+ Mean = (RoundedDouble)1
+ },
+ DarcyPermeability =
+ {
+ Mean = (RoundedDouble)1
+ }
+ }
+ };
+
+ // Call
+ calculation.Update(registry, context);
+
+ // Assert
+ Assert.IsNull(entity.PipingSemiProbabilisticOutputEntity);
+
+ registry.RemoveUntouched(context);
+ CollectionAssert.DoesNotContain(context.PipingSemiProbabilisticOutputEntities, semiProbabilisticOutputEntity);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,196 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.Piping;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Test.Update.Piping
+{
+ [TestFixture]
+ public class PipingFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new PipingFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new PipingFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoPipingSectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new PipingFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'PipingSectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoPipingSectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new PipingFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.PipingSectionResultEntities.Add(new PipingSectionResultEntity
+ {
+ PipingSectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'PipingSectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithPipingSectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new PipingFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new PipingSectionResultEntity
+ {
+ PipingSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.PipingSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), sectionResultEntity.LayerOne);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new PipingFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new PipingSectionResultEntity
+ {
+ PipingSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.PipingSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,682 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.Piping;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Test.Update.Piping
+{
+ [TestFixture]
+ public class PipingFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new PipingFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new PipingFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoPipingFailureMechanism_EntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new PipingFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoPipingFailureMechanismWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new PipingFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithPipingFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true,
+ CalculationsGroup =
+ {
+ StorageId = 4
+ },
+ PipingProbabilityAssessmentInput =
+ {
+ StorageId = 1
+ }
+ };
+
+ var rootCalculationGroup = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = failureMechanism.CalculationsGroup.StorageId
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = failureMechanism.StorageId,
+ IsRelevant = Convert.ToByte(false),
+ CalculationGroupEntity = rootCalculationGroup
+ };
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(rootCalculationGroup);
+ ringtoetsEntities.PipingFailureMechanismMetaEntities.Add(new PipingFailureMechanismMetaEntity
+ {
+ PipingFailureMechanismMetaEntityId = failureMechanism.PipingProbabilityAssessmentInput.StorageId,
+ FailureMechanismEntityId = failureMechanism.StorageId
+ });
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewStochasticSoilModel_SoilModelsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true,
+ CalculationsGroup =
+ {
+ StorageId = 1
+ },
+ StochasticSoilModels =
+ {
+ new StochasticSoilModel(-1, string.Empty, string.Empty)
+ },
+ PipingProbabilityAssessmentInput =
+ {
+ StorageId = 1
+ }
+ };
+
+ var rootCalculationGroupEntity = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = failureMechanism.CalculationsGroup.StorageId
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = failureMechanism.StorageId,
+ IsRelevant = Convert.ToByte(false),
+ CalculationGroupEntity = rootCalculationGroupEntity
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(rootCalculationGroupEntity);
+ ringtoetsEntities.PipingFailureMechanismMetaEntities.Add(new PipingFailureMechanismMetaEntity
+ {
+ PipingFailureMechanismMetaEntityId = failureMechanism.PipingProbabilityAssessmentInput.StorageId,
+ FailureMechanismEntityId = failureMechanism.StorageId
+ });
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.StochasticSoilModelEntities.Count);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedStochasticSoilModel_NoNewSoilModelAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var stochasticSoilModel = new StochasticSoilModel(-1, string.Empty, string.Empty)
+ {
+ StorageId = 1
+ };
+ var failureMechanism = new PipingFailureMechanism
+ {
+ StorageId = 1,
+ CalculationsGroup =
+ {
+ StorageId = 4
+ },
+ StochasticSoilModels =
+ {
+ stochasticSoilModel
+ },
+ PipingProbabilityAssessmentInput =
+ {
+ StorageId = 1
+ }
+ };
+
+ var stochasticSoilModelEntity = new StochasticSoilModelEntity
+ {
+ StochasticSoilModelEntityId = stochasticSoilModel.StorageId
+ };
+ var rootCalculationGroupEntity = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = failureMechanism.CalculationsGroup.StorageId
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = failureMechanism.StorageId,
+ CalculationGroupEntity = rootCalculationGroupEntity,
+ StochasticSoilModelEntities =
+ {
+ stochasticSoilModelEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(rootCalculationGroupEntity);
+ ringtoetsEntities.StochasticSoilModelEntities.Add(stochasticSoilModelEntity);
+ ringtoetsEntities.PipingFailureMechanismMetaEntities.Add(new PipingFailureMechanismMetaEntity
+ {
+ PipingFailureMechanismMetaEntityId = failureMechanism.PipingProbabilityAssessmentInput.StorageId,
+ FailureMechanismEntityId = failureMechanism.StorageId
+ });
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.StochasticSoilModelEntities.Count);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewSurfaceLine_SurfaceLineEntitiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true,
+ CalculationsGroup =
+ {
+ StorageId = 3
+ },
+ PipingProbabilityAssessmentInput =
+ {
+ StorageId = 1
+ }
+ };
+ failureMechanism.SurfaceLines.Add(new RingtoetsPipingSurfaceLine
+ {
+ ReferenceLineIntersectionWorldPoint = new Point2D(1.1, 2.2)
+ });
+
+ var rootCalculationGroupEntity = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = failureMechanism.CalculationsGroup.StorageId
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = failureMechanism.StorageId,
+ IsRelevant = Convert.ToByte(false),
+ CalculationGroupEntity = rootCalculationGroupEntity
+ };
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(rootCalculationGroupEntity);
+ ringtoetsEntities.PipingFailureMechanismMetaEntities.Add(new PipingFailureMechanismMetaEntity
+ {
+ PipingFailureMechanismMetaEntityId = failureMechanism.PipingProbabilityAssessmentInput.StorageId,
+ FailureMechanismEntityId = failureMechanism.StorageId
+ });
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.SurfaceLineEntities.Count);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedSurfaceLineEntity_NoNewSurfaceLineEntitiesAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var surfaceLine = new RingtoetsPipingSurfaceLine
+ {
+ StorageId = 23,
+ ReferenceLineIntersectionWorldPoint = new Point2D(45.67, 34.46)
+ };
+
+ var failureMechanism = new PipingFailureMechanism
+ {
+ StorageId = 1,
+ CalculationsGroup =
+ {
+ StorageId = 54
+ },
+ PipingProbabilityAssessmentInput =
+ {
+ StorageId = 1
+ }
+ };
+ failureMechanism.SurfaceLines.Add(surfaceLine);
+
+ var surfaceLineEntity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = surfaceLine.StorageId
+ };
+ var rootCalculationGroupEntity = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = failureMechanism.CalculationsGroup.StorageId
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = failureMechanism.StorageId,
+ CalculationGroupEntity = rootCalculationGroupEntity,
+ SurfaceLineEntities =
+ {
+ surfaceLineEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(rootCalculationGroupEntity);
+ ringtoetsEntities.SurfaceLineEntities.Add(surfaceLineEntity);
+ ringtoetsEntities.PipingFailureMechanismMetaEntities.Add(new PipingFailureMechanismMetaEntity
+ {
+ PipingFailureMechanismMetaEntityId = failureMechanism.PipingProbabilityAssessmentInput.StorageId,
+ FailureMechanismEntityId = failureMechanism.StorageId
+ });
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.SurfaceLineEntities.Count);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism
+ {
+ StorageId = 1,
+ CalculationsGroup =
+ {
+ StorageId = 1
+ },
+ PipingProbabilityAssessmentInput =
+ {
+ StorageId = 1
+ }
+ };
+ failureMechanism.AddSection(new TestFailureMechanismSection());
+
+ var rootCalculationGroupEntity = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = failureMechanism.CalculationsGroup.StorageId
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = failureMechanism.StorageId,
+ CalculationGroupEntity = rootCalculationGroupEntity
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(rootCalculationGroupEntity);
+ ringtoetsEntities.PipingFailureMechanismMetaEntities.Add(new PipingFailureMechanismMetaEntity
+ {
+ PipingFailureMechanismMetaEntityId = failureMechanism.PipingProbabilityAssessmentInput.StorageId,
+ FailureMechanismEntityId = failureMechanism.StorageId
+ });
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.PipingSectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism
+ {
+ StorageId = 1,
+ CalculationsGroup =
+ {
+ StorageId = 97
+ },
+ PipingProbabilityAssessmentInput =
+ {
+ StorageId = 1
+ }
+ };
+ var testName = "testName";
+ var failureMechanismSection = new FailureMechanismSection(testName, new[] { new Point2D(0, 0) })
+ {
+ StorageId = 1
+ };
+ failureMechanism.AddSection(failureMechanismSection);
+ failureMechanism.SectionResults.First().StorageId = 1;
+
+ var pipingSectionResultEntity = new PipingSectionResultEntity
+ {
+ PipingSectionResultEntityId = failureMechanism.SectionResults.First().StorageId
+ };
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = failureMechanismSection.StorageId,
+ PipingSectionResultEntities =
+ {
+ pipingSectionResultEntity
+ }
+ };
+ var rootCalculationGroupEntity = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = failureMechanism.CalculationsGroup.StorageId
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = failureMechanism.StorageId,
+ CalculationGroupEntity = rootCalculationGroupEntity,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(rootCalculationGroupEntity);
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+ ringtoetsEntities.PipingSectionResultEntities.Add(pipingSectionResultEntity);
+ ringtoetsEntities.PipingFailureMechanismMetaEntities.Add(new PipingFailureMechanismMetaEntity
+ {
+ PipingFailureMechanismMetaEntityId = failureMechanism.PipingProbabilityAssessmentInput.StorageId,
+ FailureMechanismEntityId = failureMechanism.StorageId
+ });
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.PipingSectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewCalculationGroup_CalculationGroupEntityAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism
+ {
+ StorageId = 1,
+ CalculationsGroup =
+ {
+ StorageId = 1
+ },
+ PipingProbabilityAssessmentInput =
+ {
+ StorageId = 1
+ }
+ };
+ var newCalculationGroup = new CalculationGroup
+ {
+ Name = "new group"
+ };
+ failureMechanism.CalculationsGroup.Children.Add(newCalculationGroup);
+
+ var rootCalculationGroupEntity = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = failureMechanism.CalculationsGroup.StorageId,
+ Name = "Berekeningen",
+ IsEditable = 0,
+ Order = 0
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = failureMechanism.StorageId,
+ CalculationGroupEntity = rootCalculationGroupEntity
+ };
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(rootCalculationGroupEntity);
+ ringtoetsEntities.PipingFailureMechanismMetaEntities.Add(new PipingFailureMechanismMetaEntity
+ {
+ PipingFailureMechanismMetaEntityId = failureMechanism.PipingProbabilityAssessmentInput.StorageId,
+ FailureMechanismEntityId = failureMechanism.StorageId
+ });
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ failureMechanism.Update(registry, ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, rootCalculationGroupEntity.CalculationGroupEntity1.Count);
+ CalculationGroupEntity newlyAddedGroupEntity = rootCalculationGroupEntity.CalculationGroupEntity1.First();
+ Assert.AreEqual(newCalculationGroup.Name, newlyAddedGroupEntity.Name);
+ Assert.AreEqual(1, newlyAddedGroupEntity.IsEditable);
+ Assert.AreEqual(0, newlyAddedGroupEntity.Order);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUnchangedCalculationGroup_NoNewCalculationGroupEntityAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism
+ {
+ StorageId = 1,
+ CalculationsGroup =
+ {
+ StorageId = 1
+ },
+ PipingProbabilityAssessmentInput =
+ {
+ StorageId = 1
+ }
+ };
+ var alreadySavedChildGroup = new CalculationGroup
+ {
+ Name = "saved child group",
+ StorageId = 2
+ };
+ failureMechanism.CalculationsGroup.Children.Add(alreadySavedChildGroup);
+
+ var childGroupEntity = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = alreadySavedChildGroup.StorageId,
+ Name = alreadySavedChildGroup.Name,
+ IsEditable = 1,
+ Order = 0
+ };
+ var rootCalculationGroupEntity = new CalculationGroupEntity
+ {
+ CalculationGroupEntityId = failureMechanism.CalculationsGroup.StorageId,
+ Name = "Berekeningen",
+ IsEditable = 0,
+ Order = 0,
+ CalculationGroupEntity1 =
+ {
+ childGroupEntity
+ }
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = failureMechanism.StorageId,
+ CalculationGroupEntity = rootCalculationGroupEntity
+ };
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(rootCalculationGroupEntity);
+ ringtoetsEntities.CalculationGroupEntities.Add(childGroupEntity);
+ ringtoetsEntities.PipingFailureMechanismMetaEntities.Add(new PipingFailureMechanismMetaEntity
+ {
+ PipingFailureMechanismMetaEntityId = failureMechanism.PipingProbabilityAssessmentInput.StorageId,
+ FailureMechanismEntityId = failureMechanism.StorageId
+ });
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ failureMechanism.Update(registry, ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, rootCalculationGroupEntity.CalculationGroupEntity1.Count);
+ CalculationGroupEntity retainedCalculationGroupEntity = rootCalculationGroupEntity.CalculationGroupEntity1.First();
+ Assert.AreEqual(alreadySavedChildGroup.Name, retainedCalculationGroupEntity.Name);
+ Assert.AreEqual(1, retainedCalculationGroupEntity.IsEditable);
+ Assert.AreEqual(0, retainedCalculationGroupEntity.Order);
+ Assert.AreEqual(alreadySavedChildGroup.StorageId, retainedCalculationGroupEntity.CalculationGroupEntityId);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingProbabilityAssessmentInputUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingProbabilityAssessmentInputUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingProbabilityAssessmentInputUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,157 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.Piping;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Test.Update.Piping
+{
+ [TestFixture]
+ public class PipingProbabilityAssessmentInputUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var probabilityAssessmentInput = new PipingProbabilityAssessmentInput();
+
+ // Call
+ TestDelegate test = () => probabilityAssessmentInput.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var ringtoetsEntities = mocks.Stub();
+ mocks.ReplayAll();
+
+ var probabilityAssessmentInput = new PipingProbabilityAssessmentInput();
+
+ // Call
+ TestDelegate test = () => probabilityAssessmentInput.Update(null, ringtoetsEntities);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNoPipingProbabilityAssessmentInput_EntityNotFoundException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var probabilityAssessmentInput = new PipingProbabilityAssessmentInput();
+
+ // Call
+ TestDelegate test = () => probabilityAssessmentInput.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'PipingFailureMechanismMetaEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNoPipingFailureMechanismWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var probabilityAssessmentInput = new PipingProbabilityAssessmentInput
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.PipingFailureMechanismMetaEntities.Add(new PipingFailureMechanismMetaEntity
+ {
+ PipingFailureMechanismMetaEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => probabilityAssessmentInput.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'PipingFailureMechanismMetaEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithPipingFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ double value = 0.64;
+
+ var probabilityAssessmentInput = new PipingProbabilityAssessmentInput
+ {
+ StorageId = 1,
+ A = value
+ };
+
+ var pipingFailureMechanismMetaEntity = new PipingFailureMechanismMetaEntity
+ {
+ PipingFailureMechanismMetaEntityId = probabilityAssessmentInput.StorageId,
+ A = Convert.ToDecimal(0.3)
+ };
+ ringtoetsEntities.PipingFailureMechanismMetaEntities.Add(pipingFailureMechanismMetaEntity);
+
+ // Call
+ probabilityAssessmentInput.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToDecimal(value), pipingFailureMechanismMetaEntity.A);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingSoilLayerUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingSoilLayerUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingSoilLayerUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,193 @@
+// 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.Drawing;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.Piping;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Test.Update.Piping
+{
+ [TestFixture]
+ public class PipingSoilLayerUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var pipingSoilLayer = new PipingSoilLayer(0.5);
+
+ // Call
+ TestDelegate test = () => pipingSoilLayer.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var pipingSoilLayer = new PipingSoilLayer(0.5);
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ pipingSoilLayer.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoPipingSoilLayer_EntityNotFoundException()
+ {
+ // Setup
+ var pipingSoilLayer = new PipingSoilLayer(0.5);
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ pipingSoilLayer.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'SoilLayerEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoPipingSoilLayerWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var random = new Random(21);
+ double newTop = random.NextDouble() * 10;
+ var storageId = 1;
+ var pipingSoilLayer = new PipingSoilLayer(newTop)
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.SoilLayerEntities.Add(new SoilLayerEntity
+ {
+ SoilLayerEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => pipingSoilLayer.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'SoilLayerEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithPipingSoilLayer_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var random = new Random(21);
+ double newTop = random.NextDouble() * 10;
+ var pipingSoilLayer = new PipingSoilLayer(newTop)
+ {
+ StorageId = 1,
+ IsAquifer = true,
+ BelowPhreaticLevelMean = random.NextDouble(),
+ BelowPhreaticLevelDeviation = random.NextDouble(),
+ BelowPhreaticLevelShift = random.NextDouble(),
+ DiameterD70Mean = double.NaN,
+ DiameterD70Deviation = double.NaN,
+ PermeabilityMean = random.NextDouble(),
+ PermeabilityDeviation = random.NextDouble(),
+ Color = Color.DarkKhaki,
+ MaterialName = "NewName"
+ };
+
+ var soilLayerEntity = new SoilLayerEntity
+ {
+ SoilLayerEntityId = pipingSoilLayer.StorageId,
+ Top = 0,
+ IsAquifer = Convert.ToByte(false),
+ BelowPhreaticLevelMean = 2.2,
+ BelowPhreaticLevelDeviation = 8.5,
+ BelowPhreaticLevelShift = 1.5,
+ DiameterD70Mean = 5.5,
+ DiameterD70Deviation = 3.8,
+ PermeabilityMean = 1.2,
+ PermeabilityDeviation = 2.2,
+ Color = Color.MediumAquamarine.ToArgb(),
+ MaterialName = "OldName"
+ };
+
+ ringtoetsEntities.SoilLayerEntities.Add(soilLayerEntity);
+
+ // Call
+ pipingSoilLayer.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(newTop, soilLayerEntity.Top, 1e-6);
+ Assert.AreEqual(Convert.ToByte(true), soilLayerEntity.IsAquifer);
+ Assert.AreEqual(pipingSoilLayer.BelowPhreaticLevelMean, soilLayerEntity.BelowPhreaticLevelMean);
+ Assert.AreEqual(pipingSoilLayer.BelowPhreaticLevelDeviation, soilLayerEntity.BelowPhreaticLevelDeviation);
+ Assert.AreEqual(pipingSoilLayer.BelowPhreaticLevelShift, soilLayerEntity.BelowPhreaticLevelShift);
+ Assert.IsNull(soilLayerEntity.DiameterD70Mean);
+ Assert.IsNull(soilLayerEntity.DiameterD70Deviation);
+ Assert.AreEqual(pipingSoilLayer.PermeabilityMean, soilLayerEntity.PermeabilityMean);
+ Assert.AreEqual(pipingSoilLayer.PermeabilityDeviation, soilLayerEntity.PermeabilityDeviation);
+ Assert.AreEqual(pipingSoilLayer.Color.ToArgb(), soilLayerEntity.Color);
+ Assert.AreEqual(pipingSoilLayer.MaterialName, soilLayerEntity.MaterialName);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingSoilProfileUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingSoilProfileUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingSoilProfileUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,221 @@
+// 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 Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.Piping;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Piping.KernelWrapper.TestUtil;
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Test.Update.Piping
+{
+ [TestFixture]
+ public class PipingSoilProfileUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var soilProfile = new TestPipingSoilProfile();
+
+ // Call
+ TestDelegate test = () => soilProfile.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var soilProfile = new TestPipingSoilProfile();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ soilProfile.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoPipingSoilProfile_EntityNotFoundException()
+ {
+ // Setup
+ var soilProfile = new TestPipingSoilProfile();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ soilProfile.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'SoilProfileEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoPipingSoilProfileWithId_PropertiesUpdatedAndLayerAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ IEnumerable newLayers = new[]
+ {
+ new PipingSoilLayer(5.0)
+ };
+ var storageId = 1;
+ var soilProfile = new PipingSoilProfile("new name", 0.5, newLayers, SoilProfileType.SoilProfile1D, -1)
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.SoilProfileEntities.Add(new SoilProfileEntity
+ {
+ SoilProfileEntityId = 2,
+ Name = string.Empty,
+ Bottom = 0
+ });
+
+ // Call
+ TestDelegate test = () => soilProfile.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'SoilProfileEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_NewSoilLayer_PropertiesUpdatedAndLayerAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ string newName = "new name";
+ double newBottom = 0.5;
+ IEnumerable newLayers = new[]
+ {
+ new PipingSoilLayer(5.0)
+ };
+ var soilProfile = new PipingSoilProfile(newName, newBottom, newLayers, SoilProfileType.SoilProfile1D, -1)
+ {
+ StorageId = 1
+ };
+
+ var profileEntity = new SoilProfileEntity
+ {
+ SoilProfileEntityId = 1,
+ Name = string.Empty,
+ Bottom = 0
+ };
+
+ ringtoetsEntities.SoilProfileEntities.Add(profileEntity);
+
+ // Call
+ soilProfile.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(newName, profileEntity.Name);
+ Assert.AreEqual(newBottom, profileEntity.Bottom);
+ Assert.AreEqual(1, profileEntity.SoilLayerEntities.Count);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_UpdatedSoilLayer_StochasticSoilProfileAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ IEnumerable newLayers = new[]
+ {
+ new PipingSoilLayer(5.0)
+ {
+ StorageId = 1
+ }
+ };
+ var soilProfile = new PipingSoilProfile("new name", 0.5, newLayers, SoilProfileType.SoilProfile1D, -1)
+ {
+ StorageId = 1
+ };
+
+ SoilLayerEntity soilLayerEntity = new SoilLayerEntity
+ {
+ SoilLayerEntityId = 1
+ };
+ var profileEntity = new SoilProfileEntity
+ {
+ SoilProfileEntityId = 1,
+ SoilLayerEntities =
+ {
+ soilLayerEntity
+ }
+ };
+
+ ringtoetsEntities.SoilProfileEntities.Add(profileEntity);
+ ringtoetsEntities.SoilLayerEntities.Add(soilLayerEntity);
+
+ // Call
+ soilProfile.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ CollectionAssert.AreEqual(new [] { soilLayerEntity }, profileEntity.SoilLayerEntities);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/RingtoetsPipingSurfaceLineUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/RingtoetsPipingSurfaceLineUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/RingtoetsPipingSurfaceLineUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,679 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.Piping;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Test.Update.Piping
+{
+ [TestFixture]
+ public class RingtoetsPipingSurfaceLineUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_PersistenceRegistryIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ IRingtoetsEntities context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ RingtoetsPipingSurfaceLine surfaceLine = CreateSavedSurfaceLineWithData();
+
+ // Call
+ TestDelegate call = () => surfaceLine.Update(null, context);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("registry", paramName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_RingtoetsEntitiesIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var registry = new PersistenceRegistry();
+
+ RingtoetsPipingSurfaceLine surfaceLine = CreateSavedSurfaceLineWithData();
+
+ // Call
+ TestDelegate call = () => surfaceLine.Update(registry, null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_SurfaceLineNotSaved_ThrowEntityNotFoundException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var registry = new PersistenceRegistry();
+
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+
+ // Precondition
+ const long unsavedObjectId = 0;
+ Assert.AreEqual(unsavedObjectId, surfaceLine.StorageId);
+
+ // Call
+ TestDelegate call = () => surfaceLine.Update(registry, context);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'SurfaceLineEntity' met id '{0}' is niet gevonden.", unsavedObjectId);
+ EntityNotFoundException exception = Assert.Throws(call);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_SurfaceLineWithoutGeometry_SurfaceLineEntityUpdated()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ RingtoetsPipingSurfaceLine surfaceLine = CreateSavedSurfaceLineWithoutGeometry();
+
+ var entity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = surfaceLine.StorageId,
+ Name = "",
+ ReferenceLineIntersectionX = 9876.5432m,
+ ReferenceLineIntersectionY = 9182.8374m
+ };
+ context.SurfaceLineEntities.Add(entity);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ surfaceLine.Update(registry, context);
+
+ // Assert
+ Assert.AreEqual(surfaceLine.Name, entity.Name);
+ Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX);
+ Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY);
+
+ CollectionAssert.IsEmpty(entity.SurfaceLinePointEntities);
+ CollectionAssert.IsEmpty(context.SurfaceLinePointEntities);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_SurfaceLineWithNewGeometry_SurfaceLineEntityUpdatedAndGeometrySaved()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ RingtoetsPipingSurfaceLine surfaceLine = CreateSavedSurfaceLineWithGeometry();
+
+ var entity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = surfaceLine.StorageId,
+ Name = "",
+ ReferenceLineIntersectionX = 91.28m,
+ ReferenceLineIntersectionY = 37.46m
+ };
+ context.SurfaceLineEntities.Add(entity);
+
+ // Precondition
+ CollectionAssert.IsEmpty(context.SurfaceLinePointEntities);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ surfaceLine.Update(registry, context);
+
+ // Assert
+ Assert.AreEqual(surfaceLine.Name, entity.Name);
+ Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX);
+ Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY);
+
+ Assert.AreEqual(surfaceLine.Points.Length, entity.SurfaceLinePointEntities.Count);
+ for (int i = 0; i < surfaceLine.Points.Length; i++)
+ {
+ Point3D geometryPoint = surfaceLine.Points[i];
+ SurfaceLinePointEntity pointEntity = entity.SurfaceLinePointEntities.ElementAt(i);
+
+ Assert.AreEqual(geometryPoint.X, pointEntity.X);
+ Assert.AreEqual(geometryPoint.Y, pointEntity.Y);
+ Assert.AreEqual(geometryPoint.Z, pointEntity.Z);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_SurfaceLineWithUpdatedGeometry_SurfaceLineEntityUpdatedAndGeometryChanged()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ RingtoetsPipingSurfaceLine surfaceLine = CreateSavedSurfaceLineWithGeometry();
+
+ var pointEntity1 = new SurfaceLinePointEntity
+ {
+ SurfaceLinePointEntityId = 1,
+ Order = 0,
+ X = 1.0m,
+ Y = 2.0m,
+ Z = 3.0m
+ };
+ var pointEntity2 = new SurfaceLinePointEntity
+ {
+ SurfaceLinePointEntityId = 2,
+ Order = 1,
+ X = 5.0m,
+ Y = 2.0m,
+ Z = 4.0m
+ };
+
+ var entity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = surfaceLine.StorageId,
+ Name = "",
+ ReferenceLineIntersectionX = 91.28m,
+ ReferenceLineIntersectionY = 37.46m,
+ SurfaceLinePointEntities =
+ {
+ pointEntity1,
+ pointEntity2
+ }
+ };
+ context.SurfaceLineEntities.Add(entity);
+ context.SurfaceLinePointEntities.Add(pointEntity1);
+ context.SurfaceLinePointEntities.Add(pointEntity2);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ surfaceLine.Update(registry, context);
+
+ // Assert
+ Assert.AreEqual(surfaceLine.Name, entity.Name);
+ Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX);
+ Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY);
+
+ Assert.AreEqual(surfaceLine.Points.Length, entity.SurfaceLinePointEntities.Count);
+ for (int i = 0; i < surfaceLine.Points.Length; i++)
+ {
+ Point3D geometryPoint = surfaceLine.Points[i];
+ SurfaceLinePointEntity pointEntity = entity.SurfaceLinePointEntities.ElementAt(i);
+
+ Assert.AreEqual(geometryPoint.X, pointEntity.X);
+ Assert.AreEqual(geometryPoint.Y, pointEntity.Y);
+ Assert.AreEqual(geometryPoint.Z, pointEntity.Z);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_SurfaceLineIdenticalGeometry_SurfaceLineEntityUpdatedAndGeometrySaved()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ RingtoetsPipingSurfaceLine surfaceLine = CreateSavedSurfaceLineWithGeometry();
+
+ var entity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = surfaceLine.StorageId
+ };
+ context.SurfaceLineEntities.Add(entity);
+ var createCollector = new PersistenceRegistry();
+ for (int i = 0; i < surfaceLine.Points.Length; i++)
+ {
+ var geometryPoint = surfaceLine.Points[i];
+ SurfaceLinePointEntity pointEntity = geometryPoint.CreateSurfaceLinePointEntity(createCollector, i);
+
+ geometryPoint.StorageId = i + 1;
+ pointEntity.SurfaceLinePointEntityId = geometryPoint.StorageId;
+
+ entity.SurfaceLinePointEntities.Add(pointEntity);
+ context.SurfaceLinePointEntities.Add(pointEntity);
+ }
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ surfaceLine.Update(registry, context);
+
+ // Assert
+ Assert.AreEqual(surfaceLine.Points.Length, entity.SurfaceLinePointEntities.Count);
+ for (int i = 0; i < surfaceLine.Points.Length; i++)
+ {
+ Point3D geometryPoint = surfaceLine.Points[i];
+ SurfaceLinePointEntity pointEntity = entity.SurfaceLinePointEntities.ElementAt(i);
+
+ Assert.AreEqual(geometryPoint.X, pointEntity.X);
+ Assert.AreEqual(geometryPoint.Y, pointEntity.Y);
+ Assert.AreEqual(geometryPoint.Z, pointEntity.Z);
+ Assert.AreEqual(geometryPoint.StorageId, pointEntity.SurfaceLinePointEntityId);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_SurfaceLineWithNewGeometryAndCharacteristicPoints_SurfaceLineEntityUpdatedAndGeometryPlusCharacteristicPointsSaved()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ RingtoetsPipingSurfaceLine surfaceLine = CreateSavedSurfaceLineWithData();
+
+ var entity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = surfaceLine.StorageId
+ };
+ context.SurfaceLineEntities.Add(entity);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ surfaceLine.Update(registry, context);
+
+ // Assert
+ Assert.AreEqual(surfaceLine.Points.Length, entity.SurfaceLinePointEntities.Count);
+
+ int dikeToeRiverIndex = GetGeometryPointIndexForCharacteristicPoint(surfaceLine, surfaceLine.DikeToeAtRiver);
+ int dikeToePolderIndex = GetGeometryPointIndexForCharacteristicPoint(surfaceLine, surfaceLine.DikeToeAtPolder);
+ int ditchDikeSideIndex = GetGeometryPointIndexForCharacteristicPoint(surfaceLine, surfaceLine.DitchDikeSide);
+ int bottomDitchDikeSideIndex = GetGeometryPointIndexForCharacteristicPoint(surfaceLine, surfaceLine.BottomDitchDikeSide);
+ int buttomDitchPolderSideIndex = GetGeometryPointIndexForCharacteristicPoint(surfaceLine, surfaceLine.BottomDitchPolderSide);
+ int ditchPolderSide = GetGeometryPointIndexForCharacteristicPoint(surfaceLine, surfaceLine.DitchPolderSide);
+
+ var surfaceLinePointEntities = entity.SurfaceLinePointEntities.OrderBy(pe => pe.Order).ToArray();
+ for (int i = 0; i < surfaceLine.Points.Length; i++)
+ {
+ Point3D geometryPoint = surfaceLine.Points[i];
+ SurfaceLinePointEntity pointEntity = surfaceLinePointEntities[i];
+
+ Assert.AreEqual(geometryPoint.X, pointEntity.X);
+ Assert.AreEqual(geometryPoint.Y, pointEntity.Y);
+ Assert.AreEqual(geometryPoint.Z, pointEntity.Z);
+
+ if (i == dikeToeRiverIndex)
+ {
+ Assert.AreEqual(surfaceLine.DikeToeAtRiver.X, pointEntity.X);
+ Assert.AreEqual(surfaceLine.DikeToeAtRiver.Y, pointEntity.Y);
+ Assert.AreEqual(surfaceLine.DikeToeAtRiver.Z, pointEntity.Z);
+ CollectionAssert.Contains(pointEntity.CharacteristicPointEntities.Select(cpe => cpe.CharacteristicPointType),
+ (short)CharacteristicPointType.DikeToeAtRiver);
+ }
+ if (i == dikeToePolderIndex)
+ {
+ Assert.AreEqual(surfaceLine.DikeToeAtPolder.X, pointEntity.X);
+ Assert.AreEqual(surfaceLine.DikeToeAtPolder.Y, pointEntity.Y);
+ Assert.AreEqual(surfaceLine.DikeToeAtPolder.Z, pointEntity.Z);
+ CollectionAssert.Contains(pointEntity.CharacteristicPointEntities.Select(cpe => cpe.CharacteristicPointType),
+ (short)CharacteristicPointType.DikeToeAtPolder);
+ }
+ if (i == ditchDikeSideIndex)
+ {
+ Assert.AreEqual(surfaceLine.DitchDikeSide.X, pointEntity.X);
+ Assert.AreEqual(surfaceLine.DitchDikeSide.Y, pointEntity.Y);
+ Assert.AreEqual(surfaceLine.DitchDikeSide.Z, pointEntity.Z);
+ CollectionAssert.Contains(pointEntity.CharacteristicPointEntities.Select(cpe => cpe.CharacteristicPointType),
+ (short)CharacteristicPointType.DitchDikeSide);
+ }
+ if (i == bottomDitchDikeSideIndex)
+ {
+ Assert.AreEqual(surfaceLine.BottomDitchDikeSide.X, pointEntity.X);
+ Assert.AreEqual(surfaceLine.BottomDitchDikeSide.Y, pointEntity.Y);
+ Assert.AreEqual(surfaceLine.BottomDitchDikeSide.Z, pointEntity.Z);
+ CollectionAssert.Contains(pointEntity.CharacteristicPointEntities.Select(cpe => cpe.CharacteristicPointType),
+ (short)CharacteristicPointType.BottomDitchDikeSide);
+ }
+ if (i == buttomDitchPolderSideIndex)
+ {
+ Assert.AreEqual(surfaceLine.BottomDitchPolderSide.X, pointEntity.X);
+ Assert.AreEqual(surfaceLine.BottomDitchPolderSide.Y, pointEntity.Y);
+ Assert.AreEqual(surfaceLine.BottomDitchPolderSide.Z, pointEntity.Z);
+ CollectionAssert.Contains(pointEntity.CharacteristicPointEntities.Select(cpe => cpe.CharacteristicPointType),
+ (short)CharacteristicPointType.BottomDitchPolderSide);
+ }
+ if (i == ditchPolderSide)
+ {
+ Assert.AreEqual(surfaceLine.DitchPolderSide.X, pointEntity.X);
+ Assert.AreEqual(surfaceLine.DitchPolderSide.Y, pointEntity.Y);
+ Assert.AreEqual(surfaceLine.DitchPolderSide.Z, pointEntity.Z);
+ CollectionAssert.Contains(pointEntity.CharacteristicPointEntities.Select(cpe => cpe.CharacteristicPointType),
+ (short)CharacteristicPointType.DitchPolderSide);
+ }
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_SurfaceLineWithCharacteristicPoints_CharacteristicPointEntitiesRegistered()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ RingtoetsPipingSurfaceLine surfaceLine = CreateSavedSurfaceLineWithData();
+
+ var entity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = surfaceLine.StorageId
+ };
+ context.SurfaceLineEntities.Add(entity);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ surfaceLine.Update(registry, context);
+
+ // Assert
+ CharacteristicPointEntity[] characteristicPointEntities = entity.SurfaceLinePointEntities
+ .SelectMany(slpe => slpe.CharacteristicPointEntities)
+ .ToArray();
+ foreach (CharacteristicPointEntity characteristicPointEntity in characteristicPointEntities)
+ {
+ context.CharacteristicPointEntities.Add(characteristicPointEntity);
+ }
+ registry.RemoveUntouched(context);
+ Assert.AreEqual(characteristicPointEntities.Length, context.CharacteristicPointEntities.Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(CharacteristicPointType.BottomDitchDikeSide)]
+ [TestCase(CharacteristicPointType.BottomDitchPolderSide)]
+ [TestCase(CharacteristicPointType.DikeToeAtPolder)]
+ [TestCase(CharacteristicPointType.DikeToeAtRiver)]
+ [TestCase(CharacteristicPointType.DitchDikeSide)]
+ [TestCase(CharacteristicPointType.DitchPolderSide)]
+ public void Update_SurfaceLineRemovedCharacteristicPoint_CharacteristicPointEntityRemoved(CharacteristicPointType type)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ RingtoetsPipingSurfaceLine surfaceLine = CreateSavedSurfaceLineWithGeometry();
+
+ int index = 0;
+ var surfaceLinePointEntities = surfaceLine.Points.Select(p => new SurfaceLinePointEntity
+ {
+ SurfaceLinePointEntityId = p.StorageId,
+ Order = index++,
+ X = Convert.ToDecimal(p.X),
+ Y = Convert.ToDecimal(p.Y),
+ Z = Convert.ToDecimal(p.Z),
+ }).ToArray();
+
+ var characteristicPointEntity = new CharacteristicPointEntity
+ {
+ CharacteristicPointEntityId = 1,
+ CharacteristicPointType = (short)type,
+ SurfaceLinePointEntity = surfaceLinePointEntities[0]
+ };
+ surfaceLinePointEntities[0].CharacteristicPointEntities.Add(characteristicPointEntity);
+
+ var entity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = surfaceLine.StorageId,
+ };
+ foreach (SurfaceLinePointEntity pointEntity in surfaceLinePointEntities)
+ {
+ entity.SurfaceLinePointEntities.Add(pointEntity);
+ context.SurfaceLinePointEntities.Add(pointEntity);
+ }
+
+ context.SurfaceLineEntities.Add(entity);
+ context.CharacteristicPointEntities.Add(characteristicPointEntity);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ surfaceLine.Update(registry, context);
+
+ // Assert
+ Assert.IsNull(characteristicPointEntity.SurfaceLinePointEntity);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_SurfaceLineWithChangedCharacteristicPoints_CharacteristicPointEntitiesUpdated()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ RingtoetsPipingSurfaceLine surfaceLine = CreateSavedSurfaceLineWithData();
+
+ int index = 0;
+ var surfaceLinePointEntities = surfaceLine.Points.Select(p => new SurfaceLinePointEntity
+ {
+ SurfaceLinePointEntityId = p.StorageId,
+ Order = index++,
+ X = Convert.ToDecimal(p.X),
+ Y = Convert.ToDecimal(p.Y),
+ Z = Convert.ToDecimal(p.Z),
+ }).ToArray();
+
+ SurfaceLinePointEntity originalGeometryPointMarkedCharacteristic = surfaceLinePointEntities[1];
+ var characteristicPointEntities = CreateCharacteristicPointEntities(originalGeometryPointMarkedCharacteristic);
+
+ var entity = new SurfaceLineEntity
+ {
+ SurfaceLineEntityId = surfaceLine.StorageId
+ };
+ foreach (SurfaceLinePointEntity pointEntity in surfaceLinePointEntities)
+ {
+ entity.SurfaceLinePointEntities.Add(pointEntity);
+ context.SurfaceLinePointEntities.Add(pointEntity);
+ }
+ foreach (CharacteristicPointEntity characteristicPointEntity in characteristicPointEntities)
+ {
+ characteristicPointEntity.SurfaceLinePointEntity.CharacteristicPointEntities.Add(characteristicPointEntity);
+ context.CharacteristicPointEntities.Add(characteristicPointEntity);
+ }
+ context.SurfaceLineEntities.Add(entity);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ surfaceLine.Update(registry, context);
+
+ // Assert
+ foreach (CharacteristicPointEntity characteristicPointEntity in characteristicPointEntities)
+ {
+ Assert.AreNotEqual(originalGeometryPointMarkedCharacteristic, characteristicPointEntity.SurfaceLinePointEntity);
+ }
+ mocks.VerifyAll();
+ }
+
+ private CharacteristicPointEntity[] CreateCharacteristicPointEntities(SurfaceLinePointEntity pointEntity)
+ {
+ var characteristicPointEntities = new CharacteristicPointEntity[6];
+
+ characteristicPointEntities[0] = new CharacteristicPointEntity
+ {
+ CharacteristicPointEntityId = 1,
+ CharacteristicPointType = (short)CharacteristicPointType.DikeToeAtRiver,
+ SurfaceLinePointEntity = pointEntity
+ };
+ characteristicPointEntities[1] = new CharacteristicPointEntity
+ {
+ CharacteristicPointEntityId = 2,
+ CharacteristicPointType = (short)CharacteristicPointType.DikeToeAtPolder,
+ SurfaceLinePointEntity = pointEntity
+ };
+ characteristicPointEntities[2] = new CharacteristicPointEntity
+ {
+ CharacteristicPointEntityId = 3,
+ CharacteristicPointType = (short)CharacteristicPointType.DitchDikeSide,
+ SurfaceLinePointEntity = pointEntity
+ };
+ characteristicPointEntities[3] = new CharacteristicPointEntity
+ {
+ CharacteristicPointEntityId = 4,
+ CharacteristicPointType = (short)CharacteristicPointType.BottomDitchDikeSide,
+ SurfaceLinePointEntity = pointEntity
+ };
+ characteristicPointEntities[4] = new CharacteristicPointEntity
+ {
+ CharacteristicPointEntityId = 5,
+ CharacteristicPointType = (short)CharacteristicPointType.BottomDitchPolderSide,
+ SurfaceLinePointEntity = pointEntity
+ };
+ characteristicPointEntities[5] = new CharacteristicPointEntity
+ {
+ CharacteristicPointEntityId = 6,
+ CharacteristicPointType = (short)CharacteristicPointType.DitchPolderSide,
+ SurfaceLinePointEntity = pointEntity
+ };
+
+ return characteristicPointEntities;
+ }
+
+ private static int GetGeometryPointIndexForCharacteristicPoint(RingtoetsPipingSurfaceLine surfaceLine, Point3D characteristicPoint)
+ {
+ int index = -1;
+ for (int i = 0; i < surfaceLine.Points.Length; i++)
+ {
+ if (surfaceLine.Points[i].Equals(characteristicPoint))
+ {
+ return i;
+ }
+ }
+ return index;
+ }
+
+ private static RingtoetsPipingSurfaceLine CreateSavedSurfaceLineWithGeometry()
+ {
+ var geometryPoints = new[]
+ {
+ new Point3D(1.1, 2.2, 3.3)
+ {
+ StorageId = 38472
+ },
+ new Point3D(4.4, 5.5, 6.6)
+ {
+ StorageId = 4095
+ }
+ };
+ var surfaceLine = new RingtoetsPipingSurfaceLine
+ {
+ StorageId = 14843246,
+ Name = "",
+ ReferenceLineIntersectionWorldPoint = new Point2D(08.05, 20.16)
+ };
+ surfaceLine.SetGeometry(geometryPoints);
+ return surfaceLine;
+ }
+
+ private static RingtoetsPipingSurfaceLine CreateSavedSurfaceLineWithData()
+ {
+ var geometryPoints = new[]
+ {
+ new Point3D(1.1, 2.2, 3.3)
+ {
+ StorageId = 340985
+ },
+ new Point3D(4.4, 5.5, 6.6)
+ {
+ StorageId = 4058
+ },
+ new Point3D(7.7, 8.8, 9.9)
+ {
+ StorageId = 39485
+ },
+ new Point3D(10.10, 11.11, 12.12)
+ {
+ StorageId = 280347
+ },
+ new Point3D(13.13, 14.14, 15.15)
+ {
+ StorageId = 43059
+ },
+ new Point3D(16.16, 17.17, 18.18)
+ {
+ StorageId = 2390
+ },
+ new Point3D(19.19, 20.20, 21.21)
+ {
+ StorageId = 43
+ },
+ new Point3D(22.22, 23.23, 24.24)
+ {
+ StorageId = 325
+ }
+ };
+ var surfaceLine = new RingtoetsPipingSurfaceLine
+ {
+ StorageId = 4256,
+ Name = "",
+ ReferenceLineIntersectionWorldPoint = new Point2D(07.11, 19.87)
+ };
+ surfaceLine.SetGeometry(geometryPoints);
+ surfaceLine.SetBottomDitchDikeSideAt(geometryPoints[0]);
+ surfaceLine.SetBottomDitchPolderSideAt(geometryPoints[2]);
+ surfaceLine.SetDikeToeAtPolderAt(geometryPoints[3]);
+ surfaceLine.SetDikeToeAtRiverAt(geometryPoints[4]);
+ surfaceLine.SetDitchDikeSideAt(geometryPoints[5]);
+ surfaceLine.SetDitchPolderSideAt(geometryPoints[7]);
+ return surfaceLine;
+ }
+
+ private RingtoetsPipingSurfaceLine CreateSavedSurfaceLineWithoutGeometry()
+ {
+ return new RingtoetsPipingSurfaceLine
+ {
+ StorageId = 93584793,
+ Name = "",
+ ReferenceLineIntersectionWorldPoint = new Point2D(1.2, 3.4)
+ };
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/StochasticSoilModelUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/StochasticSoilModelUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/StochasticSoilModelUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,441 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.Piping;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Data.TestUtil;
+using Ringtoets.Piping.KernelWrapper.TestUtil;
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Test.Update.Piping
+{
+ [TestFixture]
+ public class StochasticSoilModelUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var soilModel = new TestStochasticSoilModel();
+
+ // Call
+ TestDelegate test = () => soilModel.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var soilModel = new TestStochasticSoilModel();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ soilModel.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoStochasticSoilModel_EntityNotFoundException()
+ {
+ // Setup
+ var soilModel = new TestStochasticSoilModel();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ soilModel.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'StochasticSoilModelEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoStochasticSoilModelWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var soilModel = new StochasticSoilModel(-storageId, "name", "segment name")
+ {
+ StorageId = storageId,
+ };
+
+ ringtoetsEntities.StochasticSoilModelEntities.Add(new StochasticSoilModelEntity
+ {
+ StochasticSoilModelEntityId = 2,
+ Name = string.Empty,
+ SegmentName = string.Empty
+ });
+
+ // Call
+ TestDelegate test = () => soilModel.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'StochasticSoilModelEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithStochasticSoilModel_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ string newName = "new name";
+ string newSegmentName = "new segment name";
+ var soilModel = new StochasticSoilModel(-1, newName, newSegmentName)
+ {
+ StorageId = 1,
+ };
+
+ var modelEntity = new StochasticSoilModelEntity
+ {
+ StochasticSoilModelEntityId = 1,
+ Name = string.Empty,
+ SegmentName = string.Empty
+ };
+
+ ringtoetsEntities.StochasticSoilModelEntities.Add(modelEntity);
+
+ // Call
+ soilModel.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(newName, modelEntity.Name);
+ Assert.AreEqual(newSegmentName, modelEntity.SegmentName);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithNewStochasticSoilProfile_StochasticSoilProfileAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var soilModel = new StochasticSoilModel(-1, string.Empty, string.Empty)
+ {
+ StorageId = 1,
+ StochasticSoilProfiles =
+ {
+ new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, -1)
+ {
+ SoilProfile = new TestPipingSoilProfile()
+ }
+ }
+ };
+
+ var soilModelEntity = new StochasticSoilModelEntity
+ {
+ StochasticSoilModelEntityId = 1
+ };
+
+ ringtoetsEntities.StochasticSoilModelEntities.Add(soilModelEntity);
+
+ // Call
+ soilModel.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, soilModelEntity.StochasticSoilProfileEntities.Count);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithUpdatedStochasticSoilProfile_NoNewStochasticSoilProfileAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var soilModel = new StochasticSoilModel(-1, string.Empty, string.Empty)
+ {
+ StorageId = 1,
+ StochasticSoilProfiles =
+ {
+ new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, -1)
+ {
+ StorageId = 1,
+ SoilProfile = new TestPipingSoilProfile()
+ }
+ }
+ };
+
+ var soilProfileEntity = new StochasticSoilProfileEntity
+ {
+ StochasticSoilProfileEntityId = 1
+ };
+ var soilModelEntity = new StochasticSoilModelEntity
+ {
+ StochasticSoilModelEntityId = 1,
+ StochasticSoilProfileEntities =
+ {
+ soilProfileEntity
+ }
+ };
+
+ ringtoetsEntities.StochasticSoilModelEntities.Add(soilModelEntity);
+ ringtoetsEntities.StochasticSoilProfileEntities.Add(soilProfileEntity);
+
+ // Call
+ soilModel.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ CollectionAssert.AreEqual(new [] {soilProfileEntity}, soilModelEntity.StochasticSoilProfileEntities);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithDifferentGeometry_StochasticSoilModelSegmentPointEntitiesReplacesWithNewEntities()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ IRingtoetsEntities context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ const long soilModelId = 1;
+ var soilModel = new StochasticSoilModel(soilModelId, "A", "B")
+ {
+ StorageId = soilModelId
+ };
+ soilModel.Geometry.AddRange(new[]
+ {
+ new Point2D(1.1, 2.2),
+ new Point2D(3.3, 4.4)
+ });
+
+ var originalPointEntity = new StochasticSoilModelSegmentPointEntity
+ {
+ StochasticSoilModelSegmentPointEntityId = 1,
+ Order = 0,
+ X = 5.5m,
+ Y = 6.6m
+ };
+ var soilModelEntity = new StochasticSoilModelEntity
+ {
+ StochasticSoilModelEntityId = soilModelId,
+ StochasticSoilModelSegmentPointEntities =
+ {
+ originalPointEntity
+ }
+ };
+ context.StochasticSoilModelEntities.Add(soilModelEntity);
+ context.StochasticSoilModelSegmentPointEntities.Add(originalPointEntity);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ soilModel.Update(registry, context);
+
+ // Assert
+ Assert.AreEqual(2, soilModelEntity.StochasticSoilModelSegmentPointEntities.Count);
+
+ StochasticSoilModelSegmentPointEntity[] pointEntities = soilModelEntity.StochasticSoilModelSegmentPointEntities.ToArray();
+ StochasticSoilModelSegmentPointEntity point1Entity = pointEntities[0];
+ Assert.AreEqual(soilModel.Geometry[0].X, point1Entity.X);
+ Assert.AreEqual(soilModel.Geometry[0].Y, point1Entity.Y);
+ Assert.AreEqual(0, point1Entity.Order);
+
+ StochasticSoilModelSegmentPointEntity point2Entity = pointEntities[1];
+ Assert.AreEqual(soilModel.Geometry[1].X, point2Entity.X);
+ Assert.AreEqual(soilModel.Geometry[1].Y, point2Entity.Y);
+ Assert.AreEqual(1, point2Entity.Order);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithDifferentGeometry2_StochasticSoilModelSegmentPointEntitiesReplacesWithNewEntities()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ IRingtoetsEntities context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ const long soilModelId = 1;
+ var soilModel = new StochasticSoilModel(soilModelId, "A", "B")
+ {
+ StorageId = soilModelId
+ };
+ soilModel.Geometry.AddRange(new[]
+ {
+ new Point2D(1.1, 2.2),
+ new Point2D(3.3, 4.4)
+ });
+
+ var originalPointEntity1 = new StochasticSoilModelSegmentPointEntity
+ {
+ StochasticSoilModelSegmentPointEntityId = 1,
+ Order = 0,
+ X = 5.5m,
+ Y = 6.6m
+ };
+ var originalPointEntity2 = new StochasticSoilModelSegmentPointEntity
+ {
+ StochasticSoilModelSegmentPointEntityId = 2,
+ Order = 1,
+ X = 7.7m,
+ Y = 8.8m
+ };
+ var soilModelEntity = new StochasticSoilModelEntity
+ {
+ StochasticSoilModelEntityId = soilModelId,
+ StochasticSoilModelSegmentPointEntities =
+ {
+ originalPointEntity1,
+ originalPointEntity2
+ }
+ };
+ context.StochasticSoilModelEntities.Add(soilModelEntity);
+ context.StochasticSoilModelSegmentPointEntities.Add(originalPointEntity1);
+ context.StochasticSoilModelSegmentPointEntities.Add(originalPointEntity2);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ soilModel.Update(registry, context);
+
+ // Assert
+ Assert.AreEqual(2, soilModelEntity.StochasticSoilModelSegmentPointEntities.Count);
+
+ StochasticSoilModelSegmentPointEntity[] pointEntities = soilModelEntity.StochasticSoilModelSegmentPointEntities.ToArray();
+ StochasticSoilModelSegmentPointEntity point1Entity = pointEntities[0];
+ Assert.AreEqual(soilModel.Geometry[0].X, point1Entity.X);
+ Assert.AreEqual(soilModel.Geometry[0].Y, point1Entity.Y);
+ Assert.AreEqual(0, point1Entity.Order);
+
+ StochasticSoilModelSegmentPointEntity point2Entity = pointEntities[1];
+ Assert.AreEqual(soilModel.Geometry[1].X, point2Entity.X);
+ Assert.AreEqual(soilModel.Geometry[1].Y, point2Entity.Y);
+ Assert.AreEqual(1, point2Entity.Order);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithSameGeometry_NoStochasticSoilModelSegmentPointEntitiesAreReplaced()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ IRingtoetsEntities context = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ const long soilModelId = 1;
+ var soilModel = new StochasticSoilModel(soilModelId, "A", "B")
+ {
+ StorageId = soilModelId
+ };
+ soilModel.Geometry.AddRange(new[]
+ {
+ new Point2D(1.1, 2.2),
+ new Point2D(3.3, 4.4)
+ });
+
+ var originalPointEntity1 = new StochasticSoilModelSegmentPointEntity
+ {
+ StochasticSoilModelSegmentPointEntityId = 1,
+ Order = 0,
+ X = Convert.ToDecimal(soilModel.Geometry[0].X),
+ Y = Convert.ToDecimal(soilModel.Geometry[0].Y)
+ };
+ var originalPointEntity2 = new StochasticSoilModelSegmentPointEntity
+ {
+ StochasticSoilModelSegmentPointEntityId = 2,
+ Order = 1,
+ X = Convert.ToDecimal(soilModel.Geometry[1].X),
+ Y = Convert.ToDecimal(soilModel.Geometry[1].Y)
+ };
+ var soilModelEntity = new StochasticSoilModelEntity
+ {
+ StochasticSoilModelEntityId = soilModelId,
+ StochasticSoilModelSegmentPointEntities =
+ {
+ originalPointEntity1,
+ originalPointEntity2
+ }
+ };
+ context.StochasticSoilModelEntities.Add(soilModelEntity);
+ context.StochasticSoilModelSegmentPointEntities.Add(originalPointEntity1);
+ context.StochasticSoilModelSegmentPointEntities.Add(originalPointEntity2);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ soilModel.Update(registry, context);
+
+ // Assert
+ StochasticSoilModelSegmentPointEntity[] segmentPointEntities = context.StochasticSoilModelSegmentPointEntities.ToArray();
+ CollectionAssert.Contains(segmentPointEntities, originalPointEntity1);
+ CollectionAssert.Contains(segmentPointEntities, originalPointEntity2);
+ Assert.AreEqual(2, segmentPointEntities.Length);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/StochasticSoilProfileUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/StochasticSoilProfileUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/StochasticSoilProfileUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,208 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.Piping;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.KernelWrapper.TestUtil;
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Test.Update.Piping
+{
+ [TestFixture]
+ public class StochasticSoilProfileUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var soilProfile = new TestStochasticSoilProfile();
+
+ // Call
+ TestDelegate test = () => soilProfile.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var soilProfile = new TestStochasticSoilProfile();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ soilProfile.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoStochasticSoilProfile_EntityNotFoundException()
+ {
+ // Setup
+ var soilProfile = new TestStochasticSoilProfile();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ soilProfile.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'StochasticSoilProfileEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_WithNoStochasticSoilProfileWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var soilProfile = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, -1)
+ {
+ StorageId = storageId,
+ SoilProfile = new TestPipingSoilProfile()
+ };
+
+ ringtoetsEntities.StochasticSoilProfileEntities.Add(new StochasticSoilProfileEntity
+ {
+ StochasticSoilProfileEntityId = 2,
+ });
+
+ // Call
+ TestDelegate test = () => soilProfile.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'StochasticSoilProfileEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithNewStochasticSoilProfile_PropertiesUpdatedSoilProfileAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var newProbability = 0.5;
+ var soilProfile = new StochasticSoilProfile(newProbability, SoilProfileType.SoilProfile1D, -1)
+ {
+ StorageId = 1,
+ SoilProfile = new TestPipingSoilProfile()
+ };
+
+ var soilProfileEntity = new StochasticSoilProfileEntity
+ {
+ StochasticSoilProfileEntityId = 1,
+ Probability = 0
+ };
+
+ ringtoetsEntities.StochasticSoilProfileEntities.Add(soilProfileEntity);
+
+ // Call
+ soilProfile.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(newProbability, soilProfileEntity.Probability);
+ Assert.NotNull(soilProfileEntity.SoilProfileEntity);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithUpdatedStochasticSoilProfile_InstanceReferenceNotChanged()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var soilProfile = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, -1)
+ {
+ StorageId = 1,
+ SoilProfile = new TestPipingSoilProfile
+ {
+ StorageId = 1
+ }
+ };
+
+ var soilProfileEntity = new SoilProfileEntity
+ {
+ SoilProfileEntityId = 1
+ };
+ var stochasticSoilProfileEntity = new StochasticSoilProfileEntity
+ {
+ StochasticSoilProfileEntityId = 1,
+ SoilProfileEntity = soilProfileEntity
+ };
+
+ ringtoetsEntities.StochasticSoilProfileEntities.Add(stochasticSoilProfileEntity);
+ ringtoetsEntities.SoilProfileEntities.Add(soilProfileEntity);
+
+ // Call
+ soilProfile.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreSame(soilProfileEntity, stochasticSoilProfileEntity.SoilProfileEntity);
+
+ mocks.VerifyAll();
+ }
+ }
+
+ public class TestStochasticSoilProfile : StochasticSoilProfile {
+ public TestStochasticSoilProfile() : base(0.5, SoilProfileType.SoilProfile1D, -1) {}
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/PipingCalculationScenarioUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/PipingFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/PipingFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/PipingProbabilityAssessmentInputUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/PipingSoilLayerUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/PipingSoilProfileUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/PipingStructure/PipingStructureFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/PipingStructure/PipingStructureFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/PipingStructure/PipingStructureFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,200 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.PipingStructure;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Update.PipingStructure
+{
+ [TestFixture]
+ public class PipingStructureFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new PipingStructureFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new PipingStructureFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoPipingStructureSectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new PipingStructureFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'PipingStructureSectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoPipingStructureSectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new PipingStructureFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.PipingStructureSectionResultEntities.Add(new PipingStructureSectionResultEntity
+ {
+ PipingStructureSectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'PipingStructureSectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithPipingStructureSectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new PipingStructureFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new PipingStructureSectionResultEntity
+ {
+ PipingStructureSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerTwoA = Convert.ToByte(AssessmentLayerTwoAResult.Successful),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.PipingStructureSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), sectionResultEntity.LayerOne);
+ Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerTwoA), sectionResultEntity.LayerTwoA);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new PipingStructureFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new PipingStructureSectionResultEntity
+ {
+ PipingStructureSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.PipingStructureSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/PipingStructure/PipingStructureFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/PipingStructure/PipingStructureFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/PipingStructure/PipingStructureFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,247 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.PipingStructure;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Test.Update.PipingStructure
+{
+ [TestFixture]
+ public class PipingStructureFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new PipingStructureFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new PipingStructureFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoPipingStructureFailureMechanism_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new PipingStructureFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoPipingStructureFailureMechanismWithId_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new PipingStructureFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithPipingStructureFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingStructureFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true
+ };
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ IsRelevant = Convert.ToByte(false)
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingStructureFailureMechanism
+ {
+ StorageId = 1
+ };
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.PipingStructureSectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingStructureFailureMechanism
+ {
+ StorageId = 1
+ };
+ var testName = "testName";
+ failureMechanism.AddSection(new FailureMechanismSection(testName, new[]
+ {
+ new Point2D(0, 0)
+ })
+ {
+ StorageId = 1
+ });
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = 1,
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.PipingStructureSectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/PipingStructureFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/PipingStructureFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/RingtoetsPipingSurfaceLineUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StabilityStoneCover/StabilityStoneCoverFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StabilityStoneCover/StabilityStoneCoverFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StabilityStoneCover/StabilityStoneCoverFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,195 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.StabilityStoneCover;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Update.StabilityStoneCover
+{
+ [TestFixture]
+ public class StabilityStoneCoverFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new StabilityStoneCoverFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new StabilityStoneCoverFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoStabilityStoneCoverSectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new StabilityStoneCoverFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'StabilityStoneCoverSectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoStabilityStoneCoverSectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new StabilityStoneCoverFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.StabilityStoneCoverSectionResultEntities.Add(new StabilityStoneCoverSectionResultEntity
+ {
+ StabilityStoneCoverSectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'StabilityStoneCoverSectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithStabilityStoneCoverSectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new StabilityStoneCoverFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new StabilityStoneCoverSectionResultEntity
+ {
+ StabilityStoneCoverSectionResultEntityId = sectionResult.StorageId,
+ LayerTwoA = Convert.ToByte(AssessmentLayerTwoAResult.Successful),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.StabilityStoneCoverSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(sectionResult.AssessmentLayerTwoA), sectionResultEntity.LayerTwoA);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new StabilityStoneCoverFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new StabilityStoneCoverSectionResultEntity
+ {
+ StabilityStoneCoverSectionResultEntityId = sectionResult.StorageId,
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.StabilityStoneCoverSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StabilityStoneCover/StabilityStoneCoverFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StabilityStoneCover/StabilityStoneCoverFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StabilityStoneCover/StabilityStoneCoverFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,247 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.StabilityStoneCover;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Test.Update.StabilityStoneCover
+{
+ [TestFixture]
+ public class StabilityStoneCoverFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new StabilityStoneCoverFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new StabilityStoneCoverFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoStabilityStoneCoverFailureMechanism_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new StabilityStoneCoverFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoStabilityStoneCoverFailureMechanismWithId_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new StabilityStoneCoverFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithStabilityStoneCoverFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new StabilityStoneCoverFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true
+ };
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ IsRelevant = Convert.ToByte(false)
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new StabilityStoneCoverFailureMechanism
+ {
+ StorageId = 1
+ };
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.StabilityStoneCoverSectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new StabilityStoneCoverFailureMechanism
+ {
+ StorageId = 1
+ };
+ var testName = "testName";
+ failureMechanism.AddSection(new FailureMechanismSection(testName, new[]
+ {
+ new Point2D(0, 0)
+ })
+ {
+ StorageId = 1
+ });
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = 1,
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.StabilityStoneCoverSectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StabilityStoneCoverFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StabilityStoneCoverFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StochasticSoilModelUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StochasticSoilProfileUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityLengthwiseConstruction/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityLengthwiseConstruction/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityLengthwiseConstruction/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,196 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.StrengthStabilityLengthwiseConstruction;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Update.StrengthStabilityLengthwiseConstruction
+{
+ [TestFixture]
+ public class StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoStrengthStabilityLengthwiseConstructionSectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'StrengthStabilityLengthwiseConstructionSectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoStrengthStabilityLengthwiseConstructionSectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.StrengthStabilityLengthwiseConstructionSectionResultEntities.Add(new StrengthStabilityLengthwiseConstructionSectionResultEntity
+ {
+ StrengthStabilityLengthwiseConstructionSectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'StrengthStabilityLengthwiseConstructionSectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithStrengthStabilityLengthwiseConstructionSectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new StrengthStabilityLengthwiseConstructionSectionResultEntity
+ {
+ StrengthStabilityLengthwiseConstructionSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.StrengthStabilityLengthwiseConstructionSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), sectionResultEntity.LayerOne);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new StrengthStabilityLengthwiseConstructionSectionResultEntity
+ {
+ StrengthStabilityLengthwiseConstructionSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.StrengthStabilityLengthwiseConstructionSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityLengthwiseConstruction/StrengthStabilityLengthwiseConstructionFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityLengthwiseConstruction/StrengthStabilityLengthwiseConstructionFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityLengthwiseConstruction/StrengthStabilityLengthwiseConstructionFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,247 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.StrengthStabilityLengthwiseConstruction;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Test.Update.StrengthStabilityLengthwiseConstruction
+{
+ [TestFixture]
+ public class StrengthStabilityLengthwiseConstructionFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoStrengthStabilityLengthwiseConstructionFailureMechanism_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoStrengthStabilityLengthwiseConstructionFailureMechanismWithId_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithStrengthStabilityLengthwiseConstructionFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true
+ };
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ IsRelevant = Convert.ToByte(false)
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism
+ {
+ StorageId = 1
+ };
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.StrengthStabilityLengthwiseConstructionSectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism
+ {
+ StorageId = 1
+ };
+ var testName = "testName";
+ failureMechanism.AddSection(new FailureMechanismSection(testName, new[]
+ {
+ new Point2D(0, 0)
+ })
+ {
+ StorageId = 1
+ });
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = 1,
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.StrengthStabilityLengthwiseConstructionSectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityLengthwiseConstructionFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,197 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.StrengthStabilityPointConstruction;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Update.StrengthStabilityPointConstruction
+{
+ [TestFixture]
+ public class StrengthStabilityPointConstructionFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoStrengthStabilityPointConstructionSectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'StrengthStabilityPointConstructionSectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoStrengthStabilityPointConstructionSectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.StrengthStabilityPointConstructionSectionResultEntities.Add(new StrengthStabilityPointConstructionSectionResultEntity
+ {
+ StrengthStabilityPointConstructionSectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'StrengthStabilityPointConstructionSectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithStrengthStabilityPointConstructionSectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerTwoA = (RoundedDouble) 0.4,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new StrengthStabilityPointConstructionSectionResultEntity
+ {
+ StrengthStabilityPointConstructionSectionResultEntityId = sectionResult.StorageId,
+ LayerTwoA = 2.1m,
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.StrengthStabilityPointConstructionSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(sectionResult.AssessmentLayerTwoA.ToNullableDecimal(), sectionResultEntity.LayerTwoA);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerTwoA = (RoundedDouble)double.NaN,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new StrengthStabilityPointConstructionSectionResultEntity
+ {
+ StrengthStabilityPointConstructionSectionResultEntityId = sectionResult.StorageId,
+ LayerTwoA = 2.1m,
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.StrengthStabilityPointConstructionSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerTwoA);
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,247 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.StrengthStabilityPointConstruction;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Test.Update.StrengthStabilityPointConstruction
+{
+ [TestFixture]
+ public class StrengthStabilityPointConstructionFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new StrengthStabilityPointConstructionFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new StrengthStabilityPointConstructionFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoStrengthStabilityPointConstructionFailureMechanism_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new StrengthStabilityPointConstructionFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoStrengthStabilityPointConstructionFailureMechanismWithId_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new StrengthStabilityPointConstructionFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithStrengthStabilityPointConstructionFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new StrengthStabilityPointConstructionFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true
+ };
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ IsRelevant = Convert.ToByte(false)
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new StrengthStabilityPointConstructionFailureMechanism
+ {
+ StorageId = 1
+ };
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.StrengthStabilityPointConstructionSectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new StrengthStabilityPointConstructionFailureMechanism
+ {
+ StorageId = 1
+ };
+ var testName = "testName";
+ failureMechanism.AddSection(new FailureMechanismSection(testName, new[]
+ {
+ new Point2D(0, 0)
+ })
+ {
+ StorageId = 1
+ });
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = 1,
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.StrengthStabilityPointConstructionSectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityPointConstructionFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityPointConstructionFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/TechnicalInnovation/TechnicalInnovationFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/TechnicalInnovation/TechnicalInnovationFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/TechnicalInnovation/TechnicalInnovationFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,196 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.TechnicalInnovation;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Update.TechnicalInnovation
+{
+ [TestFixture]
+ public class TechnicalInnovationFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new TechnicalInnovationFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new TechnicalInnovationFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoTechnicalInnovationSectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new TechnicalInnovationFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'TechnicalInnovationSectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoTechnicalInnovationSectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new TechnicalInnovationFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.TechnicalInnovationSectionResultEntities.Add(new TechnicalInnovationSectionResultEntity
+ {
+ TechnicalInnovationSectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'TechnicalInnovationSectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithTechnicalInnovationSectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new TechnicalInnovationFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new TechnicalInnovationSectionResultEntity
+ {
+ TechnicalInnovationSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.TechnicalInnovationSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), sectionResultEntity.LayerOne);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new TechnicalInnovationFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new TechnicalInnovationSectionResultEntity
+ {
+ TechnicalInnovationSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.TechnicalInnovationSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/TechnicalInnovation/TechnicalInnovationFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/TechnicalInnovation/TechnicalInnovationFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/TechnicalInnovation/TechnicalInnovationFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,247 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.TechnicalInnovation;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Test.Update.TechnicalInnovation
+{
+ [TestFixture]
+ public class TechnicalInnovationFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new TechnicalInnovationFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new TechnicalInnovationFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoTechnicalInnovationFailureMechanism_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new TechnicalInnovationFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoTechnicalInnovationFailureMechanismWithId_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new TechnicalInnovationFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithTechnicalInnovationFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new TechnicalInnovationFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true
+ };
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ IsRelevant = Convert.ToByte(false)
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new TechnicalInnovationFailureMechanism
+ {
+ StorageId = 1
+ };
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.TechnicalInnovationSectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new TechnicalInnovationFailureMechanism
+ {
+ StorageId = 1
+ };
+ var testName = "testName";
+ failureMechanism.AddSection(new FailureMechanismSection(testName, new[]
+ {
+ new Point2D(0, 0)
+ })
+ {
+ StorageId = 1
+ });
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = 1,
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.TechnicalInnovationSectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/TechnicalInnovationFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/TechnicalInnovationFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,196 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.WaterPressureAsphaltCover;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Update.WaterPressureAsphaltCover
+{
+ [TestFixture]
+ public class WaterPressureAsphaltCoverFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new WaterPressureAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new WaterPressureAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoWaterPressureAsphaltCoverSectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new WaterPressureAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'WaterPressureAsphaltCoverSectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoWaterPressureAsphaltCoverSectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new WaterPressureAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.WaterPressureAsphaltCoverSectionResultEntities.Add(new WaterPressureAsphaltCoverSectionResultEntity
+ {
+ WaterPressureAsphaltCoverSectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'WaterPressureAsphaltCoverSectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithWaterPressureAsphaltCoverSectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new WaterPressureAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new WaterPressureAsphaltCoverSectionResultEntity
+ {
+ WaterPressureAsphaltCoverSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.WaterPressureAsphaltCoverSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), sectionResultEntity.LayerOne);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new WaterPressureAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new WaterPressureAsphaltCoverSectionResultEntity
+ {
+ WaterPressureAsphaltCoverSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.WaterPressureAsphaltCoverSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,247 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.WaterPressureAsphaltCover;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Test.Update.WaterPressureAsphaltCover
+{
+ [TestFixture]
+ public class WaterPressureAsphaltCoverFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoWaterPressureAsphaltCoverFailureMechanism_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoWaterPressureAsphaltCoverFailureMechanismWithId_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithWaterPressureAsphaltCoverFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true
+ };
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ IsRelevant = Convert.ToByte(false)
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism
+ {
+ StorageId = 1
+ };
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.WaterPressureAsphaltCoverSectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism
+ {
+ StorageId = 1
+ };
+ var testName = "testName";
+ failureMechanism.AddSection(new FailureMechanismSection(testName, new[]
+ {
+ new Point2D(0, 0)
+ })
+ {
+ StorageId = 1
+ });
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = 1,
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.WaterPressureAsphaltCoverSectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/WaterPressureAsphaltCoverFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/WaterPressureAsphaltCoverFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismSectionResultUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,202 @@
+// 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 Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.WaveImpactAsphaltCover;
+
+using Core.Common.Base.Data;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Update.WaveImpactAsphaltCover
+{
+ [TestFixture]
+ public class WaveImpactAsphaltCoverFailureMechanismSectionResultUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoWaveImpactAsphaltCoverSectionResult_EntityNotFoundException()
+ {
+ // Setup
+ var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'WaveImpactAsphaltCoverSectionResultEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoWaveImpactAsphaltCoverSectionResultWithId_EntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.WaveImpactAsphaltCoverSectionResultEntities.Add(new WaveImpactAsphaltCoverSectionResultEntity
+ {
+ WaveImpactAsphaltCoverSectionResultEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'WaveImpactAsphaltCoverSectionResultEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_WithWaveImpactAsphaltCoverSectionResult_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerTwoA = (RoundedDouble) 0.4,
+ AssessmentLayerThree = (RoundedDouble) 4.4
+ };
+
+ var sectionResultEntity = new WaveImpactAsphaltCoverSectionResultEntity
+ {
+ WaveImpactAsphaltCoverSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerTwoA = 2.1m,
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.WaveImpactAsphaltCoverSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), sectionResultEntity.LayerOne);
+ Assert.AreEqual(sectionResult.AssessmentLayerTwoA.Value.ToNullableDecimal(), sectionResultEntity.LayerTwoA);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithNaNResult_ReturnsEntityWithNullResult()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = 1,
+ AssessmentLayerOne = true,
+ AssessmentLayerTwoA = (RoundedDouble)double.NaN,
+ AssessmentLayerThree = (RoundedDouble)double.NaN
+ };
+
+ var sectionResultEntity = new WaveImpactAsphaltCoverSectionResultEntity
+ {
+ WaveImpactAsphaltCoverSectionResultEntityId = sectionResult.StorageId,
+ LayerOne = Convert.ToByte(false),
+ LayerTwoA = 2.1m,
+ LayerThree = 1.1m,
+ };
+
+ ringtoetsEntities.WaveImpactAsphaltCoverSectionResultEntities.Add(sectionResultEntity);
+
+ // Call
+ sectionResult.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.IsNull(sectionResultEntity.LayerTwoA);
+ Assert.IsNull(sectionResultEntity.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismUpdateExtensionsTest.cs (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
@@ -0,0 +1,247 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.TestUtil;
+using Application.Ringtoets.Storage.Update.WaveImpactAsphaltCover;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Test.Update.WaveImpactAsphaltCover
+{
+ [TestFixture]
+ public class WaveImpactAsphaltCoverFailureMechanismUpdateExtensionsTest
+ {
+ [Test]
+ public void Update_WithoutContext_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("context", paramName);
+ }
+
+ [Test]
+ public void Update_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(null, ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Update_ContextWithNoWaveImpactAsphaltCoverFailureMechanism_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (var ringtoetsEntities = new RingtoetsEntities())
+ {
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+ }
+ };
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", 0);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Update_ContextWithNoWaveImpactAsphaltCoverFailureMechanismWithId_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var storageId = 1;
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism
+ {
+ StorageId = storageId
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 2
+ });
+
+ // Call
+ TestDelegate test = () => failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'FailureMechanismEntity' met id '{0}' is niet gevonden.", storageId);
+ EntityNotFoundException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithWaveImpactAsphaltCoverFailureMechanism_PropertiesUpdated()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism
+ {
+ StorageId = 1,
+ IsRelevant = true
+ };
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ IsRelevant = Convert.ToByte(false)
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(true), failureMechanismEntity.IsRelevant);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism
+ {
+ StorageId = 1
+ };
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.WaveImpactAsphaltCoverSectionResultEntities).Count());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Update_ContextWithUpdatedFailureMechanismSections_NoNewFailureMechanismSectionsAdded()
+ {
+ // Setup
+ MockRepository mocks = new MockRepository();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks);
+
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism
+ {
+ StorageId = 1
+ };
+ var testName = "testName";
+ failureMechanism.AddSection(new FailureMechanismSection(testName, new[]
+ {
+ new Point2D(0, 0)
+ })
+ {
+ StorageId = 1
+ });
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity
+ {
+ FailureMechanismSectionEntityId = 1,
+ };
+ var failureMechanismEntity = new FailureMechanismEntity
+ {
+ FailureMechanismEntityId = 1,
+ FailureMechanismSectionEntities =
+ {
+ failureMechanismSectionEntity
+ }
+ };
+
+ ringtoetsEntities.FailureMechanismEntities.Add(failureMechanismEntity);
+ ringtoetsEntities.FailureMechanismSectionEntities.Add(failureMechanismSectionEntity);
+
+ // Call
+ failureMechanism.Update(new PersistenceRegistry(), ringtoetsEntities);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.SelectMany(fms => fms.WaveImpactAsphaltCoverSectionResultEntities).Count());
+ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/WaveImpactAsphaltCoverFailureMechanismSectionResultUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a5714fc0488030773fff50dfc82041c6cb9edc2f refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/WaveImpactAsphaltCoverFailureMechanismUpdateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?