Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj
===================================================================
diff -u -r94a8ffbf9b1040b5a6092c8af0f38ce5dbe6e1fb -r8a15fe6e429a0f177f25defaf1851c9963374dbe
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 94a8ffbf9b1040b5a6092c8af0f38ce5dbe6e1fb)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -56,6 +56,8 @@
+
+
@@ -227,6 +229,7 @@
+
@@ -294,6 +297,8 @@
+
+
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/AssessmentSectionCreateExtensions.cs
===================================================================
diff -u -rc482712c0ff06d5654836fc8d9af535641d63ffb -r8a15fe6e429a0f177f25defaf1851c9963374dbe
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/AssessmentSectionCreateExtensions.cs (.../AssessmentSectionCreateExtensions.cs) (revision c482712c0ff06d5654836fc8d9af535641d63ffb)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/AssessmentSectionCreateExtensions.cs (.../AssessmentSectionCreateExtensions.cs) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -72,18 +72,12 @@
entity.FailureMechanismEntities.Add(section.PipingStructure.Create(registry));
entity.FailureMechanismEntities.Add(section.StabilityStoneCover.Create(registry));
entity.FailureMechanismEntities.Add(section.DuneErosion.Create(registry));
+ entity.FailureMechanismEntities.Add(section.StrengthStabilityPointConstruction.Create(registry));
- AddEntitiesForAddStandAloneFailureMechanisms(section, entity, registry);
-
registry.Register(entity, section);
return entity;
}
- private static void AddEntitiesForAddStandAloneFailureMechanisms(AssessmentSection section, AssessmentSectionEntity entity, PersistenceRegistry registry)
- {
- entity.FailureMechanismEntities.Add(section.StrengthStabilityPointConstruction.Create(FailureMechanismType.StrengthAndStabilityPointConstruction, registry));
- }
-
private static void AddEntityForReferenceLine(AssessmentSection section, AssessmentSectionEntity entity)
{
if (section.ReferenceLine != null)
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PersistenceRegistry.cs
===================================================================
diff -u -rc482712c0ff06d5654836fc8d9af535641d63ffb -r8a15fe6e429a0f177f25defaf1851c9963374dbe
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PersistenceRegistry.cs (.../PersistenceRegistry.cs) (revision c482712c0ff06d5654836fc8d9af535641d63ffb)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PersistenceRegistry.cs (.../PersistenceRegistry.cs) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -70,6 +70,7 @@
private readonly Dictionary pipingStructureFailureMechanismSectionResults = new Dictionary();
private readonly Dictionary duneErosionFailureMechanismSectionResults = new Dictionary();
private readonly Dictionary stabilityStoneCoverFailureMechanismSectionResults = new Dictionary();
+ private readonly Dictionary strengthStabilityPointConstructionFailureMechanismSectionResults = new Dictionary();
private readonly Dictionary hydraulicLocations = new Dictionary(new ReferenceEqualityComparer());
private readonly Dictionary calculationGroups = new Dictionary(new ReferenceEqualityComparer());
private readonly Dictionary pipingCalculations = new Dictionary(new ReferenceEqualityComparer());
@@ -376,6 +377,22 @@
/// Registers a create or update operation for and the
/// that was constructed with the information.
///
+ /// The to be registered.
+ /// The to be registered.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ public void Register(StrengthStabilityPointConstructionSectionResultEntity entity, StrengthStabilityPointConstructionFailureMechanismSectionResult model)
+ {
+ Register(strengthStabilityPointConstructionFailureMechanismSectionResults, entity, model);
+ }
+
+ ///
+ /// Registers a create or update operation for and the
+ /// that was constructed with the information.
+ ///
/// The to be registered.
/// The to be registered.
/// Thrown when either:
@@ -927,6 +944,11 @@
stabilityStoneCoverFailureMechanismSectionResults[entity].StorageId = entity.StabilityStoneCoverSectionResultEntityId;
}
+ foreach (var entity in strengthStabilityPointConstructionFailureMechanismSectionResults.Keys)
+ {
+ strengthStabilityPointConstructionFailureMechanismSectionResults[entity].StorageId = entity.StrengthStabilityPointConstructionSectionResultEntityId;
+ }
+
foreach (var entity in hydraulicLocations.Keys)
{
hydraulicLocations[entity].StorageId = entity.HydraulicLocationEntityId;
@@ -1228,6 +1250,17 @@
}
dbContext.StabilityStoneCoverSectionResultEntities.RemoveRange(orphanedStabilityStoneCoverSectionResultEntities);
+ var orphanedStrengthStabilityPointConstructionSectionResultEntities = new List();
+ foreach (StrengthStabilityPointConstructionSectionResultEntity sectionResultEntity in dbContext.StrengthStabilityPointConstructionSectionResultEntities
+ .Where(e => e.StrengthStabilityPointConstructionSectionResultEntityId > 0))
+ {
+ if (!strengthStabilityPointConstructionFailureMechanismSectionResults.ContainsKey(sectionResultEntity))
+ {
+ orphanedStrengthStabilityPointConstructionSectionResultEntities.Add(sectionResultEntity);
+ }
+ }
+ dbContext.StrengthStabilityPointConstructionSectionResultEntities.RemoveRange(orphanedStrengthStabilityPointConstructionSectionResultEntities);
+
var orphanedHydraulicLocationEntities = new List();
foreach (HydraulicLocationEntity hydraulicLocationEntity in dbContext.HydraulicLocationEntities
.Where(e => e.HydraulicLocationEntityId > 0))
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityPointConstructionFailureMechanismCreateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityPointConstructionFailureMechanismCreateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityPointConstructionFailureMechanismCreateExtensions.cs (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -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 System.Collections.Generic;
+using Application.Ringtoets.Storage.DbContext;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Create
+{
+ ///
+ /// Extension methods for related to creating a .
+ ///
+ internal static class StrengthStabilityPointConstructionFailureMechanismCreateExtensions
+ {
+ ///
+ /// Creates a based on the information of the .
+ ///
+ /// The failure mechanism to create a database entity for.
+ /// The object keeping track of create operations.
+ /// A new .
+ /// Thrown when is null.
+ internal static FailureMechanismEntity Create(this StrengthStabilityPointConstructionFailureMechanism mechanism, PersistenceRegistry registry)
+ {
+ var entity = mechanism.Create(FailureMechanismType.StrengthAndStabilityPointConstruction, registry);
+ AddEntitiesForSectionResults(mechanism.SectionResults, registry);
+
+ registry.Register(entity, mechanism);
+ return entity;
+ }
+
+ private static void AddEntitiesForSectionResults(
+ IEnumerable sectionResults,
+ PersistenceRegistry registry)
+ {
+ foreach (var failureMechanismSectionResult in sectionResults)
+ {
+ var sectionResultEntity = failureMechanismSectionResult.Create(registry);
+ var section = registry.Get(failureMechanismSectionResult.Section);
+ section.StrengthStabilityPointConstructionSectionResultEntities.Add(sectionResultEntity);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensions.cs (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -0,0 +1,57 @@
+// 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.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Create
+{
+ ///
+ /// Extension methods for related to creating a
+ /// .
+ ///
+ internal static class StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensions
+ {
+ ///
+ /// Creates a based on the information of the .
+ ///
+ /// The result to create a database entity for.
+ /// The object keeping track of create operations.
+ /// A new .
+ /// Thrown when is null.
+ internal static StrengthStabilityPointConstructionSectionResultEntity Create(this StrengthStabilityPointConstructionFailureMechanismSectionResult result, PersistenceRegistry registry)
+ {
+ if (registry == null)
+ {
+ throw new ArgumentNullException("registry");
+ }
+ var sectionResultEntity = new StrengthStabilityPointConstructionSectionResultEntity
+ {
+ LayerTwoA = result.AssessmentLayerTwoA.Value.ToNullableDecimal(),
+ LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal()
+ };
+
+ registry.Register(sectionResultEntity, result);
+ return sectionResultEntity;
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql
===================================================================
diff -u -r94a8ffbf9b1040b5a6092c8af0f38ce5dbe6e1fb -r8a15fe6e429a0f177f25defaf1851c9963374dbe
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql (.../DatabaseStructure.sql) (revision 94a8ffbf9b1040b5a6092c8af0f38ce5dbe6e1fb)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql (.../DatabaseStructure.sql) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -1,6 +1,6 @@
/* ---------------------------------------------------- */
/* Generated by Enterprise Architect Version 12.0 */
-/* Created On : 17-jun-2016 15:55:23 */
+/* Created On : 17-jun-2016 16:10:03 */
/* DBMS : SQLite */
/* ---------------------------------------------------- */
@@ -569,8 +569,8 @@
(
'StrengthStabilityPointConstructionSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
'FailureMechanismSectionEntityId' INTEGER NOT NULL,
- 'LevelTwoA' NUMERIC,
- 'LevelThree' NUMERIC,
+ 'LayerTwoA' NUMERIC,
+ 'LayerThree' NUMERIC,
CONSTRAINT 'FK_StrengthStabilityPointConstructionSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/IRingtoetsEntities.cs
===================================================================
diff -u -rc482712c0ff06d5654836fc8d9af535641d63ffb -r8a15fe6e429a0f177f25defaf1851c9963374dbe
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/IRingtoetsEntities.cs (.../IRingtoetsEntities.cs) (revision c482712c0ff06d5654836fc8d9af535641d63ffb)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/IRingtoetsEntities.cs (.../IRingtoetsEntities.cs) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -157,6 +157,12 @@
DbSet StabilityStoneCoverSectionResultEntities { get; }
///
+ /// Gets a of containing
+ /// every entity found in the database.
+ ///
+ DbSet StrengthStabilityPointConstructionSectionResultEntities { get; }
+
+ ///
/// Gets a of containing
/// every entity found in the database.
///
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx
===================================================================
diff -u -r94a8ffbf9b1040b5a6092c8af0f38ce5dbe6e1fb -r8a15fe6e429a0f177f25defaf1851c9963374dbe
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision 94a8ffbf9b1040b5a6092c8af0f38ce5dbe6e1fb)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -352,8 +352,8 @@
-
-
+
+
@@ -1739,8 +1739,8 @@
-
-
+
+
@@ -2683,8 +2683,8 @@
-
-
+
+
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram
===================================================================
diff -u -r94a8ffbf9b1040b5a6092c8af0f38ce5dbe6e1fb -r8a15fe6e429a0f177f25defaf1851c9963374dbe
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision 94a8ffbf9b1040b5a6092c8af0f38ce5dbe6e1fb)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -6,44 +6,44 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/StrengthStabilityPointConstructionSectionResultEntity.cs
===================================================================
diff -u -r94a8ffbf9b1040b5a6092c8af0f38ce5dbe6e1fb -r8a15fe6e429a0f177f25defaf1851c9963374dbe
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/StrengthStabilityPointConstructionSectionResultEntity.cs (.../StrengthStabilityPointConstructionSectionResultEntity.cs) (revision 94a8ffbf9b1040b5a6092c8af0f38ce5dbe6e1fb)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/StrengthStabilityPointConstructionSectionResultEntity.cs (.../StrengthStabilityPointConstructionSectionResultEntity.cs) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -37,8 +37,8 @@
{
public long StrengthStabilityPointConstructionSectionResultEntityId { get; set; }
public long FailureMechanismSectionEntityId { get; set; }
- public Nullable LevelTwoA { get; set; }
- public Nullable LevelThree { get; set; }
+ public Nullable LayerTwoA { get; set; }
+ public Nullable LayerThree { get; set; }
public virtual FailureMechanismSectionEntity FailureMechanismSectionEntity { get; set; }
}
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs
===================================================================
diff -u -rc482712c0ff06d5654836fc8d9af535641d63ffb -r8a15fe6e429a0f177f25defaf1851c9963374dbe
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs (.../AssessmentSectionEntityReadExtensions.cs) (revision c482712c0ff06d5654836fc8d9af535641d63ffb)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs (.../AssessmentSectionEntityReadExtensions.cs) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -23,7 +23,6 @@
using System.Linq;
using Application.Ringtoets.Storage.DbContext;
using Ringtoets.Common.Data.AssessmentSection;
-using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.HydraRing.Data;
using Ringtoets.Integration.Data;
@@ -80,7 +79,7 @@
entity.ReadPipingStructureFailureMechanism(assessmentSection, collector);
entity.ReadDuneErosionFailureMechanism(assessmentSection, collector);
entity.ReadStabilityStoneCoverFailureMechanism(assessmentSection, collector);
- entity.ReadStandAloneFailureMechanisms(assessmentSection, collector);
+ entity.ReadStrengthStabilityPointConstructionFailureMechanism(assessmentSection, collector);
return assessmentSection;
}
@@ -264,17 +263,12 @@
}
}
- private static void ReadStandAloneFailureMechanisms(this AssessmentSectionEntity entity, AssessmentSection assessmentSection, ReadConversionCollector collector)
+ private static void ReadStrengthStabilityPointConstructionFailureMechanism(this AssessmentSectionEntity entity, AssessmentSection assessmentSection, ReadConversionCollector collector)
{
- entity.ReadStandAloneFailureMechanism(FailureMechanismType.StrengthAndStabilityPointConstruction, assessmentSection.StrengthStabilityPointConstruction, collector);
- }
-
- private static void ReadStandAloneFailureMechanism(this AssessmentSectionEntity entity, FailureMechanismType failureMechanismType, IFailureMechanism standAloneFailureMechanism, ReadConversionCollector collector)
- {
- var failureMechanismEntity = entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (int) failureMechanismType);
- if (failureMechanismEntity != null)
+ var strengthStabilityPointConstructionFailureMechanismEntity = entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (int)FailureMechanismType.StrengthAndStabilityPointConstruction);
+ if (strengthStabilityPointConstructionFailureMechanismEntity != null)
{
- failureMechanismEntity.ReadCommonFailureMechanismProperties(standAloneFailureMechanism, collector);
+ strengthStabilityPointConstructionFailureMechanismEntity.ReadAsStrengthStabilityPointConstructionFailureMechanism(assessmentSection.StrengthStabilityPointConstruction, collector);
}
}
}
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs
===================================================================
diff -u -rc482712c0ff06d5654836fc8d9af535641d63ffb -r8a15fe6e429a0f177f25defaf1851c9963374dbe
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision c482712c0ff06d5654836fc8d9af535641d63ffb)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -463,6 +463,29 @@
}
///
+ /// Read the and use the information to update a .
+ ///
+ /// The to create for.
+ ///
+ /// The object keeping track of read operations.
+ internal static void ReadAsStrengthStabilityPointConstructionFailureMechanism(this FailureMechanismEntity entity, StrengthStabilityPointConstructionFailureMechanism failureMechanism, ReadConversionCollector collector)
+ {
+ entity.ReadCommonFailureMechanismProperties(failureMechanism, collector);
+ entity.ReadStrengthStabilityPointConstructionMechanismSectionResults(failureMechanism, collector);
+ }
+
+ private static void ReadStrengthStabilityPointConstructionMechanismSectionResults(this FailureMechanismEntity entity, StrengthStabilityPointConstructionFailureMechanism failureMechanism, ReadConversionCollector collector)
+ {
+ foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.StrengthStabilityPointConstructionSectionResultEntities))
+ {
+ var failureMechanismSection = collector.Get(sectionResultEntity.FailureMechanismSectionEntity);
+ var result = failureMechanism.SectionResults.Single(sr => ReferenceEquals(sr.Section, failureMechanismSection));
+
+ sectionResultEntity.Read(result, collector);
+ }
+ }
+
+ ///
/// Read the and use the information to update a .
///
/// The to read into a .
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StrengthStabilityPointConstructionSectionResultEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StrengthStabilityPointConstructionSectionResultEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StrengthStabilityPointConstructionSectionResultEntityReadExtensions.cs (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -0,0 +1,60 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Application.Ringtoets.Storage.DbContext;
+using Core.Common.Base.Data;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Read
+{
+ ///
+ /// This class defines extension methods for read operations for a based on the
+ /// .
+ ///
+ internal static class StrengthStabilityPointConstructionSectionResultEntityReadExtensions
+ {
+ ///
+ /// 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 StrengthStabilityPointConstructionSectionResultEntity entity, StrengthStabilityPointConstructionFailureMechanismSectionResult sectionResult, ReadConversionCollector collector)
+ {
+ if (collector == null)
+ {
+ throw new ArgumentNullException("collector");
+ }
+ if (sectionResult == null)
+ {
+ throw new ArgumentNullException("sectionResult");
+ }
+
+ sectionResult.StorageId = entity.StrengthStabilityPointConstructionSectionResultEntityId;
+ sectionResult.AssessmentLayerTwoA = (RoundedDouble)entity.LayerTwoA.ToNanableDouble();
+ sectionResult.AssessmentLayerThree = (RoundedDouble)entity.LayerThree.ToNanableDouble();
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityPointConstructionFailureMechanismSectionResultUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityPointConstructionFailureMechanismSectionResultUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityPointConstructionFailureMechanismSectionResultUpdateExtensions.cs (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -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.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Update
+{
+ ///
+ /// 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 = Convert.ToDecimal(result.AssessmentLayerTwoA);
+ entity.LayerThree = Convert.ToDecimal(result.AssessmentLayerThree);
+
+ registry.Register(entity, result);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityPointConstructionFailureMechanismUpdateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityPointConstructionFailureMechanismUpdateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityPointConstructionFailureMechanismUpdateExtensions.cs (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -0,0 +1,87 @@
+// 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;
+
+namespace Application.Ringtoets.Storage.Update
+{
+ ///
+ /// 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
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj
===================================================================
diff -u -rc482712c0ff06d5654836fc8d9af535641d63ffb -r8a15fe6e429a0f177f25defaf1851c9963374dbe
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision c482712c0ff06d5654836fc8d9af535641d63ffb)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -84,6 +84,8 @@
+
+
@@ -139,6 +141,7 @@
+
@@ -184,6 +187,8 @@
+
+
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs
===================================================================
diff -u -rc482712c0ff06d5654836fc8d9af535641d63ffb -r8a15fe6e429a0f177f25defaf1851c9963374dbe
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs (.../PersistenceRegistryTest.cs) (revision c482712c0ff06d5654836fc8d9af535641d63ffb)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs (.../PersistenceRegistryTest.cs) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -1354,6 +1354,34 @@
}
[Test]
+ public void Register_WithNullStrengthStabilityPointConstructionFailureMechanismSectionResult_ThrowsArgumentNullException()
+ {
+ // Setup
+ var registry = new PersistenceRegistry();
+
+ // Call
+ TestDelegate test = () => registry.Register(new StrengthStabilityPointConstructionSectionResultEntity(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("model", paramName);
+ }
+
+ [Test]
+ public void Register_WithNullStrengthStabilityPointConstructionSectionResultEntity_ThrowsArgumentNullException()
+ {
+ // Setup
+ var registry = new PersistenceRegistry();
+
+ // Call
+ TestDelegate test = () => registry.Register(null, new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection()));
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("entity", paramName);
+ }
+
+ [Test]
public void Register_WithNullHydraulicLocationEntity_ThrowsArgumentNullException()
{
// Setup
@@ -2158,6 +2186,27 @@
}
[Test]
+ public void TransferIds_WithStrengthStabilityPointConstructionSectionResultEntityAddedWithStrengthStabilityPointConstructionFailureMechanismSectionResult_EqualStrengthStabilityPointConstructionSectionEntityIdAndStrengthStabilityPointConstructionFailureMechanismSectionResultStorageId()
+ {
+ // Setup
+ var registry = new PersistenceRegistry();
+
+ long storageId = new Random(21).Next(1,4000);
+ var entity = new StrengthStabilityPointConstructionSectionResultEntity
+ {
+ StrengthStabilityPointConstructionSectionResultEntityId = storageId
+ };
+ var model = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection());
+ registry.Register(entity, model);
+
+ // Call
+ registry.TransferIds();
+
+ // Assert
+ Assert.AreEqual(storageId, model.StorageId);
+ }
+
+ [Test]
public void TransferIds_WithHydraulicLocationEntityAdded_EqualHydraulicLocationEntityIdAndHydraulicBoundaryLocationStorageId()
{
// Setup
@@ -3159,6 +3208,42 @@
}
[Test]
+ public void RemoveUntouched_StrengthStabilityPointConstructionSectionResultEntity_OrphanedEntityIsRemovedFromRingtoetsEntities()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ IRingtoetsEntities dbContext = RingtoetsEntitiesHelper.CreateStub(mocks);
+ mocks.ReplayAll();
+
+ var orphanedEntity = new StrengthStabilityPointConstructionSectionResultEntity
+ {
+ StrengthStabilityPointConstructionSectionResultEntityId = 1
+ };
+ var persistentEntity = new StrengthStabilityPointConstructionSectionResultEntity
+ {
+ StrengthStabilityPointConstructionSectionResultEntityId = 2
+ };
+ dbContext.StrengthStabilityPointConstructionSectionResultEntities.Add(orphanedEntity);
+ dbContext.StrengthStabilityPointConstructionSectionResultEntities.Add(persistentEntity);
+
+ var section = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ StorageId = persistentEntity.StrengthStabilityPointConstructionSectionResultEntityId
+ };
+
+ var registry = new PersistenceRegistry();
+ registry.Register(persistentEntity, section);
+
+ // Call
+ registry.RemoveUntouched(dbContext);
+
+ // Assert
+ Assert.AreEqual(1, dbContext.StrengthStabilityPointConstructionSectionResultEntities.Count());
+ CollectionAssert.Contains(dbContext.StrengthStabilityPointConstructionSectionResultEntities, persistentEntity);
+ mocks.VerifyAll();
+ }
+
+ [Test]
public void RemoveUntouched_HydraulicLocationEntity_OrphanedEntityIsRemovedFromRingtoetsEntities()
{
// Setup
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityPointConstructionFailureMechanismCreateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityPointConstructionFailureMechanismCreateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityPointConstructionFailureMechanismCreateExtensionsTest.cs (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -0,0 +1,100 @@
+// 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.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Test.Create
+{
+ [TestFixture]
+ public class StrengthStabilityPointConstructionFailureMechanismCreateExtensionsTest
+ {
+ [Test]
+ public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new StrengthStabilityPointConstructionFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Create(null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant)
+ {
+ // Setup
+ var failureMechanism = new StrengthStabilityPointConstructionFailureMechanism
+ {
+ IsRelevant = isRelevant,
+ Comments = "Some text"
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ var entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual((short)FailureMechanismType.StrengthAndStabilityPointConstruction, entity.FailureMechanismType);
+ Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant);
+ Assert.AreEqual(failureMechanism.Comments, entity.Comments);
+ }
+
+ [Test]
+ public void Create_WithoutSections_EmptyFailureMechanismSectionEntities()
+ {
+ // Setup
+ var failureMechanism = new StrengthStabilityPointConstructionFailureMechanism();
+
+ // Call
+ var entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.IsEmpty(entity.FailureMechanismSectionEntities);
+ }
+
+ [Test]
+ public void Create_WithSections_FailureMechanismSectionEntitiesCreated()
+ {
+ // Setup
+ var failureMechanism = new StrengthStabilityPointConstructionFailureMechanism();
+ failureMechanism.AddSection(new TestFailureMechanismSection());
+
+ // Call
+ var entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.StrengthStabilityPointConstructionSectionResultEntities).Count());
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensionsTest.cs (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -0,0 +1,95 @@
+// 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.TestUtil;
+using Core.Common.Base.Data;
+using NUnit.Framework;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Create
+{
+ [TestFixture]
+ public class StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensionsTest
+ {
+ [Test]
+ public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Create(null);
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ [Test]
+ public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults(
+ [Values(true, false)] bool assessmentLayerOneResult,
+ [Values(0.2, 0.523)] double assessmentLayerTwoAResult,
+ [Values(3.2, 4.5)] double assessmentLayerThreeResult
+ )
+ {
+ // Setup
+ var sectionResult = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection());
+ sectionResult.AssessmentLayerTwoA = (RoundedDouble) assessmentLayerTwoAResult;
+ sectionResult.AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult;
+
+ // Call
+ var result = sectionResult.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.AreEqual(Convert.ToDecimal(assessmentLayerTwoAResult), result.LayerTwoA);
+ Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree);
+ }
+
+ [Test]
+ public void Create_WithNaNLevel2aResult_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var sectionResult = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection());
+ sectionResult.AssessmentLayerTwoA = (RoundedDouble)double.NaN;
+
+ // Call
+ var result = sectionResult.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.IsNull(result.LayerTwoA);
+ }
+
+ [Test]
+ public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var sectionResult = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection());
+ sectionResult.AssessmentLayerThree = (RoundedDouble) double.NaN;
+
+ // Call
+ var result = sectionResult.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.IsNull(result.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs
===================================================================
diff -u -rc482712c0ff06d5654836fc8d9af535641d63ffb -r8a15fe6e429a0f177f25defaf1851c9963374dbe
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision c482712c0ff06d5654836fc8d9af535641d63ffb)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -305,6 +305,9 @@
AssertFailureMechanismSectionResults(
expectedAssessmentSection.StabilityStoneCover.SectionResults,
actualAssessmentSection.StabilityStoneCover.SectionResults);
+ AssertFailureMechanismSectionResults(
+ expectedAssessmentSection.StrengthStabilityPointConstruction.SectionResults,
+ actualAssessmentSection.StrengthStabilityPointConstruction.SectionResults);
}
}
@@ -608,6 +611,23 @@
}
}
+ private void AssertFailureMechanismSectionResults(IEnumerable expectedSectionResults, IEnumerable actualSectionResults)
+ {
+ var expectedSectionResultsArray = expectedSectionResults.ToArray();
+ var actualSectionResultsArray = actualSectionResults.ToArray();
+
+ Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
+
+ for (var i = 0; i < expectedSectionResultsArray.Length; i++)
+ {
+ StrengthStabilityPointConstructionFailureMechanismSectionResult expectedSection = expectedSectionResultsArray[i];
+ StrengthStabilityPointConstructionFailureMechanismSectionResult actualSection = actualSectionResultsArray[i];
+
+ Assert.AreEqual(expectedSection.AssessmentLayerTwoA, actualSection.AssessmentLayerTwoA);
+ Assert.AreEqual(expectedSection.AssessmentLayerThree, actualSection.AssessmentLayerThree);
+ }
+ }
+
private void AssertFailureMechanism(IFailureMechanism expectedFailureMechanism, IFailureMechanism actualFailureMechanism)
{
Assert.AreEqual(expectedFailureMechanism.Name, actualFailureMechanism.Name);
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StrengthStabilityPointConstructionSectionResultEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StrengthStabilityPointConstructionSectionResultEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StrengthStabilityPointConstructionSectionResultEntityReadExtensionsTest.cs (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -0,0 +1,137 @@
+// 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.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Read
+{
+ [TestFixture]
+ public class StrengthStabilityPointConstructionSectionResultEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_CollectorIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var entity = new StrengthStabilityPointConstructionSectionResultEntity();
+
+ // Call
+ TestDelegate call = () => entity.Read(new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection()), null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("collector", paramName);
+ }
+
+ [Test]
+ public void Read_SectionResultIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var entity = new StrengthStabilityPointConstructionSectionResultEntity();
+
+ // Call
+ TestDelegate call = () => entity.Read(null, new ReadConversionCollector());
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("sectionResult", paramName);
+ }
+
+ [Test]
+ public void Read_WithDecimalParameterValues_ReturnStrengthStabilityPointConstructionSoilLayerWithDoubleParameterValues()
+ {
+ // Setup
+ var random = new Random(21);
+ var entityId = random.Next(1, 502);
+ double layerThree = random.NextDouble();
+ double layerTwoA = random.NextDouble();
+ var collector = new ReadConversionCollector();
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity();
+ collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection());
+ var entity = new StrengthStabilityPointConstructionSectionResultEntity
+ {
+ StrengthStabilityPointConstructionSectionResultEntityId = entityId,
+ LayerThree = Convert.ToDecimal(layerThree),
+ LayerTwoA = Convert.ToDecimal(layerTwoA),
+ FailureMechanismSectionEntity = failureMechanismSectionEntity
+ };
+ var sectionResult = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ entity.Read(sectionResult, collector);
+
+ // Assert
+ Assert.IsNotNull(sectionResult);
+ Assert.AreEqual(entityId, sectionResult.StorageId);
+ Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA, 1e-6);
+ Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6);
+ }
+
+ [Test]
+ public void Read_WithNullLayerTwoA_ReturnStrengthStabilityPointConstructionSoilLayerWithNullParameters()
+ {
+ // Setup
+ var collector = new ReadConversionCollector();
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity();
+ collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection());
+ var entity = new StrengthStabilityPointConstructionSectionResultEntity
+ {
+ LayerTwoA = null,
+ LayerThree = Convert.ToDecimal(new Random(21).NextDouble()),
+ FailureMechanismSectionEntity = failureMechanismSectionEntity
+ };
+ var sectionResult = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ entity.Read(sectionResult, collector);
+
+ // Assert
+ Assert.IsNaN(sectionResult.AssessmentLayerTwoA);
+ }
+
+ [Test]
+ public void Read_WithNullLayerThree_ReturnStrengthStabilityPointConstructionSoilLayerWithNullParameters()
+ {
+ // Setup
+ var collector = new ReadConversionCollector();
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity();
+ collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection());
+ var entity = new StrengthStabilityPointConstructionSectionResultEntity
+ {
+ LayerTwoA = Convert.ToDecimal(new Random(21).NextDouble()),
+ LayerThree = null,
+ FailureMechanismSectionEntity = failureMechanismSectionEntity
+ };
+ var sectionResult = new StrengthStabilityPointConstructionFailureMechanismSectionResult(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/Update/StrengthStabilityPointConstructionFailureMechanismSectionResultUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityPointConstructionFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityPointConstructionFailureMechanismSectionResultUpdateExtensionsTest.cs (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -0,0 +1,159 @@
+// 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;
+using Core.Common.Base.Data;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Update
+{
+ [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.Value.ToNullableDecimal(), sectionResultEntity.LayerTwoA);
+ Assert.AreEqual(sectionResult.AssessmentLayerThree.Value.ToNullableDecimal(), sectionResultEntity.LayerThree);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityPointConstructionFailureMechanismUpdateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityPointConstructionFailureMechanismUpdateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/StrengthStabilityPointConstructionFailureMechanismUpdateExtensionsTest.cs (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -0,0 +1,243 @@
+// 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;
+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
+{
+ [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
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsEntitiesHelper.cs
===================================================================
diff -u -rc482712c0ff06d5654836fc8d9af535641d63ffb -r8a15fe6e429a0f177f25defaf1851c9963374dbe
--- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsEntitiesHelper.cs (.../RingtoetsEntitiesHelper.cs) (revision c482712c0ff06d5654836fc8d9af535641d63ffb)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsEntitiesHelper.cs (.../RingtoetsEntitiesHelper.cs) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -58,6 +58,7 @@
DbSet pipingStructureSectionResultsSet = CreateEmptyTestDbSet();
DbSet duneErosionSectionResultsSet = CreateEmptyTestDbSet();
DbSet stabilityStoneCoverSectionResultsSet = CreateEmptyTestDbSet();
+ DbSet strengthStabilityPointConstructionSectionResultsSet = CreateEmptyTestDbSet();
DbSet assessmentSectionsSet = CreateEmptyTestDbSet();
DbSet referenceLinesSet = CreateEmptyTestDbSet();
DbSet calculationGroupsSet = CreateEmptyTestDbSet();
@@ -97,6 +98,7 @@
ringtoetsEntities.Stub(r => r.PipingStructureSectionResultEntities).Return(pipingStructureSectionResultsSet);
ringtoetsEntities.Stub(r => r.DuneErosionSectionResultEntities).Return(duneErosionSectionResultsSet);
ringtoetsEntities.Stub(r => r.StabilityStoneCoverSectionResultEntities).Return(stabilityStoneCoverSectionResultsSet);
+ ringtoetsEntities.Stub(r => r.StrengthStabilityPointConstructionSectionResultEntities).Return(strengthStabilityPointConstructionSectionResultsSet);
ringtoetsEntities.Stub(r => r.AssessmentSectionEntities).Return(assessmentSectionsSet);
ringtoetsEntities.Stub(r => r.ReferenceLinePointEntities).Return(referenceLinesSet);
ringtoetsEntities.Stub(r => r.CalculationGroupEntities).Return(calculationGroupsSet);
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectHelper.cs
===================================================================
diff -u -rc482712c0ff06d5654836fc8d9af535641d63ffb -r8a15fe6e429a0f177f25defaf1851c9963374dbe
--- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectHelper.cs (.../RingtoetsProjectHelper.cs) (revision c482712c0ff06d5654836fc8d9af535641d63ffb)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectHelper.cs (.../RingtoetsProjectHelper.cs) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -239,6 +239,7 @@
AddSections(assessmentSection.ClosingStructure);
SetSectionResults(assessmentSection.ClosingStructure.SectionResults);
AddSections(assessmentSection.StrengthStabilityPointConstruction);
+ SetSectionResults(assessmentSection.StrengthStabilityPointConstruction.SectionResults);
AddSections(assessmentSection.StrengthStabilityLengthwiseConstruction);
SetSectionResults(assessmentSection.StrengthStabilityLengthwiseConstruction.SectionResults);
AddSections(assessmentSection.PipingStructure);
@@ -444,6 +445,16 @@
}
}
+ private static void SetSectionResults(IEnumerable sectionResults)
+ {
+ var random = new Random(21);
+ foreach (var sectionResult in sectionResults)
+ {
+ sectionResult.AssessmentLayerTwoA = (RoundedDouble)random.NextDouble();
+ sectionResult.AssessmentLayerThree = (RoundedDouble)random.NextDouble();
+ }
+ }
+
private static void AddSections(IFailureMechanism failureMechanism)
{
failureMechanism.AddSection(new FailureMechanismSection("section 1", new[]
Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/StrengthStabilityPointConstructionFailureMechanismSectionResult.cs
===================================================================
diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -r8a15fe6e429a0f177f25defaf1851c9963374dbe
--- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/StrengthStabilityPointConstructionFailureMechanismSectionResult.cs (.../StrengthStabilityPointConstructionFailureMechanismSectionResult.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/StrengthStabilityPointConstructionFailureMechanismSectionResult.cs (.../StrengthStabilityPointConstructionFailureMechanismSectionResult.cs) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -21,6 +21,7 @@
using System;
using Core.Common.Base.Data;
+using Core.Common.Base.Storage;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Data.Properties;
@@ -30,7 +31,7 @@
/// This class holds information about the result of a calculation on section level for the
/// Strength and Stability of Point Constructions failure mechanism.
///
- public class StrengthStabilityPointConstructionFailureMechanismSectionResult : FailureMechanismSectionResult
+ public class StrengthStabilityPointConstructionFailureMechanismSectionResult : FailureMechanismSectionResult, IStorable
{
private RoundedDouble assessmentLayerTwoA;
@@ -70,5 +71,7 @@
/// Gets or sets the value of the tailored assessment of safety.
///
public RoundedDouble AssessmentLayerThree { get; set; }
+
+ public long StorageId { get; set; }
}
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/StrengthStabilityPointConstructionFailureMechanismSectionResultTest.cs
===================================================================
diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -r8a15fe6e429a0f177f25defaf1851c9963374dbe
--- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/StrengthStabilityPointConstructionFailureMechanismSectionResultTest.cs (.../StrengthStabilityPointConstructionFailureMechanismSectionResultTest.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/StrengthStabilityPointConstructionFailureMechanismSectionResultTest.cs (.../StrengthStabilityPointConstructionFailureMechanismSectionResultTest.cs) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe)
@@ -22,6 +22,7 @@
using System;
using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
+using Core.Common.Base.Storage;
using NUnit.Framework;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Integration.Data.StandAlone.SectionResults;
@@ -53,9 +54,11 @@
// Assert
Assert.IsInstanceOf(result);
+ Assert.IsInstanceOf(result);
Assert.AreSame(section, result.Section);
Assert.AreEqual(1, result.AssessmentLayerTwoA.Value);
Assert.AreEqual(0, result.AssessmentLayerThree.Value);
+ Assert.AreEqual(0, result.StorageId);
}
[Test]