Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj
===================================================================
diff -u -r5061321f2f8b942937713732163d9e55f2acb176 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 5061321f2f8b942937713732163d9e55f2acb176)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -55,7 +55,7 @@
-
+
@@ -98,6 +98,7 @@
+
Fisheye: Tag 6d514ec60f68620d78015ac58ba6a966ef6b14e3 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Converters/PipingSoilProfileConverter.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Converters/StochasticSoilModelConverter.cs
===================================================================
diff -u -r5061321f2f8b942937713732163d9e55f2acb176 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Converters/StochasticSoilModelConverter.cs (.../StochasticSoilModelConverter.cs) (revision 5061321f2f8b942937713732163d9e55f2acb176)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Converters/StochasticSoilModelConverter.cs (.../StochasticSoilModelConverter.cs) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -22,7 +22,6 @@
using System;
using Application.Ringtoets.Storage.DbContext;
using Ringtoets.Piping.Data;
-using Ringtoets.Piping.Primitives;
namespace Application.Ringtoets.Storage.Converters
{
@@ -37,11 +36,6 @@
{
StorageId = entity.StochasticSoilModelEntityId
};
- foreach (var profileEntity in entity.StochasticSoilProfileEntities)
- {
- var profile = new StochasticSoilProfile((double)profileEntity.Probability.Value, SoilProfileType.SoilProfile1D, -1);
- convertedModel.StochasticSoilProfiles.Add(profile);
- }
return convertedModel;
}
@@ -58,15 +52,6 @@
entity.Name = modelObject.Name;
entity.SegmentName = modelObject.SegmentName;
entity.StochasticSoilModelEntityId = modelObject.StorageId;
-
- foreach (var stochasticProfile in modelObject.StochasticSoilProfiles)
- {
- var profile = new StochasticSoilProfileEntity
- {
- Probability = Convert.ToDecimal(stochasticProfile.Probability)
- };
- entity.StochasticSoilProfileEntities.Add(profile);
- }
}
}
}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Converters/StochasticSoilProfileConverter.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Converters/StochasticSoilProfileConverter.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Converters/StochasticSoilProfileConverter.cs (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -0,0 +1,60 @@
+using System;
+using System.Linq;
+using Application.Ringtoets.Storage.DbContext;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Converters
+{
+ public class StochasticSoilProfileConverter : IEntityConverter
+ {
+ public StochasticSoilProfile ConvertEntityToModel(StochasticSoilProfileEntity entity)
+ {
+ if (entity == null)
+ {
+ throw new ArgumentNullException("entity");
+ }
+
+ var layers = entity.SoilProfileEntity.SoilLayerEntities.Select(sl => new PipingSoilLayer((double) sl.Top)
+ {
+ IsAquifer = sl.IsAquifer == 1
+ });
+
+ return new StochasticSoilProfile((double)entity.Probability, SoilProfileType.SoilProfile1D, -1)
+ {
+ SoilProfile = new PipingSoilProfile(entity.SoilProfileEntity.Name, (double) entity.SoilProfileEntity.Bottom, layers, SoilProfileType.SoilProfile1D, -1),
+ StorageId = entity.StochasticSoilProfileEntityId
+ };
+ }
+
+ public void ConvertModelToEntity(StochasticSoilProfile modelObject, StochasticSoilProfileEntity entity)
+ {
+ if (modelObject == null)
+ {
+ throw new ArgumentNullException("modelObject");
+ }
+ if (entity == null)
+ {
+ throw new ArgumentNullException("entity");
+ }
+ entity.StochasticSoilProfileEntityId = modelObject.StorageId;
+ entity.Probability = Convert.ToDecimal(modelObject.Probability);
+ entity.SoilProfileEntity = new SoilProfileEntity
+ {
+ Bottom = Convert.ToDecimal(modelObject.SoilProfile.Bottom),
+ Name = modelObject.SoilProfile.Name
+ };
+
+ foreach (var sl in modelObject.SoilProfile.Layers)
+ {
+ var layerEntity = new SoilLayerEntity
+ {
+ IsAquifer = sl.IsAquifer ? (byte) 1 : (byte) 0,
+ Top = Convert.ToDecimal(sl.Top)
+ };
+
+ entity.SoilProfileEntity.SoilLayerEntities.Add(layerEntity);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql
===================================================================
diff -u -r5061321f2f8b942937713732163d9e55f2acb176 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql (.../DatabaseStructure.sql) (revision 5061321f2f8b942937713732163d9e55f2acb176)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql (.../DatabaseStructure.sql) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -1,6 +1,6 @@
/* ---------------------------------------------------- */
/* Generated by Enterprise Architect Version 12.0 */
-/* Created On : 19-apr-2016 15:19:18 */
+/* Created On : 20-apr-2016 9:53:16 */
/* DBMS : SQLite */
/* ---------------------------------------------------- */
@@ -73,6 +73,7 @@
'FailureMechanismEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
'AssessmentSectionEntityId' INTEGER NOT NULL,
'FailureMechanismType' SMALLINT NOT NULL, -- Enumerator for different failure mechanism types (piping, macrostability, dunes, etc)
+ 'IsRelevant' TINYINT (1) NOT NULL, -- true or false
CONSTRAINT 'FK_FailureMechanismEntity_AssessmentSectionEntity' FOREIGN KEY ('AssessmentSectionEntityId') REFERENCES 'AssessmentSectionEntity' ('AssessmentSectionEntityId') ON DELETE Cascade ON UPDATE Cascade,
CONSTRAINT 'UI_AssessmentSectionEntityId_FailureMechanismType' UNIQUE ('FailureMechanismType','AssessmentSectionEntityId')
)
@@ -135,7 +136,7 @@
'StochasticSoilProfileEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
'SoilProfileEntityId' INTEGER NOT NULL,
'StochasticSoilModelEntityId' INTEGER NOT NULL,
- 'Probability' NUMERIC,
+ 'Probability' NUMERIC NOT NULL,
CONSTRAINT 'FK_StochasticSoilProfileEntity_SoilProfileEntity' FOREIGN KEY ('SoilProfileEntityId') REFERENCES 'SoilProfileEntity' ('SoilProfileEntityId') ON DELETE Cascade ON UPDATE Cascade,
CONSTRAINT 'FK_StochasticSoilProfileEntity_StochasticSoilModelEntity' FOREIGN KEY ('StochasticSoilModelEntityId') REFERENCES 'StochasticSoilModelEntity' ('StochasticSoilModelEntityId') ON DELETE No Action ON UPDATE No Action
)
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/FailureMechanismEntity.cs
===================================================================
diff -u -r4e14ed090d09a220a790b3562ceb4232dab1cce6 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/FailureMechanismEntity.cs (.../FailureMechanismEntity.cs) (revision 4e14ed090d09a220a790b3562ceb4232dab1cce6)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/FailureMechanismEntity.cs (.../FailureMechanismEntity.cs) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -44,6 +44,7 @@
public long FailureMechanismEntityId { get; set; }
public long AssessmentSectionEntityId { get; set; }
public short FailureMechanismType { get; set; }
+ public byte IsRelevant { get; set; }
public virtual AssessmentSectionEntity AssessmentSectionEntity { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx
===================================================================
diff -u -r5061321f2f8b942937713732163d9e55f2acb176 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision 5061321f2f8b942937713732163d9e55f2acb176)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -25,6 +25,7 @@
+
@@ -88,7 +89,7 @@
-
+
@@ -311,6 +312,7 @@
+
@@ -384,7 +386,7 @@
-
+
@@ -516,6 +518,7 @@
+
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram
===================================================================
diff -u -r5061321f2f8b942937713732163d9e55f2acb176 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision 5061321f2f8b942937713732163d9e55f2acb176)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -6,14 +6,14 @@
-
+
-
-
-
-
-
+
+
+
+
+
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/StochasticSoilProfileEntity.cs
===================================================================
diff -u -r4e14ed090d09a220a790b3562ceb4232dab1cce6 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/StochasticSoilProfileEntity.cs (.../StochasticSoilProfileEntity.cs) (revision 4e14ed090d09a220a790b3562ceb4232dab1cce6)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/StochasticSoilProfileEntity.cs (.../StochasticSoilProfileEntity.cs) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -38,7 +38,7 @@
public long StochasticSoilProfileEntityId { get; set; }
public long SoilProfileEntityId { get; set; }
public long StochasticSoilModelEntityId { get; set; }
- public Nullable Probability { get; set; }
+ public decimal Probability { get; set; }
public virtual SoilProfileEntity SoilProfileEntity { get; set; }
public virtual StochasticSoilModelEntity StochasticSoilModelEntity { get; set; }
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/FailureMechanismPersistorBase.cs
===================================================================
diff -u -r5061321f2f8b942937713732163d9e55f2acb176 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/FailureMechanismPersistorBase.cs (.../FailureMechanismPersistorBase.cs) (revision 5061321f2f8b942937713732163d9e55f2acb176)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/FailureMechanismPersistorBase.cs (.../FailureMechanismPersistorBase.cs) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -179,7 +179,6 @@
InsertChildren(model, entity);
}
-
///
/// Implement to provide a way to insert the children of the into the .
///
@@ -210,6 +209,13 @@
entry.Value.StorageId = entry.Key.FailureMechanismEntityId;
}
insertedList.Clear();
+
+ PerformChildPostSaveAction();
}
+
+ ///
+ /// Implement to provide a way to perform post save actions on the children of the .
+ ///
+ protected abstract void PerformChildPostSaveAction();
}
}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/PipingFailureMechanismPersistor.cs
===================================================================
diff -u -r1257b99937b663621a4afb03a50a305aadff6a55 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/PipingFailureMechanismPersistor.cs (.../PipingFailureMechanismPersistor.cs) (revision 1257b99937b663621a4afb03a50a305aadff6a55)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/PipingFailureMechanismPersistor.cs (.../PipingFailureMechanismPersistor.cs) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -46,17 +46,32 @@
protected override void LoadChildren(PipingFailureMechanism model, FailureMechanismEntity entity)
{
- model.StochasticSoilModels.AddRange(stochasticSoilModelPersistor.LoadModel(entity.StochasticSoilModelEntities));
+ foreach (var soilModelEntity in entity.StochasticSoilModelEntities)
+ {
+ model.StochasticSoilModels.Add(stochasticSoilModelPersistor.LoadModel(soilModelEntity));
+ }
}
protected override void UpdateChildren(PipingFailureMechanism model, FailureMechanismEntity entity)
{
- stochasticSoilModelPersistor.UpdateModel(entity.StochasticSoilModelEntities, model.StochasticSoilModels);
+ foreach (var soilModel in model.StochasticSoilModels)
+ {
+ stochasticSoilModelPersistor.UpdateModel(entity.StochasticSoilModelEntities, soilModel);
+ }
+ stochasticSoilModelPersistor.RemoveUnModifiedEntries(entity.StochasticSoilModelEntities);
}
protected override void InsertChildren(PipingFailureMechanism model, FailureMechanismEntity entity)
{
- stochasticSoilModelPersistor.InsertModel(entity.StochasticSoilModelEntities, model.StochasticSoilModels);
+ foreach (var soilModel in model.StochasticSoilModels)
+ {
+ stochasticSoilModelPersistor.InsertModel(entity.StochasticSoilModelEntities, soilModel);
+ }
}
+
+ protected override void PerformChildPostSaveAction()
+ {
+ stochasticSoilModelPersistor.PerformPostSaveActions();
+ }
}
}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/StochasticSoilModelPersistor.cs
===================================================================
diff -u -r5061321f2f8b942937713732163d9e55f2acb176 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/StochasticSoilModelPersistor.cs (.../StochasticSoilModelPersistor.cs) (revision 5061321f2f8b942937713732163d9e55f2acb176)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/StochasticSoilModelPersistor.cs (.../StochasticSoilModelPersistor.cs) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -27,82 +27,103 @@
using Application.Ringtoets.Storage.DbContext;
using Application.Ringtoets.Storage.Exceptions;
using Application.Ringtoets.Storage.Properties;
-using Core.Common.Utils;
using Ringtoets.Piping.Data;
-using Ringtoets.Piping.Primitives;
namespace Application.Ringtoets.Storage.Persistors
{
public class StochasticSoilModelPersistor
{
+ private readonly StochasticSoilProfilePersistor soilProfilePersistor;
private readonly StochasticSoilModelConverter soilModelConverter = new StochasticSoilModelConverter();
- private readonly PipingSoilProfileConverter soilProfileConverter = new PipingSoilProfileConverter();
private readonly ICollection modifiedList = new List();
private readonly Dictionary insertedList = new Dictionary();
private readonly DbSet stochasticSoilModelSet;
+ ///
+ /// New instance of .
+ ///
+ /// The storage context.
+ /// Thrown when is null.
public StochasticSoilModelPersistor(IRingtoetsEntities ringtoetsContext)
{
if (ringtoetsContext == null)
{
throw new ArgumentNullException("ringtoetsContext");
}
stochasticSoilModelSet = ringtoetsContext.StochasticSoilModelEntities;
+ soilProfilePersistor = new StochasticSoilProfilePersistor(ringtoetsContext);
}
- public IEnumerable LoadModel(IEnumerable entities)
+ ///
+ /// Loads the as .
+ ///
+ /// The to load.
+ /// A new instance of , based on the properties of .
+ public StochasticSoilModel LoadModel(StochasticSoilModelEntity entity)
{
- if (entities == null)
+ if (entity == null)
{
- throw new ArgumentNullException("entities");
+ throw new ArgumentNullException("entity");
}
- return entities.Select(e => soilModelConverter.ConvertEntityToModel(e));
+ var stochasticSoilModel = soilModelConverter.ConvertEntityToModel(entity);
+
+ LoadChildren(stochasticSoilModel, entity);
+
+ return stochasticSoilModel;
}
+ private void LoadChildren(StochasticSoilModel stochasticSoilModel, StochasticSoilModelEntity entity)
+ {
+ foreach (var profileEntity in entity.StochasticSoilProfileEntities)
+ {
+ stochasticSoilModel.StochasticSoilProfiles.Add(soilProfilePersistor.LoadModel(profileEntity));
+ }
+ }
+
///
/// Ensures that the model is added as in the .
///
/// Collection where objects can be added. Usually, this collection is a navigation property of a .
- /// to be saved in the storage.
+ /// to be saved in the storage.
/// Thrown when:
/// - is null.
///
- public void InsertModel(ICollection parentNavigationProperty, ICollection stochasticSoilModels)
+ public void InsertModel(ICollection parentNavigationProperty, StochasticSoilModel stochasticSoilModel)
{
if (parentNavigationProperty == null)
{
throw new ArgumentNullException("parentNavigationProperty");
}
- if (stochasticSoilModels == null)
+ if (stochasticSoilModel == null)
{
return;
}
- foreach (var stochasticSoilModel in stochasticSoilModels)
- {
- InsertStochasticSoilModel(parentNavigationProperty, stochasticSoilModel);
- }
+ var entity = InsertStochasticSoilModel(parentNavigationProperty, stochasticSoilModel);
- InsertStochasticSoilProfiles(parentNavigationProperty, stochasticSoilModels);
+ InsertChildren(entity, stochasticSoilModel);
}
- private void InsertStochasticSoilProfiles(ICollection parentNavigationProperty, ICollection stochasticSoilModels)
+ private void InsertChildren(StochasticSoilModelEntity entity, StochasticSoilModel stochasticSoilModel)
{
- var profiles = stochasticSoilModels.SelectMany(ssm => ssm.StochasticSoilProfiles.Select(ssp => ssp.SoilProfile));
-
- var convertedProfiles = new Dictionary(new ReferenceEqualityComparer());
- foreach (var soilProfile in profiles)
+ foreach (var stochasticSoilProfile in stochasticSoilModel.StochasticSoilProfiles)
{
- var entity = new SoilProfileEntity();
- soilProfileConverter.ConvertModelToEntity(soilProfile, entity);
- convertedProfiles.Add(soilProfile, entity);
+ soilProfilePersistor.InsertModel(entity.StochasticSoilProfileEntities, stochasticSoilProfile);
}
}
- public void UpdateModel(ICollection parentNavigationProperty, IList model)
+ ///
+ /// Ensures that the is set as in the .
+ ///
+ /// Collection where objects can be searched and added. Usually, this collection is a navigation property of a .
+ /// to be saved in the storage.
+ /// Thrown when:
+ /// - is null.
+ ///
+ public void UpdateModel(ICollection parentNavigationProperty, StochasticSoilModel stochasticSoilModel)
{
- if (model == null)
+ if (stochasticSoilModel == null)
{
return;
}
@@ -112,41 +133,38 @@
throw new ArgumentNullException("parentNavigationProperty");
}
- foreach (var stochasticSoilModel in model)
+ if (stochasticSoilModel.StorageId < 1)
{
- if (stochasticSoilModel == null)
+ InsertStochasticSoilModel(parentNavigationProperty, stochasticSoilModel);
+ }
+ else
+ {
+ StochasticSoilModelEntity entity;
+ try
{
- throw new ArgumentException("A null StochasticSoilModel cannot be added");
+ entity = parentNavigationProperty.SingleOrDefault(db => db.StochasticSoilModelEntityId == stochasticSoilModel.StorageId);
}
-
- if (stochasticSoilModel.StorageId < 1)
+ catch (InvalidOperationException exception)
{
- InsertStochasticSoilModel(parentNavigationProperty, stochasticSoilModel);
+ throw new EntityNotFoundException(String.Format(Resources.Error_Entity_Not_Found_0_1, "StochasticSoilModelEntity", stochasticSoilModel.StorageId), exception);
}
- else
+
+ if (entity == null)
{
- StochasticSoilModelEntity entity;
- try
- {
- entity = parentNavigationProperty.SingleOrDefault(db => db.StochasticSoilModelEntityId == stochasticSoilModel.StorageId);
- }
- catch (InvalidOperationException exception)
- {
- throw new EntityNotFoundException(String.Format(Resources.Error_Entity_Not_Found_0_1, "StochasticSoilModelEntity", stochasticSoilModel.StorageId), exception);
- }
+ throw new EntityNotFoundException(String.Format(Resources.Error_Entity_Not_Found_0_1, "StochasticSoilModelEntity", stochasticSoilModel.StorageId));
+ }
- if (entity == null)
- {
- throw new EntityNotFoundException(String.Format(Resources.Error_Entity_Not_Found_0_1, "StochasticSoilModelEntity", stochasticSoilModel.StorageId));
- }
+ modifiedList.Add(entity);
- modifiedList.Add(entity);
+ soilModelConverter.ConvertModelToEntity(stochasticSoilModel, entity);
- soilModelConverter.ConvertModelToEntity(stochasticSoilModel, entity);
+ foreach (var soilProfile in stochasticSoilModel.StochasticSoilProfiles)
+ {
+ soilProfilePersistor.UpdateModel(entity.StochasticSoilProfileEntities, soilProfile);
}
- }
- RemoveUnModifiedEntries(parentNavigationProperty);
+ soilProfilePersistor.RemoveUnModifiedEntries(entity.StochasticSoilProfileEntities);
+ }
}
///
@@ -159,17 +177,20 @@
entry.Value.StorageId = entry.Key.StochasticSoilModelEntityId;
}
insertedList.Clear();
+
+ soilProfilePersistor.PerformPostSaveActions();
}
- private void InsertStochasticSoilModel(ICollection parentNavigationProperty, StochasticSoilModel stochasticSoilModel)
+ private StochasticSoilModelEntity InsertStochasticSoilModel(ICollection parentNavigationProperty, StochasticSoilModel stochasticSoilModel)
{
var entity = new StochasticSoilModelEntity();
soilModelConverter.ConvertModelToEntity(stochasticSoilModel, entity);
parentNavigationProperty.Add(entity);
insertedList.Add(entity, stochasticSoilModel);
+ return entity;
}
- private void RemoveUnModifiedEntries(IEnumerable parentNavigationProperty)
+ public void RemoveUnModifiedEntries(IEnumerable parentNavigationProperty)
{
var untouchedModifiedList = parentNavigationProperty.Where(e => e.StochasticSoilModelEntityId > 0 && !modifiedList.Contains(e));
stochasticSoilModelSet.RemoveRange(untouchedModifiedList);
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/StochasticSoilProfilePersistor.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/StochasticSoilProfilePersistor.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Persistors/StochasticSoilProfilePersistor.cs (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -0,0 +1,166 @@
+// 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.Data.Entity;
+using System.Linq;
+using Application.Ringtoets.Storage.Converters;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.Properties;
+using Ringtoets.Piping.Data;
+
+namespace Application.Ringtoets.Storage.Persistors
+{
+ public class StochasticSoilProfilePersistor
+ {
+ private readonly DbSet stochasticSoilProfileSet;
+
+ private readonly Dictionary insertedList = new Dictionary();
+ private readonly ICollection modifiedList = new List();
+ private readonly StochasticSoilProfileConverter stochasticSoilProfileConverter = new StochasticSoilProfileConverter();
+
+ ///
+ /// New instance of .
+ ///
+ /// The storage context.
+ /// Thrown when is null.
+ public StochasticSoilProfilePersistor(IRingtoetsEntities ringtoetsContext)
+ {
+ if (ringtoetsContext == null)
+ {
+ throw new ArgumentNullException("ringtoetsContext");
+ }
+ stochasticSoilProfileSet = ringtoetsContext.StochasticSoilProfileEntities;
+ }
+
+ ///
+ /// Loads the as .
+ ///
+ /// The to load.
+ /// A new instance of , based on the properties of .
+ public StochasticSoilProfile LoadModel(StochasticSoilProfileEntity entity)
+ {
+ if (entity == null)
+ {
+ throw new ArgumentNullException("entity");
+ }
+ return stochasticSoilProfileConverter.ConvertEntityToModel(entity);
+ }
+
+ ///
+ /// Ensures that the model is added as in the .
+ ///
+ /// Collection where objects can be added. Usually, this collection is a navigation property of a .
+ /// to be saved in the storage.
+ /// Thrown when:
+ /// - is null.
+ ///
+ public void InsertModel(ICollection parentNavigationProperty, StochasticSoilProfile stochasticSoilProfile)
+ {
+ if (stochasticSoilProfile == null)
+ {
+ return;
+ }
+ if (parentNavigationProperty == null)
+ {
+ throw new ArgumentNullException("parentNavigationProperty");
+ }
+
+ InsertStochasticSoilProfile(parentNavigationProperty, stochasticSoilProfile);
+ }
+
+ ///
+ /// Ensures that the is set as in the .
+ ///
+ /// Collection where objects can be searched and added. Usually, this collection is a navigation property of a .
+ /// to be saved in the storage.
+ /// Thrown when:
+ /// - is null.
+ ///
+ public void UpdateModel(ICollection parentNavigationProperty, StochasticSoilProfile stochasticSoilProfile)
+ {
+ if (stochasticSoilProfile == null)
+ {
+ return;
+ }
+ if (parentNavigationProperty == null)
+ {
+ throw new ArgumentNullException("parentNavigationProperty");
+ }
+
+ if (stochasticSoilProfile.StorageId < 1)
+ {
+ InsertStochasticSoilProfile(parentNavigationProperty, stochasticSoilProfile);
+ }
+ else
+ {
+ StochasticSoilProfileEntity entity;
+ try
+ {
+ entity = parentNavigationProperty.SingleOrDefault(db => db.StochasticSoilProfileEntityId == stochasticSoilProfile.StorageId);
+ }
+ catch (InvalidOperationException exception)
+ {
+ throw new EntityNotFoundException(String.Format(Resources.Error_Entity_Not_Found_0_1, "StochasticSoilProfileEntity", stochasticSoilProfile.StorageId), exception);
+ }
+
+ if (entity == null)
+ {
+ throw new EntityNotFoundException(String.Format(Resources.Error_Entity_Not_Found_0_1, "StochasticSoilProfileEntity", stochasticSoilProfile.StorageId));
+ }
+
+ modifiedList.Add(entity);
+
+ stochasticSoilProfileConverter.ConvertModelToEntity(stochasticSoilProfile, entity);
+ }
+ }
+
+ ///
+ /// Perform actions that can only be executed after has been called.
+ ///
+ public void PerformPostSaveActions()
+ {
+ foreach (var entry in insertedList)
+ {
+ entry.Value.StorageId = entry.Key.StochasticSoilProfileEntityId;
+ }
+ insertedList.Clear();
+ }
+
+ private void InsertStochasticSoilProfile(ICollection parentNavigationProperty, StochasticSoilProfile stochasticSoilProfile)
+ {
+ var entity = new StochasticSoilProfileEntity();
+ stochasticSoilProfileConverter.ConvertModelToEntity(stochasticSoilProfile, entity);
+ parentNavigationProperty.Add(entity);
+ insertedList.Add(entity, stochasticSoilProfile);
+ }
+
+ public void RemoveUnModifiedEntries(IEnumerable parentNavigationProperty)
+ {
+ var untouchedModifiedList = parentNavigationProperty.Where(e => e.StochasticSoilProfileEntityId > 0 && !modifiedList.Contains(e));
+ stochasticSoilProfileSet.RemoveRange(untouchedModifiedList);
+
+ modifiedList.Clear();
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj
===================================================================
diff -u -r5061321f2f8b942937713732163d9e55f2acb176 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 5061321f2f8b942937713732163d9e55f2acb176)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -86,11 +86,12 @@
-
+
+
Fisheye: Tag 6d514ec60f68620d78015ac58ba6a966ef6b14e3 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/PipingSoilProfileConverterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/StochasticSoilModelConverterTest.cs
===================================================================
diff -u -r5061321f2f8b942937713732163d9e55f2acb176 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/StochasticSoilModelConverterTest.cs (.../StochasticSoilModelConverterTest.cs) (revision 5061321f2f8b942937713732163d9e55f2acb176)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/StochasticSoilModelConverterTest.cs (.../StochasticSoilModelConverterTest.cs) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -1,4 +1,25 @@
-using System;
+// 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.Converters;
using Application.Ringtoets.Storage.DbContext;
@@ -51,23 +72,21 @@
var converter = new StochasticSoilModelConverter();
// Call
- StochasticSoilModel location = converter.ConvertEntityToModel(entity);
+ StochasticSoilModel model = converter.ConvertEntityToModel(entity);
// Assert
- Assert.AreEqual(storageId, location.StorageId);
- Assert.AreEqual(name, location.Name);
- Assert.AreEqual(segmentName, location.SegmentName);
+ Assert.AreEqual(storageId, model.StorageId);
+ Assert.AreEqual(name, model.Name);
+ Assert.AreEqual(segmentName, model.SegmentName);
}
[Test]
- public void ConvertEntityToModel_WithStochasticSoilProfiles_ReturnsTheEntityAsModelWithStochasticSoilProfiles()
+ public void ConvertEntityToModel_WithStochasticSoilProfiles_ReturnsTheEntityAsModelWithoutStochasticSoilProfiles()
{
// Setup
var storageId = new Random(21).Next();
var segmentName = "SomeSegmentName";
var name = "SomeName";
- var firstProfileProbability = 3.0;
- var secondProfileProbability = 8.0;
var entity = new StochasticSoilModelEntity
{
StochasticSoilModelEntityId = storageId,
@@ -77,31 +96,25 @@
{
new StochasticSoilProfileEntity
{
- Probability = Convert.ToDecimal(firstProfileProbability)
+ Probability = Convert.ToDecimal(3.0)
},
new StochasticSoilProfileEntity
{
- Probability = Convert.ToDecimal(secondProfileProbability)
+ Probability = Convert.ToDecimal(8.0)
}
}
};
var converter = new StochasticSoilModelConverter();
// Call
- StochasticSoilModel location = converter.ConvertEntityToModel(entity);
+ StochasticSoilModel model = converter.ConvertEntityToModel(entity);
// Assert
- Assert.AreEqual(storageId, location.StorageId);
- Assert.AreEqual(name, location.Name);
- Assert.AreEqual(segmentName, location.SegmentName);
+ Assert.AreEqual(storageId, model.StorageId);
+ Assert.AreEqual(name, model.Name);
+ Assert.AreEqual(segmentName, model.SegmentName);
- Assert.AreEqual(2, location.StochasticSoilProfiles.Count);
-
- var firstStochasticProfile = location.StochasticSoilProfiles.ElementAt(0);
- var secondStochasticProfile = location.StochasticSoilProfiles.ElementAt(1);
-
- Assert.AreEqual(firstProfileProbability, firstStochasticProfile.Probability);
- Assert.AreEqual(secondProfileProbability, secondStochasticProfile.Probability);
+ Assert.IsEmpty(model.StochasticSoilProfiles);
}
[Test]
@@ -160,7 +173,7 @@
[Test]
- public void ConvertModelToEntity_ValidModelValidEntityWithStochasticSoilProfiles_ReturnsModelAsEntityWithStochasticSoilProfiles()
+ public void ConvertModelToEntity_ValidModelValidEntityWithStochasticSoilProfiles_ReturnsModelAsEntityWithoutStochasticSoilProfiles()
{
// Setup
var converter = new StochasticSoilModelConverter();
@@ -171,15 +184,13 @@
string name = "someName";
long id = random.Next();
long storageId = random.Next();
- var firstProfileProbability = 3.0;
- var secondProfileProbability = 8.0;
var model = new StochasticSoilModel(id, name, segmentName)
{
StorageId = storageId,
StochasticSoilProfiles =
{
- new StochasticSoilProfile(firstProfileProbability, SoilProfileType.SoilProfile1D, -1),
- new StochasticSoilProfile(secondProfileProbability, SoilProfileType.SoilProfile1D, -1)
+ new StochasticSoilProfile(3.0, SoilProfileType.SoilProfile1D, -1),
+ new StochasticSoilProfile(8.0, SoilProfileType.SoilProfile1D, -1)
}
};
@@ -191,13 +202,7 @@
Assert.AreEqual(name, entity.Name);
Assert.AreEqual(segmentName, entity.SegmentName);
- Assert.AreEqual(2, entity.StochasticSoilProfileEntities.Count);
-
- var firstProfileEntity = entity.StochasticSoilProfileEntities.ElementAt(0);
- var secondProfileEntity = entity.StochasticSoilProfileEntities.ElementAt(1);
-
- Assert.AreEqual(firstProfileProbability, firstProfileEntity.Probability);
- Assert.AreEqual(secondProfileProbability, secondProfileEntity.Probability);
+ Assert.IsEmpty(entity.StochasticSoilProfileEntities);
}
}
}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/StochasticSoilProfileConverterTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/StochasticSoilProfileConverterTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/StochasticSoilProfileConverterTest.cs (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -0,0 +1,149 @@
+// 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.Converters;
+using Application.Ringtoets.Storage.DbContext;
+using NUnit.Framework;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.KernelWrapper.TestUtil;
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Test.Converters
+{
+ public class StochasticSoilProfileConverterTest
+ {
+ [Test]
+ public void Constructor_Always_NewInstance()
+ {
+ // Call
+ var converter = new StochasticSoilProfileConverter();
+
+ // Assert
+ Assert.IsInstanceOf>(converter);
+ }
+
+ [Test]
+ public void ConvertEntityToModel_NullEntity_ThrowsArgumentNullException()
+ {
+ // Setup
+ var converter = new StochasticSoilProfileConverter();
+
+ // Call
+ TestDelegate test = () => converter.ConvertEntityToModel(null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("entity", exception.ParamName);
+ }
+
+ [Test]
+ public void ConvertEntityToModel_Always_ReturnsTheEntityAsModelWithId()
+ {
+ // Setup
+ var storageId = new Random(21).Next();
+ var name = "SomeName";
+ var probability = Convert.ToDecimal(2.1);
+ var entity = new StochasticSoilProfileEntity
+ {
+ StochasticSoilProfileEntityId = storageId,
+ SoilProfileEntity = new SoilProfileEntity
+ {
+ Name = name
+ },
+ Probability = probability
+ };
+ entity.SoilProfileEntity.SoilLayerEntities.Add(new SoilLayerEntity());
+ var converter = new StochasticSoilProfileConverter();
+
+ // Call
+ var location = converter.ConvertEntityToModel(entity);
+
+ // Assert
+ Assert.AreEqual(storageId, location.StorageId);
+ Assert.AreEqual(probability, location.Probability);
+ Assert.AreEqual(name, location.SoilProfile.Name);
+ }
+
+ [Test]
+ public void ConvertModelToEntity_NullModel_ThrowsArgumentNullException()
+ {
+ // Setup
+ var converter = new StochasticSoilProfileConverter();
+
+ // Call
+ TestDelegate test = () => converter.ConvertModelToEntity(null, new StochasticSoilProfileEntity());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("modelObject", exception.ParamName);
+ }
+
+ [Test]
+ public void ConvertModelToEntity_NullEntity_ThrowsArgumentNullException()
+ {
+ // Setup
+ var converter = new StochasticSoilProfileConverter();
+ var model = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 0)
+ {
+ SoilProfile = new TestPipingSoilProfile()
+ };
+ // Call
+ TestDelegate test = () => converter.ConvertModelToEntity(model, null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("entity", exception.ParamName);
+ }
+
+ [Test]
+ public void ConvertModelToEntity_ValidModelValidEntity_ReturnsModelAsEntity()
+ {
+ // Setup
+ var converter = new StochasticSoilProfileConverter();
+ var random = new Random(21);
+ var entity = new StochasticSoilProfileEntity();
+
+ long storageId = random.Next();
+
+ var model = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 0)
+ {
+ SoilProfile = new TestPipingSoilProfile(),
+ StorageId = storageId
+ };
+
+ // Call
+ converter.ConvertModelToEntity(model, entity);
+
+ // Assert
+ var profile = entity.SoilProfileEntity;
+ Assert.AreEqual(storageId, entity.StochasticSoilProfileEntityId);
+ Assert.AreEqual(model.SoilProfile.Name, profile.Name);
+ Assert.AreEqual(model.SoilProfile.Bottom, profile.Bottom);
+ Assert.AreEqual(1, profile.SoilLayerEntities.Count);
+
+ var layer = profile.SoilLayerEntities.ElementAt(0);
+ Assert.AreEqual(0, layer.Top);
+ Assert.AreEqual(1, layer.IsAquifer);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs
===================================================================
diff -u -ra9aafffab97152303562110b1d789bacb465ce24 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision a9aafffab97152303562110b1d789bacb465ce24)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -20,9 +20,11 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
using Application.Ringtoets.Storage.TestUtil;
+using Core.Common.Base;
using Core.Common.Base.Data;
using Core.Common.Base.Plugin;
using Core.Common.Gui;
@@ -33,6 +35,8 @@
using Ringtoets.Common.Data;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Integration.Data;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Primitives;
namespace Application.Ringtoets.Storage.Test.IntegrationTests
{
@@ -159,6 +163,7 @@
Assert.IsNotNull(assessmentSection);
AssertHydraulicBoundaryDatabase(fullProject.Items.OfType().FirstOrDefault(), assessmentSection);
AssertReferenceLine(fullProject.Items.OfType().FirstOrDefault(), assessmentSection);
+ AssertStochasticSoilModels(fullProject.Items.OfType().FirstOrDefault(), assessmentSection);
}
// TearDown
@@ -255,6 +260,59 @@
}
}
+ private void AssertStochasticSoilModels(AssessmentSection expectedProject, AssessmentSection project)
+ {
+ var expectedModels = expectedProject.PipingFailureMechanism.StochasticSoilModels;
+ var actualModels = project.PipingFailureMechanism.StochasticSoilModels;
+
+ Assert.Less(0, actualModels.Count);
+ Assert.AreEqual(expectedModels.Count, actualModels.Count);
+
+ for (int i = 0; i < expectedModels.Count; i++)
+ {
+ var expectedModel = expectedModels.ElementAt(i);
+ var actualModel = actualModels.ElementAt(i);
+
+ Assert.AreEqual(expectedModel.Name, actualModel.Name);
+ Assert.AreEqual(expectedModel.SegmentName, actualModel.SegmentName);
+ AssertStochasticSoilProfiles(expectedModel.StochasticSoilProfiles, actualModel.StochasticSoilProfiles);
+ }
+ }
+
+ private void AssertStochasticSoilProfiles(List expectedStochasticSoilProfiles, List actualStochasticSoilProfiles)
+ {
+ Assert.Less(0, actualStochasticSoilProfiles.Count);
+ Assert.AreEqual(expectedStochasticSoilProfiles.Count, actualStochasticSoilProfiles.Count);
+
+ for (int i = 0; i < expectedStochasticSoilProfiles.Count; i++)
+ {
+ var expectedProfile = expectedStochasticSoilProfiles.ElementAt(i);
+ var actualProfile = actualStochasticSoilProfiles.ElementAt(i);
+
+ Assert.AreEqual(expectedProfile.Probability, actualProfile.Probability);
+ Assert.AreEqual(expectedProfile.SoilProfile.Bottom, actualProfile.SoilProfile.Bottom);
+ Assert.AreEqual(expectedProfile.SoilProfile.Name, actualProfile.SoilProfile.Name);
+ AssertSoilLayers(expectedProfile.SoilProfile.Layers, actualProfile.SoilProfile.Layers);
+ }
+ }
+
+ private void AssertSoilLayers(IEnumerable expectedLayers, IEnumerable actualLayers)
+ {
+ var actualLayerArray = actualLayers.ToArray();
+ var expectedLayerArray = expectedLayers.ToArray();
+ Assert.Less(0, actualLayerArray.Length);
+ Assert.AreEqual(expectedLayerArray.Length, actualLayerArray.Length);
+
+ for (int i = 0; i < expectedLayerArray.Length; i++)
+ {
+ var expectedLayer = actualLayerArray[i];
+ var actualLayer = expectedLayerArray[i];
+
+ Assert.AreEqual(expectedLayer.Top, actualLayer.Top);
+ Assert.AreEqual(expectedLayer.IsAquifer, actualLayer.IsAquifer);
+ }
+ }
+
private void TearDownTempRingtoetsFile(string filePath)
{
GC.Collect();
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/PipingFailureMechanismPersistorTest.cs
===================================================================
diff -u -r1257b99937b663621a4afb03a50a305aadff6a55 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/PipingFailureMechanismPersistorTest.cs (.../PipingFailureMechanismPersistorTest.cs) (revision 1257b99937b663621a4afb03a50a305aadff6a55)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/PipingFailureMechanismPersistorTest.cs (.../PipingFailureMechanismPersistorTest.cs) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -34,6 +34,8 @@
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Integration.Data;
using Ringtoets.Piping.Data;
+using Ringtoets.Piping.KernelWrapper.TestUtil;
+using Ringtoets.Piping.Primitives;
namespace Application.Ringtoets.Storage.Test.Persistors
{
@@ -76,7 +78,9 @@
public void LoadModel_NullEntity_ThrowsArgumentNullException()
{
// Setup
- var ringtoetsEntities = mockRepository.StrictMock();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
PipingFailureMechanismPersistor persistor = new PipingFailureMechanismPersistor(ringtoetsEntities);
// Call
@@ -85,13 +89,17 @@
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual("entity", exception.ParamName);
+
+ mockRepository.VerifyAll();
}
[Test]
public void LoadModel_NullAssessmentSection_ThrowsArgumentNullException()
{
// Setup
- var ringtoetsEntities = mockRepository.StrictMock();
+ var ringtoetsEntities = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
PipingFailureMechanismPersistor persistor = new PipingFailureMechanismPersistor(ringtoetsEntities);
FailureMechanismEntity entity = new FailureMechanismEntity();
@@ -101,32 +109,41 @@
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual("failureMechanism", exception.ParamName);
+
+ mockRepository.VerifyAll();
}
[Test]
public void LoadModel_EntityWithIncorrectType_ThrowsArgumentException()
{
// Setup
+ var ringtoetsEntities = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
const long storageId = 1234L;
FailureMechanismEntity entity = new FailureMechanismEntity
{
FailureMechanismEntityId = storageId,
FailureMechanismType = (int) FailureMechanismType.StoneRevetmentFailureMechanism,
};
- var ringtoetsEntities = mockRepository.StrictMock();
PipingFailureMechanismPersistor persistor = new PipingFailureMechanismPersistor(ringtoetsEntities);
// Call
TestDelegate test = () => persistor.LoadModel(entity, new PipingFailureMechanism());
// Assert
Assert.Throws(test);
+
+ mockRepository.VerifyAll();
}
[Test]
public void LoadModel_ValidEntity_UpdatedModel()
{
// Setup
+ var ringtoetsEntities = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
const long storageId = 1234L;
PipingFailureMechanism model = new PipingFailureMechanism
{
@@ -137,7 +154,6 @@
FailureMechanismEntityId = storageId,
FailureMechanismType = (int) FailureMechanismType.PipingFailureMechanism,
};
- var ringtoetsEntities = mockRepository.StrictMock();
PipingFailureMechanismPersistor persistor = new PipingFailureMechanismPersistor(ringtoetsEntities);
var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
@@ -150,17 +166,18 @@
Assert.IsInstanceOf(loadedModel);
Assert.AreEqual(loadedModel.StorageId, entity.FailureMechanismEntityId);
Assert.AreEqual(model.StorageId, loadedModel.StorageId);
+
+ mockRepository.VerifyAll();
}
[Test]
public void LoadModel_ValidEntityWithStochasticSoilModels_UpdatedModel()
{
// Setup
+ var ringtoetsEntities = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
const long storageId = 1234L;
- PipingFailureMechanism model = new PipingFailureMechanism
- {
- StorageId = storageId
- };
var firstId = 122;
var secondId = 234;
FailureMechanismEntity entity = new FailureMechanismEntity
@@ -179,7 +196,6 @@
}
}
};
- var ringtoetsEntities = mockRepository.StrictMock();
PipingFailureMechanismPersistor persistor = new PipingFailureMechanismPersistor(ringtoetsEntities);
var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
@@ -192,6 +208,8 @@
Assert.AreEqual(2, loadedModel.Count);
Assert.AreEqual(firstId, loadedModel[0].StorageId);
Assert.AreEqual(secondId, loadedModel[1].StorageId);
+
+ mockRepository.VerifyAll();
}
[Test]
@@ -732,5 +750,63 @@
mockRepository.VerifyAll();
}
+
+
+ [Test]
+ public void PerformPostSaveActions_InsertedWithChildrenWithoutStorageId_ModelsWithStorageId()
+ {
+ // Setup
+ var ringtoetsEntities = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ var insertedFailureMechanismEntities = new List();
+
+ var failureMechanism = new PipingFailureMechanism
+ {
+ StorageId = 0L,
+ StochasticSoilModels =
+ {
+ new StochasticSoilModel(-1, string.Empty, string.Empty)
+ {
+ StochasticSoilProfiles =
+ {
+ new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile1D, -1)
+ {
+ SoilProfile = new TestPipingSoilProfile()
+ }
+ }
+ }
+ }
+ };
+
+ PipingFailureMechanismPersistor persistor = new PipingFailureMechanismPersistor(ringtoetsEntities);
+ mockRepository.ReplayAll();
+
+ try
+ {
+ persistor.UpdateModel(insertedFailureMechanismEntities, failureMechanism);
+ }
+ catch (Exception)
+ {
+ Assert.Fail("Precondition failed: persistor.UpdateModel");
+ }
+
+ long failureMechanismStorageId = 1226;
+ long soilModelStorageId = 1227;
+ long soilProfileStorageId = 1228;
+ insertedFailureMechanismEntities[0].FailureMechanismEntityId = failureMechanismStorageId;
+ insertedFailureMechanismEntities[0].StochasticSoilModelEntities.ElementAt(0).StochasticSoilModelEntityId = soilModelStorageId;
+ insertedFailureMechanismEntities[0].StochasticSoilModelEntities.ElementAt(0).StochasticSoilProfileEntities.ElementAt(0).StochasticSoilProfileEntityId = soilProfileStorageId;
+
+ // Call
+ persistor.PerformPostSaveActions();
+
+ // Assert
+ Assert.AreEqual(failureMechanismStorageId, failureMechanism.StorageId);
+ Assert.AreEqual(soilModelStorageId, failureMechanism.StochasticSoilModels[0].StorageId);
+ Assert.AreEqual(soilProfileStorageId, failureMechanism.StochasticSoilModels[0].StochasticSoilProfiles[0].StorageId);
+
+ mockRepository.VerifyAll();
+ }
}
}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/StochasticSoilModelPersistorTest.cs
===================================================================
diff -u -r1257b99937b663621a4afb03a50a305aadff6a55 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/StochasticSoilModelPersistorTest.cs (.../StochasticSoilModelPersistorTest.cs) (revision 1257b99937b663621a4afb03a50a305aadff6a55)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/StochasticSoilModelPersistorTest.cs (.../StochasticSoilModelPersistorTest.cs) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -1,4 +1,25 @@
-using System;
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
using System.Collections.Generic;
using System.Linq;
using Application.Ringtoets.Storage.DbContext;
@@ -8,6 +29,8 @@
using NUnit.Framework;
using Rhino.Mocks;
using Ringtoets.Piping.Data;
+using Ringtoets.Piping.KernelWrapper.TestUtil;
+using Ringtoets.Piping.Primitives;
namespace Application.Ringtoets.Storage.Test.Persistors
{
@@ -63,7 +86,7 @@
// Assert
var exception = Assert.Throws(test);
- Assert.AreEqual("entities", exception.ParamName);
+ Assert.AreEqual("entity", exception.ParamName);
mockRepository.VerifyAll();
}
@@ -87,14 +110,9 @@
};
// Call
- List models = persistor.LoadModel(new List
- {
- entity
- }).ToList();
+ StochasticSoilModel model = persistor.LoadModel(entity);
// Assert
- Assert.AreEqual(1, models.Count);
- var model = models[0];
Assert.AreEqual(name, model.Name);
Assert.AreEqual(segmentName, model.SegmentName);
Assert.AreEqual(storageId, model.StorageId);
@@ -103,6 +121,57 @@
}
[Test]
+ public void LoadModel_ValidEntityValidModelWithStochasticProfiles_EntityAsModel()
+ {
+ // Setup
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ var persistor = new StochasticSoilModelPersistor(ringtoetsEntitiesMock);
+
+ const string name = "someName";
+ const string segmentName = "someSegmentName";
+ long storageId = new Random(21).Next();
+ var entity = new StochasticSoilModelEntity
+ {
+ Name = name,
+ SegmentName = segmentName,
+ StochasticSoilModelEntityId = storageId,
+ StochasticSoilProfileEntities = new List
+ {
+ new StochasticSoilProfileEntity
+ {
+ Probability = Convert.ToDecimal(0.5),
+ SoilProfileEntity = new SoilProfileEntity
+ {
+ Bottom = Convert.ToDecimal(-1.5),
+ SoilLayerEntities = new[]
+ {
+ new SoilLayerEntity
+ {
+ Top = Convert.ToDecimal(1.0)
+ }
+ }
+ }
+ }
+ }
+ };
+
+ // Call
+ StochasticSoilModel model = persistor.LoadModel(entity);
+
+ // Assert
+ var stochasticProfile = model.StochasticSoilProfiles.ElementAt(0);
+ var soilProfile = stochasticProfile.SoilProfile;
+ Assert.AreEqual(-1.5, soilProfile.Bottom);
+ Assert.AreEqual(1, soilProfile.Layers.Count());
+ var soilLayer = soilProfile.Layers.ElementAt(0);
+
+ Assert.AreEqual(1.0, soilLayer.Top);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
public void InsertModel_NullParentNavigationProperty_ThrowsArgumentNullException()
{
// Setup
@@ -112,7 +181,7 @@
var persistor = new StochasticSoilModelPersistor(ringtoetsEntitiesMock);
// Call
- TestDelegate test = () => persistor.InsertModel(null, new [] { new StochasticSoilModel(-1, string.Empty, string.Empty) });
+ TestDelegate test = () => persistor.InsertModel(null, new StochasticSoilModel(-1, string.Empty, string.Empty));
// Assert
var exception = Assert.Throws(test);
@@ -167,7 +236,7 @@
};
// Call
- persistor.InsertModel(parentNavigationProperty, new [] { model });
+ persistor.InsertModel(parentNavigationProperty, model);
// Assert
Assert.AreEqual(2, parentNavigationProperty.Count);
@@ -179,48 +248,72 @@
}
[Test]
- public void UpdateModel_NullDatasetValidModel_ThrowsArgumentNullException()
+ public void InsertModel_SingleStochasticSoilModelWithStochasticSoilProfiles_StochasticSoilModelAsEntityInParentNavigationProperty()
{
// Setup
var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
mockRepository.ReplayAll();
var persistor = new StochasticSoilModelPersistor(ringtoetsEntitiesMock);
- var soilModels = new[]
+ const long storageId = 1234L;
+ StochasticSoilModelEntity entityToDelete = new StochasticSoilModelEntity
{
- new StochasticSoilModel(-1, string.Empty, string.Empty)
+ StochasticSoilModelEntityId = storageId
};
+ IList parentNavigationProperty = new List
+ {
+ entityToDelete
+ };
+
+ StochasticSoilModel model = new StochasticSoilModel(-1, string.Empty, string.Empty)
+ {
+ StorageId = storageId,
+ StochasticSoilProfiles =
+ {
+ new StochasticSoilProfile(0.2, SoilProfileType.SoilProfile1D, -1)
+ {
+ SoilProfile = new TestPipingSoilProfile()
+ }
+ }
+ };
+
// Call
- TestDelegate test = () => persistor.UpdateModel(null, soilModels);
+ persistor.InsertModel(parentNavigationProperty, model);
// Assert
- var exception = Assert.Throws(test);
- Assert.AreEqual("parentNavigationProperty", exception.ParamName);
+ Assert.AreEqual(2, parentNavigationProperty.Count);
+ var parentNavigationPropertyList = parentNavigationProperty.ToList();
+ var entity = parentNavigationPropertyList[1];
+ Assert.AreEqual(storageId, entity.StochasticSoilModelEntityId);
mockRepository.VerifyAll();
}
[Test]
- public void UpdateModel_EmptyDatasetNullModel_DoesNotThrow()
+ public void UpdateModel_NullDatasetValidModel_ThrowsArgumentNullException()
{
// Setup
var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
mockRepository.ReplayAll();
var persistor = new StochasticSoilModelPersistor(ringtoetsEntitiesMock);
- IList parentNavigationProperty = new List();
+ var soilModel = new StochasticSoilModel(-1, string.Empty, string.Empty);
+
// Call
- TestDelegate test = () => persistor.UpdateModel(parentNavigationProperty, null);
+ TestDelegate test = () => persistor.UpdateModel(null, soilModel);
// Assert
- Assert.DoesNotThrow(test);
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("parentNavigationProperty", exception.ParamName);
+
+ mockRepository.VerifyAll();
}
[Test]
- public void UpdateModel_EmptyDatasetNullEntryInModel_ArgumentException()
+ public void UpdateModel_EmptyDatasetNullModel_DoesNotThrow()
{
// Setup
var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
@@ -229,17 +322,11 @@
var persistor = new StochasticSoilModelPersistor(ringtoetsEntitiesMock);
IList parentNavigationProperty = new List();
- var soilModels = new StochasticSoilModel[]
- {
- null
- };
-
// Call
- TestDelegate test = () => persistor.UpdateModel(parentNavigationProperty, soilModels);
+ TestDelegate test = () => persistor.UpdateModel(parentNavigationProperty, null);
// Assert
- var message = Assert.Throws(test).Message;
- Assert.AreEqual("A null StochasticSoilModel cannot be added", message);
+ Assert.DoesNotThrow(test);
}
[Test]
@@ -254,16 +341,14 @@
var persistor = new StochasticSoilModelPersistor(ringtoetsEntitiesMock);
IList parentNavigationProperty = new List();
- var soilModels = new[]
+ var soilModel = new StochasticSoilModel(-1, string.Empty, string.Empty)
{
- new StochasticSoilModel(-1, string.Empty, string.Empty)
- {
- StorageId = storageId
- }
+ StorageId = storageId
};
+
// Call
- TestDelegate test = () => persistor.UpdateModel(parentNavigationProperty, soilModels);
+ TestDelegate test = () => persistor.UpdateModel(parentNavigationProperty, soilModel);
// Assert
var expectedMessage = String.Format("Het object 'StochasticSoilModelEntity' met id '{0}' is niet gevonden.", storageId);
@@ -294,16 +379,13 @@
}
};
- var soilModels = new[]
+ var soilModel = new StochasticSoilModel(-1, string.Empty, string.Empty)
{
- new StochasticSoilModel(-1, string.Empty, string.Empty)
- {
- StorageId = storageId
- }
+ StorageId = storageId
};
// Call
- TestDelegate test = () => persistor.UpdateModel(parentNavigationProperty, soilModels);
+ TestDelegate test = () => persistor.UpdateModel(parentNavigationProperty, soilModel);
// Assert
var expectedMessage = String.Format("Het object 'StochasticSoilModelEntity' met id '{0}' is niet gevonden.", storageId);
@@ -332,16 +414,13 @@
var name = "someName";
var segmentName = "someSegmentName";
- var soilModels = new[]
+ var soilModel = new StochasticSoilModel(-1, name, segmentName)
{
- new StochasticSoilModel(-1, name, segmentName)
- {
- StorageId = storageId
- }
+ StorageId = storageId
};
// Call
- persistor.UpdateModel(parentNavigationProperty, soilModels);
+ persistor.UpdateModel(parentNavigationProperty, soilModel);
// Assert
Assert.AreEqual(1, parentNavigationProperty.Length);
@@ -366,16 +445,13 @@
var name = "someName";
var segmentName = "someSegmentName";
- var soilModels = new[]
+ var soilModel = new StochasticSoilModel(-1, name, segmentName)
{
- new StochasticSoilModel(-1, name, segmentName)
- {
- StorageId = 0
- }
+ StorageId = 0
};
// Call
- persistor.UpdateModel(parentNavigationProperty, soilModels);
+ persistor.UpdateModel(parentNavigationProperty, soilModel);
// Assert
Assert.AreEqual(1, parentNavigationProperty.Count);
@@ -384,7 +460,7 @@
}
[Test]
- public void UpdateModel_SingleEntityInParentNavigationPropertySingleStochasticSoilModelWithoutStorageId_UpdatedStochasticSoilModelAsEntityInParentNavigationPropertyAndOthersDeletedInDbSet()
+ public void UpdateModel_SingleEntityInParentNavigationPropertySingleStochasticSoilModelWithoutStorageId_UpdatedStochasticSoilModelAsEntityInParentNavigationProperty()
{
// Setup
const long storageId = 0L; // Newly inserted entities have Id = 0 untill they are saved
@@ -410,16 +486,12 @@
StochasticSoilModelPersistor persistor = new StochasticSoilModelPersistor(ringtoetsEntitiesMock);
var name = "someName";
var segmentName = "someSegmentName";
- var soilModels = new[]
- {
- new StochasticSoilModel(-1, name, segmentName)
- };
+ var soilModel = new StochasticSoilModel(-1, name, segmentName);
// Call
- persistor.UpdateModel(parentNavigationProperty, soilModels);
+ persistor.UpdateModel(parentNavigationProperty, soilModel);
// Assert
- CollectionAssert.IsEmpty(ringtoetsEntitiesMock.StochasticSoilModelEntities);
Assert.AreEqual(2, parentNavigationProperty.Count);
StochasticSoilModelEntity entity = parentNavigationProperty.SingleOrDefault(x => x.StochasticSoilModelEntityId == storageId);
Assert.IsNotNull(entity);
@@ -431,6 +503,45 @@
}
[Test]
+ public void RemoveUnModifiedEntries_SingleEntityInParentNavigationPropertySingleStochasticSoilModelWithoutStorageId_DbSetCleared()
+ {
+ // Setup
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ StochasticSoilModelEntity entityToDelete = new StochasticSoilModelEntity
+ {
+ StochasticSoilModelEntityId = 4567L,
+ Name = "Entity to delete"
+ };
+
+ ringtoetsEntitiesMock.StochasticSoilModelEntities.Add(entityToDelete);
+
+ var parentNavigationProperty = new List
+ {
+ entityToDelete
+ };
+
+ mockRepository.ReplayAll();
+
+ StochasticSoilModelPersistor persistor = new StochasticSoilModelPersistor(ringtoetsEntitiesMock);
+ var name = "someName";
+ var segmentName = "someSegmentName";
+ var soilModel = new StochasticSoilModel(-1, name, segmentName);
+
+ persistor.UpdateModel(parentNavigationProperty, soilModel);
+
+ // Call
+ persistor.RemoveUnModifiedEntries(parentNavigationProperty);
+
+ // Assert
+ Assert.IsEmpty(ringtoetsEntitiesMock.StochasticSoilModelEntities);
+
+ mockRepository.VerifyAll();
+ }
+
+
+ [Test]
public void PerformPostSaveActions_NoInserts_DoesNotThrowException()
{
// Setup
@@ -461,19 +572,20 @@
var parentNavigationProperty = new List();
IList stochasticSoilModel = new List();
- for (var i = 0; i < numberOfInserts; i++)
- {
- stochasticSoilModel.Add(new StochasticSoilModel(-1, string.Empty, string.Empty)
- {
- StorageId = 0L
- });
- }
var persistor = new StochasticSoilModelPersistor(ringtoetsEntitiesMock);
try
{
- persistor.UpdateModel(parentNavigationProperty, stochasticSoilModel);
+ for (var i = 0; i < numberOfInserts; i++)
+ {
+ var soilModel = new StochasticSoilModel(-1, string.Empty, string.Empty)
+ {
+ StorageId = 0L
+ };
+ stochasticSoilModel.Add(soilModel);
+ persistor.UpdateModel(parentNavigationProperty, soilModel);
+ }
}
catch (Exception)
{
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/StochasticSoilProfilePersistorTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/StochasticSoilProfilePersistorTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/StochasticSoilProfilePersistorTest.cs (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -0,0 +1,524 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Exceptions;
+using Application.Ringtoets.Storage.Persistors;
+using Application.Ringtoets.Storage.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.KernelWrapper.TestUtil;
+using Ringtoets.Piping.Primitives;
+
+namespace Application.Ringtoets.Storage.Test.Persistors
+{
+ [TestFixture]
+ public class StochasticSoilProfilePersistorTest
+ {
+ private MockRepository mockRepository;
+
+ [SetUp]
+ public void Setup()
+ {
+ mockRepository = new MockRepository();
+ }
+
+ [Test]
+ public void Constructor_EmptyDataSet_NewInstance()
+ {
+ // Setup
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ // Call
+ StochasticSoilProfilePersistor persistor = new StochasticSoilProfilePersistor(ringtoetsEntitiesMock);
+
+ // Assert
+ Assert.IsInstanceOf(persistor);
+
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_NullDataSet_ThrowsAgrumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new StochasticSoilProfilePersistor(null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("ringtoetsContext", exception.ParamName);
+ }
+
+ [Test]
+ public void LoadModel_NullEntity_ThrowsArgumentNullException()
+ {
+ // Setup
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ var persistor = new StochasticSoilProfilePersistor(ringtoetsEntitiesMock);
+
+ // Call
+ TestDelegate test = () => persistor.LoadModel(null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("entity", exception.ParamName);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void LoadModel_ValidEntityValidModel_EntityAsModel()
+ {
+ // Setup
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ var persistor = new StochasticSoilProfilePersistor(ringtoetsEntitiesMock);
+
+ var probability = Convert.ToDecimal(1.0);
+ var entity = new StochasticSoilProfileEntity
+ {
+ Probability = probability,
+ SoilProfileEntity = new SoilProfileEntity
+ {
+ SoilLayerEntities = new List
+ {
+ new SoilLayerEntity()
+ }
+ }
+ };
+
+ // Call
+ StochasticSoilProfile model = persistor.LoadModel(entity);
+
+ // Assert
+ Assert.AreEqual(probability, model.Probability);
+
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void InsertModel_NullParentNavigationProperty_ThrowsArgumentNullException()
+ {
+ // Setup
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ var persistor = new StochasticSoilProfilePersistor(ringtoetsEntitiesMock);
+
+ // Call
+ TestDelegate test = () => persistor.InsertModel(null, new StochasticSoilProfile(0.3, SoilProfileType.SoilProfile1D, -1));
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("parentNavigationProperty", exception.ParamName);
+
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void InsertModel_NullModel_DoesNotAddEntityInParentNavigationProperty()
+ {
+ // Setup
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ var persistor = new StochasticSoilProfilePersistor(ringtoetsEntitiesMock);
+ var parentNavigationProperty = new List();
+
+ // Call
+ TestDelegate test = () => persistor.InsertModel(parentNavigationProperty, null);
+
+ // Assert
+ Assert.DoesNotThrow(test);
+ Assert.IsEmpty(parentNavigationProperty);
+
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void InsertModel_SingleEntityInParentNavigationPropertyStochasticSoilProfileWithSameStorageId_StochasticSoilProfileAsEntityInParentNavigationProperty()
+ {
+ // Setup
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ var persistor = new StochasticSoilProfilePersistor(ringtoetsEntitiesMock);
+
+ const long storageId = 1234L;
+ StochasticSoilProfileEntity entityToDelete = new StochasticSoilProfileEntity
+ {
+ StochasticSoilProfileEntityId = storageId
+ };
+
+ IList parentNavigationProperty = new List
+ {
+ entityToDelete
+ };
+
+ StochasticSoilProfile soilProfile = new StochasticSoilProfile(0.1, SoilProfileType.SoilProfile1D, -1)
+ {
+ StorageId = storageId,
+ SoilProfile = new TestPipingSoilProfile()
+ };
+
+ // Call
+ persistor.InsertModel(parentNavigationProperty, soilProfile);
+
+ // Assert
+ Assert.AreEqual(2, parentNavigationProperty.Count);
+ var parentNavigationPropertyList = parentNavigationProperty.ToList();
+ var entity = parentNavigationPropertyList[1];
+ Assert.AreEqual(storageId, entity.StochasticSoilProfileEntityId);
+
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void UpdateModel_NullDatasetValidModel_ThrowsArgumentNullException()
+ {
+ // Setup
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ var persistor = new StochasticSoilProfilePersistor(ringtoetsEntitiesMock);
+
+ var soilProfile = new StochasticSoilProfile(0.1, SoilProfileType.SoilProfile1D, -1);
+
+ // Call
+ TestDelegate test = () => persistor.UpdateModel(null, soilProfile);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("parentNavigationProperty", exception.ParamName);
+
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void UpdateModel_EmptyDatasetNullModel_DoesNotThrow()
+ {
+ // Setup
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ var persistor = new StochasticSoilProfilePersistor(ringtoetsEntitiesMock);
+ IList parentNavigationProperty = new List();
+
+ // Call
+ TestDelegate test = () => persistor.UpdateModel(parentNavigationProperty, null);
+
+ // Assert
+ Assert.DoesNotThrow(test);
+ }
+
+ [Test]
+ public void UpdateModel_EmptyDataset_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ const long storageId = 1234L;
+
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ var persistor = new StochasticSoilProfilePersistor(ringtoetsEntitiesMock);
+ IList parentNavigationProperty = new List();
+
+ var soilProfile = new StochasticSoilProfile(0.1, SoilProfileType.SoilProfile1D, -1)
+ {
+ StorageId = storageId,
+ SoilProfile = new TestPipingSoilProfile()
+ };
+
+
+ // Call
+ TestDelegate test = () => persistor.UpdateModel(parentNavigationProperty, soilProfile);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'StochasticSoilProfileEntity' met id '{0}' is niet gevonden.", storageId);
+ var exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void UpdateModel_DuplicateEntityInDataset_ThrowsEntityNotFoundException()
+ {
+ // Setup
+ const long storageId = 1234L;
+
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ var persistor = new StochasticSoilProfilePersistor(ringtoetsEntitiesMock);
+ IList parentNavigationProperty = new List
+ {
+ new StochasticSoilProfileEntity
+ {
+ StochasticSoilProfileEntityId = storageId
+ },
+ new StochasticSoilProfileEntity
+ {
+ StochasticSoilProfileEntityId = storageId
+ }
+ };
+
+ var soilProfile = new StochasticSoilProfile(0.1, SoilProfileType.SoilProfile1D, -1)
+ {
+ StorageId = storageId,
+ SoilProfile = new TestPipingSoilProfile()
+ };
+
+ // Call
+ TestDelegate test = () => persistor.UpdateModel(parentNavigationProperty, soilProfile);
+
+ // Assert
+ var expectedMessage = String.Format("Het object 'StochasticSoilProfileEntity' met id '{0}' is niet gevonden.", storageId);
+ var exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void UpdateModel_SingleEntityInParentNavigationPropertySingleStochasticSoilProfileWithStorageId_UpdatedStochasticSoilProfileAsEntityInParentNavigationProperty()
+ {
+ // Setup
+ const long storageId = 1234L;
+
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ var persistor = new StochasticSoilProfilePersistor(ringtoetsEntitiesMock);
+ var parentNavigationProperty = new []
+ {
+ new StochasticSoilProfileEntity
+ {
+ StochasticSoilProfileEntityId = storageId
+ }
+ };
+
+ var probability = new Random(21).NextDouble();
+ var soilProfile = new StochasticSoilProfile(probability, SoilProfileType.SoilProfile1D, -1)
+ {
+ StorageId = storageId,
+ SoilProfile = new TestPipingSoilProfile()
+ };
+
+ // Call
+ persistor.UpdateModel(parentNavigationProperty, soilProfile);
+
+ // Assert
+ Assert.AreEqual(1, parentNavigationProperty.Length);
+ var parentNavigationPropertyList = parentNavigationProperty.ToList();
+ var entity = parentNavigationPropertyList[0];
+ Assert.AreEqual(storageId, entity.StochasticSoilProfileEntityId);
+ Assert.AreEqual(probability, entity.Probability);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void UpdateModel_NoStorageIdSet_InsertNewEntity()
+ {
+ // Setup
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ var persistor = new StochasticSoilProfilePersistor(ringtoetsEntitiesMock);
+
+ IList parentNavigationProperty = new List();
+
+ var probability = new Random(21).NextDouble();
+ var soilProfile = new StochasticSoilProfile(probability, SoilProfileType.SoilProfile1D, -1)
+ {
+ StorageId = 0,
+ SoilProfile = new TestPipingSoilProfile()
+ };
+
+ // Call
+ persistor.UpdateModel(parentNavigationProperty, soilProfile);
+
+ // Assert
+ Assert.AreEqual(1, parentNavigationProperty.Count);
+
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void UpdateModel_SingleEntityInParentNavigationPropertySingleStochasticSoilProfileWithoutStorageId_UpdatedStochasticSoilProfileAsEntityInParentNavigationProperty()
+ {
+ // Setup
+ const long storageId = 0L; // Newly inserted entities have Id = 0 untill they are saved
+
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ StochasticSoilProfileEntity entityToDelete = new StochasticSoilProfileEntity
+ {
+ StochasticSoilProfileEntityId = 4567L
+ };
+
+ ringtoetsEntitiesMock.StochasticSoilProfileEntities.Add(entityToDelete);
+
+ var parentNavigationProperty = new List
+ {
+ entityToDelete
+ };
+
+ mockRepository.ReplayAll();
+
+ StochasticSoilProfilePersistor persistor = new StochasticSoilProfilePersistor(ringtoetsEntitiesMock);
+ var probability = new Random(21).NextDouble();
+ var soilProfile = new StochasticSoilProfile(probability, SoilProfileType.SoilProfile1D, -1)
+ {
+ SoilProfile = new TestPipingSoilProfile()
+ };
+
+ // Call
+ persistor.UpdateModel(parentNavigationProperty, soilProfile);
+
+ // Assert
+ Assert.AreEqual(2, parentNavigationProperty.Count);
+ StochasticSoilProfileEntity entity = parentNavigationProperty.SingleOrDefault(x => x.StochasticSoilProfileEntityId == storageId);
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(storageId, entity.StochasticSoilProfileEntityId);
+ Assert.AreEqual(probability, entity.Probability);
+
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void UpdateModel_SingleEntityInParentNavigationPropertySingleStochasticSoilProfileWithoutStorageId_DbSetCleared()
+ {
+ // Setup
+ const long storageId = 0L; // Newly inserted entities have Id = 0 untill they are saved
+
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ StochasticSoilProfileEntity entityToDelete = new StochasticSoilProfileEntity
+ {
+ StochasticSoilProfileEntityId = 4567L
+ };
+
+ ringtoetsEntitiesMock.StochasticSoilProfileEntities.Add(entityToDelete);
+
+ var parentNavigationProperty = new List
+ {
+ entityToDelete
+ };
+
+ mockRepository.ReplayAll();
+
+ StochasticSoilProfilePersistor persistor = new StochasticSoilProfilePersistor(ringtoetsEntitiesMock);
+ var probability = new Random(21).NextDouble();
+ var soilProfile = new StochasticSoilProfile(probability, SoilProfileType.SoilProfile1D, -1)
+ {
+ SoilProfile = new TestPipingSoilProfile()
+ };
+
+ persistor.UpdateModel(parentNavigationProperty, soilProfile);
+
+ // Call
+ persistor.RemoveUnModifiedEntries(parentNavigationProperty);
+
+ // Assert
+ CollectionAssert.IsEmpty(ringtoetsEntitiesMock.StochasticSoilProfileEntities);
+
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void PerformPostSaveActions_NoInserts_DoesNotThrowException()
+ {
+ // Setup
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ var persistor = new StochasticSoilProfilePersistor(ringtoetsEntitiesMock);
+
+ // Call
+ TestDelegate test = () => persistor.PerformPostSaveActions();
+
+ // Assert
+ Assert.DoesNotThrow(test);
+
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(0)]
+ [TestCase(1)]
+ [TestCase(2)]
+ public void PerformPostSaveActions_MultipleModelsInsertedWithoutStorageId_ModelsWithStorageId(int numberOfInserts)
+ {
+ // Setup
+ var ringtoetsEntitiesMock = RingtoetsEntitiesHelper.Create(mockRepository);
+ mockRepository.ReplayAll();
+
+ var parentNavigationProperty = new List();
+
+ IList stochasticSoilProfiles = new List();
+
+ var persistor = new StochasticSoilProfilePersistor(ringtoetsEntitiesMock);
+
+ try
+ {
+ for (var i = 0; i < numberOfInserts; i++)
+ {
+ var soilProfile = new StochasticSoilProfile(0.1, SoilProfileType.SoilProfile1D, -1)
+ {
+ StorageId = 0,
+ SoilProfile = new TestPipingSoilProfile()
+ };
+ stochasticSoilProfiles.Add(soilProfile);
+ persistor.UpdateModel(parentNavigationProperty, soilProfile);
+ }
+ }
+ catch (Exception)
+ {
+ Assert.Fail("Precondition failed: persistor.UpdateModel");
+ }
+
+ // Call
+ for (var i = 0; i < parentNavigationProperty.Count; i++)
+ {
+ parentNavigationProperty[i].StochasticSoilProfileEntityId = 1L + i;
+ }
+ persistor.PerformPostSaveActions();
+
+ // Assert
+ Assert.AreEqual(stochasticSoilProfiles.Count, parentNavigationProperty.Count);
+ foreach (var entity in parentNavigationProperty)
+ {
+ StochasticSoilProfile insertedModel = stochasticSoilProfiles.SingleOrDefault(x => x.StorageId == entity.StochasticSoilProfileEntityId);
+ Assert.IsNotNull(insertedModel);
+ }
+
+ mockRepository.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/Application.Ringtoets.Storage.TestUtil.csproj
===================================================================
diff -u -r4e14ed090d09a220a790b3562ceb4232dab1cce6 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/Application.Ringtoets.Storage.TestUtil.csproj (.../Application.Ringtoets.Storage.TestUtil.csproj) (revision 4e14ed090d09a220a790b3562ceb4232dab1cce6)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/Application.Ringtoets.Storage.TestUtil.csproj (.../Application.Ringtoets.Storage.TestUtil.csproj) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -94,6 +94,18 @@
{11F1F874-45AF-43E4-8AE5-15A5C9593E28}
Ringtoets.Integration.Data
+
+ {CE994CC9-6F6A-48AC-B4BE-02C30A21F4DB}
+ Ringtoets.Piping.Data
+
+
+ {14C6F716-64E2-4BC4-A1EF-05865FCEFA4C}
+ Ringtoets.Piping.Primitives
+
+
+ {27E0A5C9-3ABF-426A-A3DA-7D0B83A218C8}
+ Ringtoets.Piping.KernelWrapper.TestUtil
+
{50963F12-448C-41BA-A62C-CDB0AB8D21E0}
Application.Ringtoets.Storage
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsEntitiesHelper.cs
===================================================================
diff -u -r4e14ed090d09a220a790b3562ceb4232dab1cce6 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsEntitiesHelper.cs (.../RingtoetsEntitiesHelper.cs) (revision 4e14ed090d09a220a790b3562ceb4232dab1cce6)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsEntitiesHelper.cs (.../RingtoetsEntitiesHelper.cs) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -37,12 +37,14 @@
var dasSet = (DbSet) new TestDbSet(new ObservableCollection());
var rlpSet = (DbSet) new TestDbSet(new ObservableCollection());
var ssmSet = (DbSet) new TestDbSet(new ObservableCollection());
+ var sspSet = (DbSet)new TestDbSet(new ObservableCollection());
ringtoetsEntities.Stub(r => r.ProjectEntities).Return(pSet);
ringtoetsEntities.Stub(r => r.HydraulicLocationEntities).Return(hlSet);
ringtoetsEntities.Stub(r => r.FailureMechanismEntities).Return(fmSet);
ringtoetsEntities.Stub(r => r.AssessmentSectionEntities).Return(dasSet);
ringtoetsEntities.Stub(r => r.ReferenceLinePointEntities).Return(rlpSet);
ringtoetsEntities.Stub(r => r.StochasticSoilModelEntities).Return(ssmSet);
+ ringtoetsEntities.Stub(r => r.StochasticSoilProfileEntities).Return(sspSet);
return ringtoetsEntities;
}
}
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectHelper.cs
===================================================================
diff -u -rf1bd17ba95b3fbae5928d4240523d50d8b83b64d -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectHelper.cs (.../RingtoetsProjectHelper.cs) (revision f1bd17ba95b3fbae5928d4240523d50d8b83b64d)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectHelper.cs (.../RingtoetsProjectHelper.cs) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -25,6 +25,9 @@
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.HydraRing.Data;
using Ringtoets.Integration.Data;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.KernelWrapper.TestUtil;
+using Ringtoets.Piping.Primitives;
namespace Application.Ringtoets.Storage.TestUtil
{
@@ -49,7 +52,27 @@
{
Name = "assessmentSection",
HydraulicBoundaryDatabase = GetHydraulicBoundaryDatabase(),
- ReferenceLine = GetReferenceLine()
+ ReferenceLine = GetReferenceLine(),
+ PipingFailureMechanism =
+ {
+ StochasticSoilModels =
+ {
+ new StochasticSoilModel(-1, "modelName", "modelSegmentName")
+ {
+ StochasticSoilProfiles =
+ {
+ new StochasticSoilProfile(0.2, SoilProfileType.SoilProfile1D, -1)
+ {
+ SoilProfile = new TestPipingSoilProfile()
+ },
+ new StochasticSoilProfile(0.8, SoilProfileType.SoilProfile1D, -1)
+ {
+ SoilProfile = new TestPipingSoilProfile()
+ }
+ }
+ }
+ }
+ }
}
}
};
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilProfile.cs
===================================================================
diff -u -r8c1d631e78831a7fa357c4b285e89942d532bebb -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilProfile.cs (.../StochasticSoilProfile.cs) (revision 8c1d631e78831a7fa357c4b285e89942d532bebb)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilProfile.cs (.../StochasticSoilProfile.cs) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -61,6 +61,11 @@
///
public PipingSoilProfile SoilProfile { get; set; }
+ ///
+ /// Gets or sets the unique identifier for the storage of the .
+ ///
+ public long StorageId { get; set; }
+
public override string ToString()
{
return SoilProfile == null ? string.Empty : SoilProfile.ToString();
Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilProfile.cs
===================================================================
diff -u -r5061321f2f8b942937713732163d9e55f2acb176 -r6d514ec60f68620d78015ac58ba6a966ef6b14e3
--- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilProfile.cs (.../PipingSoilProfile.cs) (revision 5061321f2f8b942937713732163d9e55f2acb176)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilProfile.cs (.../PipingSoilProfile.cs) (revision 6d514ec60f68620d78015ac58ba6a966ef6b14e3)
@@ -94,11 +94,6 @@
public SoilProfileType SoilProfileType { get; private set; }
///
- /// Gets or sets the unique identifier for the storage of the .
- ///
- public long StorageId { get; set; }
-
- ///
/// Gets the thickness of the given layer in the .
/// Thickness of a layer is determined by its top and the top of the layer below it.
///