Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Resources/DatabaseStructure17.1.sql
===================================================================
diff -u -rfe88135b797eda12b8e4d9b829036d2d7a52b10f -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Resources/DatabaseStructure17.1.sql (.../DatabaseStructure17.1.sql) (revision fe88135b797eda12b8e4d9b829036d2d7a52b10f)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Resources/DatabaseStructure17.1.sql (.../DatabaseStructure17.1.sql) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -1,6 +1,6 @@
/* ---------------------------------------------------- */
/* Generated by Enterprise Architect Version 12.0 */
-/* Created On : 10-Apr-2017 13:58:22 */
+/* Created On : 11-Apr-2017 10:44:39 */
/* DBMS : SQLite */
/* ---------------------------------------------------- */
@@ -464,6 +464,7 @@
'GrassCoverErosionInwardsFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
'FailureMechanismEntityId' INTEGER NOT NULL,
'N' INT (4) NOT NULL,
+ 'DikeProfileCollectionSourcePath' TEXT,
CONSTRAINT 'FK_GrassCoverErosionInwardsFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;
@@ -841,7 +842,8 @@
'Y' REAL,
'X0' REAL,
'Order' INT (4) NOT NULL,
- CONSTRAINT 'FK_DikeProfileEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
+ CONSTRAINT 'FK_DikeProfileEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade,
+ CONSTRAINT 'UQ_DikeProfileEntity_IdFailureMechanismEntityId' UNIQUE ('Id','FailureMechanismEntityId')
)
;
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Resources/Migration_5_17.1.sql
===================================================================
diff -u -rfe88135b797eda12b8e4d9b829036d2d7a52b10f -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Resources/Migration_5_17.1.sql (.../Migration_5_17.1.sql) (revision fe88135b797eda12b8e4d9b829036d2d7a52b10f)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Resources/Migration_5_17.1.sql (.../Migration_5_17.1.sql) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -33,8 +33,8 @@
SELECT
[DikeProfileEntityId],
[FailureMechanismEntityId],
- [Name],
- [Name],
+ CASE WHEN Suffix THEN [Name] || '(' || Suffix || ')' ELSE [Name] END as [Name],
+ CASE WHEN Suffix THEN [Name] || '(' || Suffix || ')' ELSE [Name] END as [Name],
[Orientation],
[BreakWaterType],
[BreakWaterHeight],
@@ -44,8 +44,13 @@
[X],
[Y],
[X0],
- [Order]
- FROM [SOURCEPROJECT].DikeProfileEntity;
+ [Order]
+ FROM (SELECT *, (SELECT count(*)
+ FROM [SOURCEPROJECT].DikeProfileEntity
+ WHERE DP.DikeProfileEntityId > DikeProfileEntityId
+ AND DP.Name IS Name
+ AND DP.FailuremechanismEntityId = FailuremechanismEntityId) as Suffix
+ FROM [SOURCEPROJECT].DikeProfileEntity DP);
INSERT INTO DuneErosionSectionResultEntity SELECT * FROM [SOURCEPROJECT].DuneErosionSectionResultEntity;
INSERT INTO FailureMechanismEntity SELECT * FROM [SOURCEPROJECT].FailureMechanismEntity;
INSERT INTO FailureMechanismSectionEntity SELECT * FROM [SOURCEPROJECT].FailureMechanismSectionEntity;
@@ -114,7 +119,17 @@
1
FROM [SOURCEPROJECT].GrassCoverErosionInwardsCalculationEntity;
INSERT INTO GrassCoverErosionInwardsDikeHeightOutputEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsDikeHeightOutputEntity;
-INSERT INTO GrassCoverErosionInwardsFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsFailureMechanismMetaEntity;
+INSERT INTO GrassCoverErosionInwardsFailureMechanismMetaEntity (
+ [GrassCoverErosionInwardsFailureMechanismMetaEntityId],
+ [FailureMechanismEntityId],
+ [N],
+ [DikeProfileCollectionSourcePath])
+SELECT
+ [GrassCoverErosionInwardsFailureMechanismMetaEntityId],
+ [FailureMechanismEntityId],
+ [N],
+ "Onbekend"
+ FROM [SOURCEPROJECT].GrassCoverErosionInwardsFailureMechanismMetaEntity;
INSERT INTO GrassCoverErosionInwardsOutputEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsOutputEntity;
INSERT INTO GrassCoverErosionInwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsSectionResultEntity;
INSERT INTO GrassCoverErosionOutwardsFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionOutwardsFailureMechanismMetaEntity;
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj
===================================================================
diff -u -reec680fe322aea5d1ecf8fdf1f14a273afdf6c53 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision eec680fe322aea5d1ecf8fdf1f14a273afdf6c53)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -346,7 +346,6 @@
-
Fisheye: Tag 56ac4eb28f5fcc5b20117474e9e4030399d6806a refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputCreateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensions.cs
===================================================================
diff -u -r0fbb881c5c82f540f01772234b3c1faadfab07f9 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensions.cs (.../GrassCoverErosionInwardsFailureMechanismCreateExtensions.cs) (revision 0fbb881c5c82f540f01772234b3c1faadfab07f9)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensions.cs (.../GrassCoverErosionInwardsFailureMechanismCreateExtensions.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -52,7 +52,12 @@
private static void AddEntitiesForGeneralInput(GrassCoverErosionInwardsFailureMechanism mechanism, FailureMechanismEntity entity)
{
- entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.Add(mechanism.GeneralInput.Create());
+ var metaEntity = new GrassCoverErosionInwardsFailureMechanismMetaEntity
+ {
+ N = mechanism.GeneralInput.N,
+ DikeProfileCollectionSourcePath = mechanism.DikeProfiles.SourcePath
+ };
+ entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.Add(metaEntity);
}
private static void AddEntitiesForDikeProfiles(GrassCoverErosionInwardsFailureMechanism mechanism, PersistenceRegistry registry, FailureMechanismEntity entity)
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionInwardsFailureMechanismMetaEntity.cs
===================================================================
diff -u -r5e44a4eb7c69ccaca763dce7cd7735e33a1f3c85 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionInwardsFailureMechanismMetaEntity.cs (.../GrassCoverErosionInwardsFailureMechanismMetaEntity.cs) (revision 5e44a4eb7c69ccaca763dce7cd7735e33a1f3c85)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionInwardsFailureMechanismMetaEntity.cs (.../GrassCoverErosionInwardsFailureMechanismMetaEntity.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -35,6 +35,7 @@
public long GrassCoverErosionInwardsFailureMechanismMetaEntityId { get; set; }
public long FailureMechanismEntityId { get; set; }
public int N { get; set; }
+ public string DikeProfileCollectionSourcePath { get; set; }
public virtual FailureMechanismEntity FailureMechanismEntity { get; set; }
}
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Designer.cs
===================================================================
diff -u -r5e44a4eb7c69ccaca763dce7cd7735e33a1f3c85 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Designer.cs (.../RingtoetsEntities.Designer.cs) (revision 5e44a4eb7c69ccaca763dce7cd7735e33a1f3c85)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Designer.cs (.../RingtoetsEntities.Designer.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -1,25 +1,4 @@
-// Copyright (C) Stichting Deltares 2016. All rights reserved.
-//
-// This file is part of Ringtoets.
-//
-// Ringtoets is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see .
-//
-// All names, logos, and references to "Deltares" are registered trademarks of
-// Stichting Deltares and remain full property of Stichting Deltares at all times.
-// All rights reserved.
-
-// T4 code generation is enabled for model 'D:\repos\WettelijkToetsInstrumentarium\Application\Ringtoets\src\Application.Ringtoets.Storage\DbContext\RingtoetsEntities.edmx'.
+// T4 code generation is enabled for model 'D:\Checkout\Application\Ringtoets\src\Application.Ringtoets.Storage\DbContext\RingtoetsEntities.edmx'.
// To enable legacy code generation, change the value of the 'Code Generation Strategy' designer
// property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model
// is open in the designer.
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx
===================================================================
diff -u -rfe88135b797eda12b8e4d9b829036d2d7a52b10f -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision fe88135b797eda12b8e4d9b829036d2d7a52b10f)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -4,7 +4,7 @@
-
+
@@ -324,6 +324,7 @@
+
@@ -3460,6 +3461,7 @@
+
@@ -5742,6 +5744,7 @@
+
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram
===================================================================
diff -u -rfe88135b797eda12b8e4d9b829036d2d7a52b10f -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision fe88135b797eda12b8e4d9b829036d2d7a52b10f)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -5,75 +5,75 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs
===================================================================
diff -u -r0fbb881c5c82f540f01772234b3c1faadfab07f9 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 0fbb881c5c82f540f01772234b3c1faadfab07f9)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -192,11 +192,17 @@
entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.Single().Read(input);
}
- private static void ReadDikeProfiles(this FailureMechanismEntity entity, ICollection dikeProfiles, ReadConversionCollector collector)
+ private static void ReadDikeProfiles(this FailureMechanismEntity entity, DikeProfileCollection dikeProfiles, ReadConversionCollector collector)
{
- foreach (DikeProfileEntity dikeProfileEntity in entity.DikeProfileEntities)
+ if (entity.DikeProfileEntities.Any())
{
- dikeProfiles.Add(dikeProfileEntity.Read(collector));
+ GrassCoverErosionInwardsFailureMechanismMetaEntity metaEntity =
+ entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.Single();
+ string sourcePath = metaEntity.DikeProfileCollectionSourcePath;
+
+ dikeProfiles.AddRange(entity.DikeProfileEntities
+ .OrderBy(dp => dp.Order)
+ .Select(dp => dp.Read(collector)), sourcePath);
}
}
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj
===================================================================
diff -u -reec680fe322aea5d1ecf8fdf1f14a273afdf6c53 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision eec680fe322aea5d1ecf8fdf1f14a273afdf6c53)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -142,7 +142,6 @@
-
Fisheye: Tag 56ac4eb28f5fcc5b20117474e9e4030399d6806a refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs
===================================================================
diff -u -r5e44a4eb7c69ccaca763dce7cd7735e33a1f3c85 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs (.../GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs) (revision 5e44a4eb7c69ccaca763dce7cd7735e33a1f3c85)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs (.../GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -78,7 +78,7 @@
var registry = new PersistenceRegistry();
// Call
- var entity = failureMechanism.Create(registry);
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
// Assert
Assert.IsNotNull(entity);
@@ -91,6 +91,7 @@
Assert.AreEqual(1, entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.Count);
GrassCoverErosionInwardsFailureMechanismMetaEntity generalInputEntity = entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.First();
Assert.AreEqual(failureMechanism.GeneralInput.N, generalInputEntity.N);
+ Assert.IsNull(generalInputEntity.DikeProfileCollectionSourcePath);
}
[Test]
@@ -139,7 +140,7 @@
var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
// Call
- var entity = failureMechanism.Create(new PersistenceRegistry());
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
// Assert
Assert.IsEmpty(entity.FailureMechanismSectionEntities);
@@ -153,7 +154,7 @@
failureMechanism.AddSection(new TestFailureMechanismSection());
// Call
- var entity = failureMechanism.Create(new PersistenceRegistry());
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
// Assert
Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count);
@@ -168,7 +169,7 @@
var registry = new PersistenceRegistry();
// Call
- var entity = failureMechanism.Create(registry);
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
// Assert
CollectionAssert.IsEmpty(entity.DikeProfileEntities);
@@ -178,16 +179,25 @@
public void Create_WithDikeProfiles_AddDikeProfileEntities()
{
// Setup
+ const string sourcePath = "some/path/to/my/dikeprofiles";
var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
- failureMechanism.DikeProfiles.Add(new TestDikeProfile());
- failureMechanism.DikeProfiles.Add(new TestDikeProfile());
+ failureMechanism.DikeProfiles.AddRange(new[]
+ {
+ new TestDikeProfile(string.Empty, "id1"),
+ new TestDikeProfile(string.Empty, "id2")
+ }, sourcePath);
+
var registry = new PersistenceRegistry();
// Call
- var entity = failureMechanism.Create(registry);
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
// Assert
Assert.AreEqual(2, entity.DikeProfileEntities.Count);
+
+ GrassCoverErosionInwardsFailureMechanismMetaEntity generalInputEntity =
+ entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.First();
+ Assert.AreEqual(sourcePath, generalInputEntity.DikeProfileCollectionSourcePath);
}
[Test]
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs
===================================================================
diff -u -r8cb270db5fbcb82f19d6f3a390f083e9e0516d8c -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 8cb270db5fbcb82f19d6f3a390f083e9e0516d8c)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -98,7 +98,7 @@
string firstRingtoetsFile = GetRandomRingtoetsFile();
string secondRingtoetsFile = GetRandomRingtoetsFile();
- StorageSqLite storage = new StorageSqLite();
+ var storage = new StorageSqLite();
storage.StageProject(fullProject);
storage.SaveProjectAs(firstRingtoetsFile);
@@ -120,11 +120,11 @@
string tempRingtoetsFile = GetRandomRingtoetsFile();
// When
- var entityBeforeSave = fullProject.Create(new PersistenceRegistry());
+ ProjectEntity entityBeforeSave = fullProject.Create(new PersistenceRegistry());
byte[] hash1 = FingerprintHelper.Get(entityBeforeSave);
- StorageSqLite storage = new StorageSqLite();
+ var storage = new StorageSqLite();
storage.StageProject(fullProject);
storage.SaveProjectAs(tempRingtoetsFile);
@@ -145,14 +145,14 @@
public void LoadProject_FullTestProjectSaved_ProjectAsEntitiesInNewStorage()
{
// Setup
- StorageSqLite storage = new StorageSqLite();
+ var storage = new StorageSqLite();
RingtoetsProject fullProject = RingtoetsProjectTestHelper.GetFullTestProject();
storage.StageProject(fullProject);
string tempRingtoetsFile = GetRandomRingtoetsFile();
storage.SaveProjectAs(tempRingtoetsFile);
// Call
- RingtoetsProject loadedProject = (RingtoetsProject) storage.LoadProject(tempRingtoetsFile);
+ var loadedProject = (RingtoetsProject) storage.LoadProject(tempRingtoetsFile);
// Assert
AssertProjectsAreEqual(fullProject, loadedProject);
@@ -195,7 +195,7 @@
{
// Given
string tempRingtoetsFile = GetRandomRingtoetsFile();
- var expectedProjectName = Path.GetFileNameWithoutExtension(tempRingtoetsFile);
+ string expectedProjectName = Path.GetFileNameWithoutExtension(tempRingtoetsFile);
var mocks = new MockRepository();
var projectMigrator = mocks.Stub();
@@ -205,7 +205,7 @@
var projectStore = new StorageSqLite();
RingtoetsProject fullProject = RingtoetsProjectTestHelper.GetFullTestProject();
- var expectedProjectDescription = fullProject.Description;
+ string expectedProjectDescription = fullProject.Description;
// Precondition
SqLiteDatabaseHelper.CreateValidRingtoetsDatabase(tempRingtoetsFile, fullProject);
@@ -353,8 +353,8 @@
IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -372,8 +372,8 @@
IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ TechnicalInnovationFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ TechnicalInnovationFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -391,8 +391,8 @@
IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ WaterPressureAsphaltCoverFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ WaterPressureAsphaltCoverFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -410,8 +410,8 @@
IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ MacrostabilityInwardsFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ MacrostabilityInwardsFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -430,8 +430,8 @@
IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ MacrostabilityOutwardsFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ MacrostabilityOutwardsFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -450,8 +450,8 @@
IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ GrassCoverSlipOffInwardsFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ GrassCoverSlipOffInwardsFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -470,8 +470,8 @@
IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ GrassCoverSlipOffOutwardsFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ GrassCoverSlipOffOutwardsFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -490,8 +490,8 @@
IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ MicrostabilityFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ MicrostabilityFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -510,8 +510,8 @@
IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ PipingStructureFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ PipingStructureFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -538,8 +538,8 @@
private static void AssertFailureMechanismSections(IEnumerable expectedSections,
IEnumerable actualSections)
{
- var expectedSectionsArray = expectedSections.ToArray();
- var actualSectionsArray = actualSections.ToArray();
+ FailureMechanismSection[] expectedSectionsArray = expectedSections.ToArray();
+ FailureMechanismSection[] actualSectionsArray = actualSections.ToArray();
Assert.AreEqual(expectedSectionsArray.Length, actualSectionsArray.Length);
@@ -569,7 +569,7 @@
Assert.AreEqual(expectedModels.SourcePath, actualModels.SourcePath);
Assert.AreEqual(expectedModels.Count, actualModels.Count);
- for (int i = 0; i < expectedModels.Count; i++)
+ for (var i = 0; i < expectedModels.Count; i++)
{
StochasticSoilModel expectedModel = expectedModels[i];
StochasticSoilModel actualModel = actualModels[i];
@@ -594,7 +594,7 @@
Assert.Less(0, actualStochasticSoilProfiles.Count);
Assert.AreEqual(expectedStochasticSoilProfiles.Count, actualStochasticSoilProfiles.Count);
- for (int i = 0; i < expectedStochasticSoilProfiles.Count; i++)
+ for (var i = 0; i < expectedStochasticSoilProfiles.Count; i++)
{
StochasticSoilProfile expectedProfile = expectedStochasticSoilProfiles[i];
StochasticSoilProfile actualProfile = actualStochasticSoilProfiles[i];
@@ -613,7 +613,7 @@
Assert.Less(0, actualLayerArray.Length);
Assert.AreEqual(expectedLayerArray.Length, actualLayerArray.Length);
- for (int i = 0; i < expectedLayerArray.Length; i++)
+ for (var i = 0; i < expectedLayerArray.Length; i++)
{
PipingSoilLayer expectedLayer = actualLayerArray[i];
PipingSoilLayer actualLayer = expectedLayerArray[i];
@@ -637,7 +637,7 @@
Assert.Greater(expectedSurfaceLines.Count, 0);
Assert.AreEqual(expectedSurfaceLines.Count, actualSurfaceLines.Count);
- for (int i = 0; i < expectedSurfaceLines.Count; i++)
+ for (var i = 0; i < expectedSurfaceLines.Count; i++)
{
RingtoetsPipingSurfaceLine expectedSurfaceLine = expectedSurfaceLines.ElementAt(i);
RingtoetsPipingSurfaceLine actualSurfaceLine = expectedSurfaceLines.ElementAt(i);
@@ -669,7 +669,7 @@
Assert.AreEqual(expectedRootCalculationGroup.IsNameEditable, actualRootCalculationGroup.IsNameEditable);
Assert.AreEqual(expectedRootCalculationGroup.Children.Count, actualRootCalculationGroup.Children.Count);
- for (int i = 0; i < expectedRootCalculationGroup.Children.Count; i++)
+ for (var i = 0; i < expectedRootCalculationGroup.Children.Count; i++)
{
ICalculationBase expectedChild = expectedRootCalculationGroup.Children[i];
ICalculationBase actualChild = actualRootCalculationGroup.Children[i];
@@ -791,10 +791,10 @@
Assert.AreEqual(expectedOutput.CalculationConvergence, actualOutput.CalculationConvergence);
}
- private static void AssertDikeProfiles(IList expectedDikeProfiles, IList actualDikeProfiles)
+ private static void AssertDikeProfiles(DikeProfileCollection expectedDikeProfiles, DikeProfileCollection actualDikeProfiles)
{
Assert.AreEqual(expectedDikeProfiles.Count, actualDikeProfiles.Count);
- for (int i = 0; i < expectedDikeProfiles.Count; i++)
+ for (var i = 0; i < expectedDikeProfiles.Count; i++)
{
AssertDikeProfile(expectedDikeProfiles[i], actualDikeProfiles[i]);
}
@@ -816,7 +816,7 @@
IList actualDikeProfiles)
{
Assert.AreEqual(expectedForeshoreProfiles.Count, actualDikeProfiles.Count);
- for (int i = 0; i < expectedForeshoreProfiles.Count; i++)
+ for (var i = 0; i < expectedForeshoreProfiles.Count; i++)
{
AssertForeshoreProfile(expectedForeshoreProfiles[i], actualDikeProfiles[i]);
}
@@ -849,7 +849,7 @@
RoughnessPoint[] actualRoughnessPoints)
{
Assert.AreEqual(expectedRoughnessPoints.Length, actualRoughnessPoints.Length);
- for (int i = 0; i < expectedRoughnessPoints.Length; i++)
+ for (var i = 0; i < expectedRoughnessPoints.Length; i++)
{
AssertRoughnessPoint(expectedRoughnessPoints[i], actualRoughnessPoints[i]);
}
@@ -919,8 +919,8 @@
private static void AssertFailureMechanismSectionResults(IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ StabilityPointStructuresFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ StabilityPointStructuresFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -946,7 +946,7 @@
ObservableList actualStabilityPointStructures)
{
Assert.AreEqual(expectedStabilityPointStructures.Count, actualStabilityPointStructures.Count);
- for (int i = 0; i < expectedStabilityPointStructures.Count; i++)
+ for (var i = 0; i < expectedStabilityPointStructures.Count; i++)
{
AssertStabilityPointStructure(expectedStabilityPointStructures[i], actualStabilityPointStructures[i]);
}
@@ -1065,8 +1065,8 @@
private static void AssertFailureMechanismSectionResults(IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ ClosingStructuresFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ ClosingStructuresFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -1085,7 +1085,7 @@
ObservableList actualClosingStructures)
{
Assert.AreEqual(expectedClosingStructures.Count, actualClosingStructures.Count);
- for (int i = 0; i < expectedClosingStructures.Count; i++)
+ for (var i = 0; i < expectedClosingStructures.Count; i++)
{
AssertClosingStructure(expectedClosingStructures[i], actualClosingStructures[i]);
}
@@ -1181,8 +1181,8 @@
IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ DuneErosionFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ DuneErosionFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -1258,8 +1258,8 @@
private static void AssertFailureMechanismSectionResults(IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ HeightStructuresFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ HeightStructuresFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -1285,7 +1285,7 @@
ObservableList actualHeightStructures)
{
Assert.AreEqual(expectedHeightStructures.Count, actualHeightStructures.Count);
- for (int i = 0; i < expectedHeightStructures.Count; i++)
+ for (var i = 0; i < expectedHeightStructures.Count; i++)
{
AssertHeightStructure(expectedHeightStructures[i], actualHeightStructures[i]);
}
@@ -1364,8 +1364,8 @@
IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ PipingFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ PipingFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -1488,8 +1488,8 @@
IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ GrassCoverErosionInwardsFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ GrassCoverErosionInwardsFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -1601,8 +1601,8 @@
private static void AssertFailureMechanismSectionResults(IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ GrassCoverErosionOutwardsFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ GrassCoverErosionOutwardsFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -1652,8 +1652,8 @@
private static void AssertFailureMechanismSectionResults(IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ StabilityStoneCoverFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ StabilityStoneCoverFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -1703,8 +1703,8 @@
private static void AssertFailureMechanismSectionResults(IEnumerable expectedSectionResults,
IEnumerable actualSectionResults)
{
- var expectedSectionResultsArray = expectedSectionResults.ToArray();
- var actualSectionResultsArray = actualSectionResults.ToArray();
+ WaveImpactAsphaltCoverFailureMechanismSectionResult[] expectedSectionResultsArray = expectedSectionResults.ToArray();
+ WaveImpactAsphaltCoverFailureMechanismSectionResult[] actualSectionResultsArray = actualSectionResults.ToArray();
Assert.AreEqual(expectedSectionResultsArray.Length, actualSectionResultsArray.Length);
@@ -1756,7 +1756,7 @@
List actualHydraulicBoundaryLocations)
{
Assert.AreEqual(expectedHydraulicBoundaryLocations.Count, actualHydraulicBoundaryLocations.Count);
- for (int i = 0; i < expectedHydraulicBoundaryLocations.Count; i++)
+ for (var i = 0; i < expectedHydraulicBoundaryLocations.Count; i++)
{
HydraulicBoundaryLocation expectedBoundaryLocation = expectedHydraulicBoundaryLocations[i];
HydraulicBoundaryLocation actualBoundaryLocation = actualHydraulicBoundaryLocations[i];
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs
===================================================================
diff -u -r36b8629b18443a58866edc869420795588eaf168 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs (.../FailureMechanismEntityReadExtensionsTest.cs) (revision 36b8629b18443a58866edc869420795588eaf168)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs (.../FailureMechanismEntityReadExtensionsTest.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -509,6 +509,7 @@
Assert.IsEmpty(failureMechanism.Sections);
Assert.AreEqual(3, failureMechanism.GeneralInput.N);
+ Assert.IsNull(failureMechanism.DikeProfiles.SourcePath);
}
[Test]
@@ -517,13 +518,15 @@
// Setup
string emptyDikeGeometryXml = new RoughnessPointXmlSerializer().ToXml(new RoughnessPoint[0]);
string emptyForeshoreBinaryXml = new Point2DXmlSerializer().ToXml(new Point2D[0]);
+ const string sourcePath = "some/path/to/my/dikeprofiles";
var entity = new FailureMechanismEntity
{
GrassCoverErosionInwardsFailureMechanismMetaEntities =
{
new GrassCoverErosionInwardsFailureMechanismMetaEntity
{
- N = 3
+ N = 3,
+ DikeProfileCollectionSourcePath = sourcePath
}
},
DikeProfileEntities =
@@ -551,6 +554,7 @@
// Assert
Assert.AreEqual(2, failureMechanism.DikeProfiles.Count);
+ Assert.AreEqual(sourcePath, failureMechanism.DikeProfiles.SourcePath);
}
[Test]
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs
===================================================================
diff -u -r8cb270db5fbcb82f19d6f3a390f083e9e0516d8c -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision 8cb270db5fbcb82f19d6f3a390f083e9e0516d8c)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -162,7 +162,7 @@
private static void SetSectionResults(IEnumerable sectionResults)
{
var random = new Random(21);
- foreach (var sectionResult in sectionResults)
+ foreach (StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble();
@@ -172,7 +172,7 @@
private static void SetSectionResults(IEnumerable sectionResults)
{
var random = new Random(21);
- foreach (var sectionResult in sectionResults)
+ foreach (TechnicalInnovationFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble();
@@ -182,7 +182,7 @@
private static void SetSectionResults(IEnumerable sectionResults)
{
var random = new Random(21);
- foreach (var sectionResult in sectionResults)
+ foreach (WaterPressureAsphaltCoverFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble();
@@ -192,7 +192,7 @@
private static void SetSectionResults(IEnumerable sectionResults)
{
var random = new Random(21);
- foreach (var sectionResult in sectionResults)
+ foreach (MacrostabilityOutwardsFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerTwoA = (RoundedDouble) random.NextDouble();
@@ -203,7 +203,7 @@
private static void SetSectionResults(IEnumerable sectionResults)
{
var random = new Random(21);
- foreach (var sectionResult in sectionResults)
+ foreach (MacrostabilityInwardsFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerTwoA = (RoundedDouble) random.NextDouble();
@@ -214,7 +214,7 @@
private static void SetSectionResults(IEnumerable sectionResults)
{
var random = new Random(21);
- foreach (var sectionResult in sectionResults)
+ foreach (GrassCoverSlipOffInwardsFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerTwoA = GetAssessmentLayerTwoAResult();
@@ -225,7 +225,7 @@
private static void SetSectionResults(IEnumerable sectionResults)
{
var random = new Random(21);
- foreach (var sectionResult in sectionResults)
+ foreach (GrassCoverSlipOffOutwardsFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerTwoA = GetAssessmentLayerTwoAResult();
@@ -236,7 +236,7 @@
private static void SetSectionResults(IEnumerable sectionResults)
{
var random = new Random(21);
- foreach (var sectionResult in sectionResults)
+ foreach (MicrostabilityFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerTwoA = GetAssessmentLayerTwoAResult();
@@ -247,7 +247,7 @@
private static void SetSectionResults(IEnumerable sectionResults)
{
var random = new Random(21);
- foreach (var sectionResult in sectionResults)
+ foreach (PipingStructureFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerTwoA = GetAssessmentLayerTwoAResult();
@@ -412,7 +412,7 @@
{
var random = new Random(21);
var firstSectionResultHasCalculation = false;
- foreach (var sectionResult in sectionResults)
+ foreach (StabilityPointStructuresFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble();
@@ -490,7 +490,7 @@
{
var random = new Random(21);
var firstSectionResultHasCalculation = false;
- foreach (var sectionResult in sectionResults)
+ foreach (ClosingStructuresFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble();
@@ -515,7 +515,7 @@
private static void SetSectionResults(IEnumerable sectionResults)
{
var random = new Random(21);
- foreach (var sectionResult in sectionResults)
+ foreach (DuneErosionFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerTwoA = GetAssessmentLayerTwoAResult();
@@ -571,7 +571,7 @@
{
failureMechanism.GeneralInput.N = 5;
- var hydraulicBoundaryLocations = assessmentSection.HydraulicBoundaryDatabase.Locations;
+ List hydraulicBoundaryLocations = assessmentSection.HydraulicBoundaryDatabase.Locations;
var heightStructure = new TestHeightStructure();
failureMechanism.HeightStructures.Add(heightStructure);
@@ -615,7 +615,7 @@
{
var random = new Random(21);
var firstSectionResultHasCalculation = false;
- foreach (var sectionResult in sectionResults)
+ foreach (HeightStructuresFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble();
@@ -635,7 +635,7 @@
{
pipingFailureMechanism.PipingProbabilityAssessmentInput.A = 0.9;
- var referenceLineGeometryPoints = assessmentSection.ReferenceLine.Points.ToArray();
+ Point2D[] referenceLineGeometryPoints = assessmentSection.ReferenceLine.Points.ToArray();
PipingSoilProfile pipingSoilProfile = new TestPipingSoilProfile();
PipingSoilLayer pipingSoilLayer = pipingSoilProfile.Layers.First();
@@ -794,7 +794,7 @@
private static void SetSectionResults(IEnumerable sectionResults)
{
var random = new Random(21);
- foreach (var sectionResult in sectionResults)
+ foreach (PipingFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble();
@@ -842,43 +842,48 @@
IAssessmentSection assessmentSection)
{
failureMechanism.GeneralInput.N = 15;
- var dikeProfile = new DikeProfile(new Point2D(1, 2),
- new[]
- {
- new RoughnessPoint(new Point2D(1, 2), 1),
- new RoughnessPoint(new Point2D(3, 4), 0.5)
- },
- new[]
- {
- new Point2D(5, 6),
- new Point2D(7, 8)
- },
- new BreakWater(BreakWaterType.Caisson, 15),
- new DikeProfile.ConstructionProperties
- {
- Id = "id",
- DikeHeight = 1.1,
- Name = "2.2",
- Orientation = 3.3,
- X0 = 4.4
- });
- failureMechanism.DikeProfiles.Add(dikeProfile);
- failureMechanism.DikeProfiles.Add(new DikeProfile(new Point2D(9, 10),
- new[]
- {
- new RoughnessPoint(new Point2D(11, 12), 1),
- new RoughnessPoint(new Point2D(13, 14), 0.5)
- },
- new Point2D[0],
- null,
- new DikeProfile.ConstructionProperties
- {
- Id = "id",
- DikeHeight = 5.5,
- Name = "6.6",
- Orientation = 7.7,
- X0 = 8.8
- }));
+ var dikeProfile1 = new DikeProfile(new Point2D(1, 2),
+ new[]
+ {
+ new RoughnessPoint(new Point2D(1, 2), 1),
+ new RoughnessPoint(new Point2D(3, 4), 0.5)
+ },
+ new[]
+ {
+ new Point2D(5, 6),
+ new Point2D(7, 8)
+ },
+ new BreakWater(BreakWaterType.Caisson, 15),
+ new DikeProfile.ConstructionProperties
+ {
+ Id = "id",
+ DikeHeight = 1.1,
+ Name = "2.2",
+ Orientation = 3.3,
+ X0 = 4.4
+ });
+ var dikeProfile2 = new DikeProfile(new Point2D(9, 10),
+ new[]
+ {
+ new RoughnessPoint(new Point2D(11, 12), 1),
+ new RoughnessPoint(new Point2D(13, 14), 0.5)
+ },
+ new Point2D[0],
+ null,
+ new DikeProfile.ConstructionProperties
+ {
+ Id = "id2",
+ DikeHeight = 5.5,
+ Name = "6.6",
+ Orientation = 7.7,
+ X0 = 8.8
+ });
+ failureMechanism.DikeProfiles.AddRange(new[]
+ {
+ dikeProfile1,
+ dikeProfile2
+ }, "some/path/to/dikeprofiles");
+
failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup
{
Name = "GEKB A",
@@ -893,15 +898,15 @@
},
InputParameters =
{
- DikeProfile = dikeProfile,
+ DikeProfile = dikeProfile1,
HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations[0],
BreakWater =
{
- Height = (RoundedDouble) (dikeProfile.BreakWater.Height + 0.3),
+ Height = (RoundedDouble) (dikeProfile1.BreakWater.Height + 0.3),
Type = BreakWaterType.Wall
},
- DikeHeight = (RoundedDouble) (dikeProfile.DikeHeight + 0.2),
- Orientation = dikeProfile.Orientation,
+ DikeHeight = (RoundedDouble) (dikeProfile1.DikeHeight + 0.2),
+ Orientation = dikeProfile1.Orientation,
CriticalFlowRate =
{
Mean = (RoundedDouble) 1.1,
@@ -937,7 +942,7 @@
{
var random = new Random(21);
var firstSectionResultHasCalculation = false;
- foreach (var sectionResult in sectionResults)
+ foreach (GrassCoverErosionInwardsFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble();
@@ -957,7 +962,7 @@
{
failureMechanism.GeneralInput.N = 15;
- var hydraulicBoundaryLocations = failureMechanism.HydraulicBoundaryLocations;
+ ObservableList hydraulicBoundaryLocations = failureMechanism.HydraulicBoundaryLocations;
hydraulicBoundaryLocations.Add(new HydraulicBoundaryLocation(0, "HL 1", 100, 200));
hydraulicBoundaryLocations.Add(new HydraulicBoundaryLocation(45, "HL 2", 123, 150));
@@ -1036,7 +1041,7 @@
private static void SetSectionResults(IEnumerable sectionResults)
{
var random = new Random(21);
- foreach (var sectionResult in sectionResults)
+ foreach (GrassCoverErosionOutwardsFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerTwoA = GetAssessmentLayerTwoAResult();
@@ -1129,7 +1134,7 @@
private static void SetSectionResults(IEnumerable sectionResults)
{
var random = new Random(21);
- foreach (var sectionResult in sectionResults)
+ foreach (StabilityStoneCoverFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerTwoA = GetAssessmentLayerTwoAResult();
@@ -1218,7 +1223,7 @@
private static void SetSectionResults(IEnumerable sectionResults)
{
var random = new Random(21);
- foreach (var sectionResult in sectionResults)
+ foreach (WaveImpactAsphaltCoverFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerTwoA = GetAssessmentLayerTwoAResult();
Index: Core/Common/src/Core.Common.Base/IO/FileImporterBase.cs
===================================================================
diff -u -r110999cffbcac705d99ff96033e9eabb0e0b5e12 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Core/Common/src/Core.Common.Base/IO/FileImporterBase.cs (.../FileImporterBase.cs) (revision 110999cffbcac705d99ff96033e9eabb0e0b5e12)
+++ Core/Common/src/Core.Common.Base/IO/FileImporterBase.cs (.../FileImporterBase.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -58,12 +58,6 @@
ImportTarget = importTarget;
}
- protected virtual void DoPostImportUpdates()
- {
- var observableTarget = ImportTarget as IObservable;
- observableTarget?.NotifyObservers();
- }
-
public void SetProgressChanged(OnProgressChanged action)
{
ProgressChanged = action;
@@ -125,15 +119,22 @@
///
protected bool Canceled { get; private set; }
+ protected virtual void DoPostImportUpdates()
+ {
+ var observableTarget = ImportTarget as IObservable;
+ observableTarget?.NotifyObservers();
+ }
+
///
- /// This method logs messages when the importer is canceled in a cancelable state.
+ /// This method logs messages when the importer is canceled in a cancellable state.
///
protected abstract void LogImportCanceledMessage();
///
/// This method returns the result of the import action.
///
/// True if the import was successful, false if otherwise.
+ /// Implementations of this method are allowed to throw exceptions of any kind.
protected abstract bool OnImport();
protected void NotifyProgress(string currentStepName, int currentStep, int totalNumberOfSteps)
Index: Core/Common/src/Core.Common.Base/ObservableUniqueItemCollectionWithSourcePath.cs
===================================================================
diff -u -r1b9445050ddc7786014349d7014c7c4d85242a5d -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Core/Common/src/Core.Common.Base/ObservableUniqueItemCollectionWithSourcePath.cs (.../ObservableUniqueItemCollectionWithSourcePath.cs) (revision 1b9445050ddc7786014349d7014c7c4d85242a5d)
+++ Core/Common/src/Core.Common.Base/ObservableUniqueItemCollectionWithSourcePath.cs (.../ObservableUniqueItemCollectionWithSourcePath.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -23,6 +23,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
+using Core.Common.Base.Properties;
using Core.Common.Utils;
namespace Core.Common.Base
@@ -186,13 +187,17 @@
private void ValidateItems(IEnumerable items)
{
IEnumerable> duplicateItems =
- items.GroupBy(getUniqueFeature)
+ items.Concat(collection).GroupBy(getUniqueFeature)
.Where(group => group.Count() > 1);
if (duplicateItems.Any())
{
- var duplicateFeatures = string.Join(", ", duplicateItems.Select(group => group.First()));
- string exceptionMessage = $"{typeDescriptor} moeten een unieke {featureDescription} hebben. Gevonden dubbele elementen: {duplicateFeatures}.";
+ string duplicateFeatures = string.Join(", ", duplicateItems.Select(group => getUniqueFeature(group.First())));
+ string exceptionMessage = string.Format(
+ Resources.ObservableUniqueItemCollectionWithSourcePath_ValidateItems_TypeDescriptor_0_must_have_unique_FeatureDescription_1_Found_duplicate_items_DuplicateFeatures_2,
+ typeDescriptor,
+ featureDescription,
+ duplicateFeatures);
throw new ArgumentException(exceptionMessage);
}
}
Index: Core/Common/src/Core.Common.Base/Properties/Resources.Designer.cs
===================================================================
diff -u -r8eb717ca45b6518cccfef85e481e0da52ce1df4e -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Core/Common/src/Core.Common.Base/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8eb717ca45b6518cccfef85e481e0da52ce1df4e)
+++ Core/Common/src/Core.Common.Base/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -218,6 +218,16 @@
}
///
+ /// Looks up a localized string similar to {0} moeten een unieke {1} hebben. Gevonden dubbele elementen: {2}..
+ ///
+ public static string ObservableUniqueItemCollectionWithSourcePath_ValidateItems_TypeDescriptor_0_must_have_unique_FeatureDescription_1_Found_duplicate_items_DuplicateFeatures_2 {
+ get {
+ return ResourceManager.GetString("ObservableUniqueItemCollectionWithSourcePath_ValidateItems_TypeDescriptor_0_must_" +
+ "have_unique_FeatureDescription_1_Found_duplicate_items_DuplicateFeatures_2", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Vector moet 2 dimensies hebben, maar heeft er {0}..
///
public static string Point2D_AddVector_Vector_must_be_2D_but_has_Dimensionality_0_ {
Index: Core/Common/src/Core.Common.Base/Properties/Resources.resx
===================================================================
diff -u -r8eb717ca45b6518cccfef85e481e0da52ce1df4e -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Core/Common/src/Core.Common.Base/Properties/Resources.resx (.../Resources.resx) (revision 8eb717ca45b6518cccfef85e481e0da52ce1df4e)
+++ Core/Common/src/Core.Common.Base/Properties/Resources.resx (.../Resources.resx) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -186,4 +186,7 @@
{0} (*.{1})|*.{2}
+
+ {0} moeten een unieke {1} hebben. Gevonden dubbele elementen: {2}.
+
\ No newline at end of file
Index: Core/Common/test/Core.Common.Base.Test/ObservableUniqueItemCollectionWithSourcePathTest.cs
===================================================================
diff -u -r1b9445050ddc7786014349d7014c7c4d85242a5d -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Core/Common/test/Core.Common.Base.Test/ObservableUniqueItemCollectionWithSourcePathTest.cs (.../ObservableUniqueItemCollectionWithSourcePathTest.cs) (revision 1b9445050ddc7786014349d7014c7c4d85242a5d)
+++ Core/Common/test/Core.Common.Base.Test/ObservableUniqueItemCollectionWithSourcePathTest.cs (.../ObservableUniqueItemCollectionWithSourcePathTest.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -30,9 +30,9 @@
[TestFixture]
public class ObservableUniqueItemCollectionWithSourcePathTest
{
- private readonly Func getUniqueFeature = item => item.Name;
private const string typeDescriptor = "TestItems";
private const string featureDescription = "Feature";
+ private readonly Func getUniqueFeature = item => item.Name;
[Test]
public void DefaultConstructor_getUniqueFeatureNull_ThrowsArgumentNullException()
@@ -116,7 +116,7 @@
TestDelegate call = () => collection.AddRange(items, "path");
// Assert
- string message = "Collection cannot contain null.";
+ var message = "Collection cannot contain null.";
string paramName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message).ParamName;
Assert.AreEqual("items", paramName);
}
@@ -248,6 +248,39 @@
}
[Test]
+ public void GivenCollectionWithItems_WhenAddRangeWithItemsAlreadyInCollection_ThenThrowsArgumentException()
+ {
+ // Given
+ const string filePath = "some/file/path";
+ var collection = new ConcreteObservableUniqueItemCollectionWithSourcePath(
+ getUniqueFeature, typeDescriptor, featureDescription);
+
+ const string duplicateNameOne = "Item A";
+ const string duplicateNameTwo = "Item B";
+ var expectedCollection = new[]
+ {
+ new TestItem(duplicateNameOne),
+ new TestItem(duplicateNameTwo),
+ new TestItem("Item C"),
+ new TestItem("Item D")
+ };
+ collection.AddRange(expectedCollection, filePath);
+
+ // When
+ TestDelegate call = () => collection.AddRange(new[]
+ {
+ new TestItem(duplicateNameOne),
+ new TestItem(duplicateNameTwo)
+ }, "other/path");
+
+ // Then
+ string message = $"TestItems moeten een unieke Feature hebben. Gevonden dubbele elementen: {duplicateNameOne}, {duplicateNameTwo}.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message);
+ CollectionAssert.AreEqual(expectedCollection, collection);
+ Assert.AreEqual(filePath, collection.SourcePath);
+ }
+
+ [Test]
public void Count_CollectionFilledWithElements_ReturnsExpectedNumberOfElements()
{
// Setup
@@ -493,23 +526,18 @@
private class ConcreteObservableUniqueItemCollectionWithSourcePath : ObservableUniqueItemCollectionWithSourcePath
where TObject : class
{
- public ConcreteObservableUniqueItemCollectionWithSourcePath(Func getUniqueFeature, string typeDescriptor, string featureDescription)
+ public ConcreteObservableUniqueItemCollectionWithSourcePath(Func getUniqueFeature, string typeDescriptor, string featureDescription)
: base(getUniqueFeature, typeDescriptor, featureDescription) {}
}
private class TestItem
{
- public string Name { get; }
-
public TestItem(string name)
{
Name = name;
}
- public override string ToString()
- {
- return Name;
- }
+ public string Name { get; }
}
}
}
\ No newline at end of file
Index: Ringtoets.sln
===================================================================
diff -u -rc63ac515f0ce88fbc058e1838d1a43ed6a912360 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets.sln (.../Ringtoets.sln) (revision c63ac515f0ce88fbc058e1838d1a43ed6a912360)
+++ Ringtoets.sln (.../Ringtoets.sln) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -1477,6 +1477,8 @@
{C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC}
EndProjectSection
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ringtoets.Common.IO.TestUtil.Test", "Ringtoets\Common\test\Ringtoets.Common.IO.TestUtil.Test\Ringtoets.Common.IO.TestUtil.Test.csproj", "{516E7E2A-83F6-43EB-895A-A1F4F90FA531}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
CreateInstaller|x86 = CreateInstaller|x86
@@ -3186,6 +3188,7 @@
{1F4D7974-2E42-4EA4-BDF7-C7BAFF2FE57C}.ReleaseForCodeCoverage|x86.Build.0 = ReleaseForCodeCoverage|x86
{CD7F7458-A273-4855-9744-4CCAFE0499D0}.CreateInstaller|x86.ActiveCfg = Release|x86
{CD7F7458-A273-4855-9744-4CCAFE0499D0}.CreateInstallerWithDemoProject|x86.ActiveCfg = Release|x86
+ {CD7F7458-A273-4855-9744-4CCAFE0499D0}.CreateInstallerWithDemoProject|x86.Deploy.0 = Release|x86
{CD7F7458-A273-4855-9744-4CCAFE0499D0}.Debug|x86.ActiveCfg = Debug|x86
{CD7F7458-A273-4855-9744-4CCAFE0499D0}.Debug|x86.Build.0 = Debug|x86
{CD7F7458-A273-4855-9744-4CCAFE0499D0}.Release|x86.ActiveCfg = Release|x86
@@ -3720,6 +3723,14 @@
{33508D7C-1602-4C0D-8503-73AAE98C19E5}.Release|x86.Build.0 = Release|x86
{33508D7C-1602-4C0D-8503-73AAE98C19E5}.ReleaseForCodeCoverage|x86.ActiveCfg = ReleaseForCodeCoverage|x86
{33508D7C-1602-4C0D-8503-73AAE98C19E5}.ReleaseForCodeCoverage|x86.Build.0 = ReleaseForCodeCoverage|x86
+ {516E7E2A-83F6-43EB-895A-A1F4F90FA531}.CreateInstaller|x86.ActiveCfg = Release|x86
+ {516E7E2A-83F6-43EB-895A-A1F4F90FA531}.CreateInstallerWithDemoProject|x86.ActiveCfg = Release|x86
+ {516E7E2A-83F6-43EB-895A-A1F4F90FA531}.Debug|x86.ActiveCfg = Debug|x86
+ {516E7E2A-83F6-43EB-895A-A1F4F90FA531}.Debug|x86.Build.0 = Debug|x86
+ {516E7E2A-83F6-43EB-895A-A1F4F90FA531}.Release|x86.ActiveCfg = Release|x86
+ {516E7E2A-83F6-43EB-895A-A1F4F90FA531}.Release|x86.Build.0 = Release|x86
+ {516E7E2A-83F6-43EB-895A-A1F4F90FA531}.ReleaseForCodeCoverage|x86.ActiveCfg = ReleaseForCodeCoverage|x86
+ {516E7E2A-83F6-43EB-895A-A1F4F90FA531}.ReleaseForCodeCoverage|x86.Build.0 = ReleaseForCodeCoverage|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -4043,6 +4054,7 @@
{AA3AB46F-1664-40C4-A620-A12513184BD4} = {79419C3E-046C-4DC1-8C69-F14911F22C75}
{3DEC1E30-0804-4BC9-8D04-4D7B4854E21B} = {1C1E8754-CF61-4858-9CEE-3E5DE344474F}
{33508D7C-1602-4C0D-8503-73AAE98C19E5} = {B5F4F5A5-FD36-405D-ABA1-56C270207C8F}
+ {516E7E2A-83F6-43EB-895A-A1F4F90FA531} = {B5F4F5A5-FD36-405D-ABA1-56C270207C8F}
EndGlobalSection
GlobalSection(TextTemplating) = postSolution
TextTemplating = 1
Index: Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/BreakWater.cs
===================================================================
diff -u -r30b8231f92b90ea4b05e98e3d0285368f6dfe2e4 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/BreakWater.cs (.../BreakWater.cs) (revision 30b8231f92b90ea4b05e98e3d0285368f6dfe2e4)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/BreakWater.cs (.../BreakWater.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -60,5 +60,36 @@
height = value.ToPrecision(height.NumberOfDecimalPlaces);
}
}
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj))
+ {
+ return false;
+ }
+ if (ReferenceEquals(this, obj))
+ {
+ return true;
+ }
+ if (obj.GetType() != GetType())
+ {
+ return false;
+ }
+ return Equals((BreakWater) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ int hashCode = height.GetHashCode();
+ return (hashCode * 397) ^ (int) Type;
+ }
+ }
+
+ private bool Equals(BreakWater other)
+ {
+ return height.Equals(other.height) && Type == other.Type;
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/DikeProfile.cs
===================================================================
diff -u -rba715436cd0186ee10a1edc13d547ee27bea4c89 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/DikeProfile.cs (.../DikeProfile.cs) (revision ba715436cd0186ee10a1edc13d547ee27bea4c89)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/DikeProfile.cs (.../DikeProfile.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -22,6 +22,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Core.Common.Base;
using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
using Ringtoets.Common.Data.Properties;
@@ -31,7 +32,7 @@
///
/// Definition for a dike profile for a failure mechanism.
///
- public class DikeProfile
+ public class DikeProfile : Observable
{
///
/// Creates a new instance of the class.
@@ -44,8 +45,13 @@
/// Thrown when either ,
/// , or
/// is null.
- /// Thrown when any element of
- /// or is null.
+ /// Thrown when:
+ ///
+ /// - any element of
+ /// or is null.
+ /// - is null, is empty
+ /// or whitespaces.
+ ///
public DikeProfile(Point2D worldCoordinate, IEnumerable dikeGeometry, IEnumerable foreshoreGeometry,
BreakWater breakWater, ConstructionProperties properties)
{
@@ -70,7 +76,7 @@
///
/// Gets the foreshore profile.
///
- public ForeshoreProfile ForeshoreProfile { get; }
+ public ForeshoreProfile ForeshoreProfile { get; private set; }
///
/// Gets the ID of the dike profile.
@@ -177,19 +183,93 @@
///
public RoundedDouble DikeHeight { get; private set; }
+ ///
+ /// Copies all the properties of the to
+ /// the current instance.
+ ///
+ /// The dike profile to copy the properties
+ /// from.
+ /// Thrown when
+ /// is null.
+ public void CopyProperties(DikeProfile fromDikeProfile)
+ {
+ if (fromDikeProfile == null)
+ {
+ throw new ArgumentNullException(nameof(fromDikeProfile));
+ }
+
+ SetGeometry(fromDikeProfile.DikeGeometry);
+ DikeHeight = fromDikeProfile.DikeHeight;
+ CopyForeshoreProfileProperties(fromDikeProfile);
+ }
+
public override string ToString()
{
return Name;
}
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj))
+ {
+ return false;
+ }
+ if (ReferenceEquals(this, obj))
+ {
+ return true;
+ }
+ if (obj.GetType() != GetType())
+ {
+ return false;
+ }
+ return Equals((DikeProfile) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ int hashCode = ForeshoreProfile.GetHashCode();
+ hashCode = (hashCode * 397) ^ DikeHeight.GetHashCode();
+
+ foreach (RoughnessPoint point in DikeGeometry)
+ {
+ hashCode = (hashCode * 397) ^ point.GetHashCode();
+ }
+
+ return hashCode;
+ }
+ }
+
+ private void CopyForeshoreProfileProperties(DikeProfile fromDikeProfile)
+ {
+ ForeshoreProfile = new ForeshoreProfile(fromDikeProfile.WorldReferencePoint,
+ fromDikeProfile.ForeshoreGeometry,
+ fromDikeProfile.BreakWater,
+ new ForeshoreProfile.ConstructionProperties
+ {
+ Id = fromDikeProfile.Id,
+ Name = fromDikeProfile.Name,
+ Orientation = fromDikeProfile.Orientation,
+ X0 = fromDikeProfile.X0
+ });
+ }
+
+ private bool Equals(DikeProfile other)
+ {
+ return Equals(ForeshoreProfile, other.ForeshoreProfile)
+ && DikeHeight.Equals(other.DikeHeight)
+ && EqualDikeGeometry(other.DikeGeometry);
+ }
+
private void SetGeometry(IEnumerable points)
{
if (points == null)
{
throw new ArgumentNullException(nameof(points), Resources.DikeProfile_SetGeometry_Collection_of_points_for_geometry_is_null);
}
- var roughnessPoints = points.ToArray();
+ RoughnessPoint[] roughnessPoints = points.ToArray();
if (roughnessPoints.Any(p => p == null))
{
throw new ArgumentException(Resources.DikeProfile_SetGeometry_A_point_in_the_collection_is_null);
@@ -198,6 +278,25 @@
DikeGeometry = roughnessPoints;
}
+ private bool EqualDikeGeometry(RoughnessPoint[] otherPoints)
+ {
+ int nrOfPoints = DikeGeometry.Length;
+ if (otherPoints.Length != nrOfPoints)
+ {
+ return false;
+ }
+
+ for (var i = 0; i < nrOfPoints; i++)
+ {
+ if (!DikeGeometry[i].Equals(otherPoints[i]))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
///
/// Class holding the various construction parameters for .
///
Index: Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/DikeProfileCollection.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/DikeProfileCollection.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/DikeProfileCollection.cs (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -0,0 +1,40 @@
+// 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 Core.Common.Base;
+using Ringtoets.Common.Data.Properties;
+
+namespace Ringtoets.Common.Data.DikeProfiles
+{
+ ///
+ /// A collection of . The ids of the
+ /// are unique within the collection.
+ ///
+ public class DikeProfileCollection : ObservableUniqueItemCollectionWithSourcePath
+ {
+ ///
+ /// Instantiates a .
+ ///
+ public DikeProfileCollection() : base(profile => profile.Id,
+ Resources.DikeProfileCollection_TypeDescriptor,
+ Resources.DikeProfileCollection_UniqueFeature_id_FeatureDescription) {}
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/ForeshoreProfile.cs
===================================================================
diff -u -r5e44a4eb7c69ccaca763dce7cd7735e33a1f3c85 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/ForeshoreProfile.cs (.../ForeshoreProfile.cs) (revision 5e44a4eb7c69ccaca763dce7cd7735e33a1f3c85)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/ForeshoreProfile.cs (.../ForeshoreProfile.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -131,9 +131,56 @@
return Name;
}
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj))
+ {
+ return false;
+ }
+ if (ReferenceEquals(this, obj))
+ {
+ return true;
+ }
+ if (obj.GetType() != GetType())
+ {
+ return false;
+ }
+ return Equals((ForeshoreProfile) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ int hashCode = Id.GetHashCode();
+ hashCode = (hashCode * 397) ^ (Name?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ WorldReferencePoint.GetHashCode();
+ hashCode = (hashCode * 397) ^ X0.GetHashCode();
+ hashCode = (hashCode * 397) ^ Orientation.GetHashCode();
+ hashCode = (hashCode * 397) ^ (BreakWater?.GetHashCode() ?? 0);
+
+ foreach (Point2D point in Geometry)
+ {
+ hashCode = (hashCode * 397) ^ point.GetHashCode();
+ }
+ return hashCode;
+ }
+ }
+
+ private bool Equals(ForeshoreProfile other)
+ {
+ return Id.Equals(other.Id)
+ && string.Equals(Name, other.Name)
+ && WorldReferencePoint.Equals(other.WorldReferencePoint)
+ && X0.Equals(other.X0)
+ && Orientation.Equals(other.Orientation)
+ && Equals(BreakWater, other.BreakWater)
+ && EqualGeometry(other.Geometry.ToArray());
+ }
+
private void SetGeometry(IEnumerable points)
{
- var foreshorePoints = points.ToArray();
+ Point2D[] foreshorePoints = points.ToArray();
if (foreshorePoints.Any(p => p == null))
{
throw new ArgumentException(Resources.ForeshoreProfile_SetGeometry_A_point_in_the_collection_is_null);
@@ -142,6 +189,26 @@
Geometry = new RoundedPoint2DCollection(2, foreshorePoints);
}
+ private bool EqualGeometry(Point2D[] otherGeometry)
+ {
+ Point2D[] pointsArray = Geometry.ToArray();
+
+ int nrOfPoints = pointsArray.Length;
+ if (otherGeometry.Length != nrOfPoints)
+ {
+ return false;
+ }
+
+ for (var i = 0; i < nrOfPoints; i++)
+ {
+ if (!pointsArray[i].Equals(otherGeometry[i]))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
///
/// Class holding the various construction parameters for .
///
Index: Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/RoughnessPoint.cs
===================================================================
diff -u -rb2b9fdf365e70928a05c57966eeed30d9050e528 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/RoughnessPoint.cs (.../RoughnessPoint.cs) (revision b2b9fdf365e70928a05c57966eeed30d9050e528)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/RoughnessPoint.cs (.../RoughnessPoint.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -59,5 +59,38 @@
/// Gets the roughness of the .
///
public RoundedDouble Roughness { get; private set; }
+
+ public override bool Equals(object obj)
+ {
+
+ if (ReferenceEquals(null, obj))
+ {
+ return false;
+ }
+ if (ReferenceEquals(this, obj))
+ {
+ return true;
+ }
+ if (obj.GetType() != GetType())
+ {
+ return false;
+ }
+ return Equals((RoughnessPoint)obj);
+ }
+
+ private bool Equals(RoughnessPoint other)
+ {
+ return Equals(Point, other.Point) && Roughness.Equals(other.Roughness);
+ }
+
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ int hashCode = Roughness.GetHashCode();
+ hashCode = (hashCode * 397) ^ (Point?.GetHashCode() ?? 0);
+ return hashCode;
+ }
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Exceptions/DikeProfileUpdateException.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Data/Exceptions/DikeProfileUpdateException.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Exceptions/DikeProfileUpdateException.cs (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -0,0 +1,68 @@
+// 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.Runtime.Serialization;
+
+namespace Ringtoets.Common.Data.Exceptions
+{
+ ///
+ /// Exception that is thrown when updating data of a dike profile has failed.
+ ///
+ [Serializable]
+ public class DikeProfileUpdateException : Exception
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public DikeProfileUpdateException() {}
+
+ ///
+ /// Initializes a new instance of the class
+ /// with a specified error message.
+ ///
+ /// The error message that explains the reason for the exception.
+ public DikeProfileUpdateException(string message) : base(message) {}
+
+ ///
+ /// Initializes a new instance of the class
+ /// with a specified error message and a reference to the inner exception that is
+ /// the cause of this exception.
+ ///
+ /// The error message that explains the reason for the exception.
+ /// The exception that is the cause of the current exception,
+ /// or null if no inner exception is specified.
+ public DikeProfileUpdateException(string message, Exception inner) : base(message, inner) {}
+
+ ///
+ /// Initializes a new instance of with
+ /// serialized data.
+ /// The that holds the serialized
+ /// object data about the exception being thrown.
+ /// The that contains contextual
+ /// information about the source or destination.
+ /// The parameter is
+ /// null.
+ /// The class name is null or
+ /// is zero (0).
+ protected DikeProfileUpdateException(SerializationInfo info, StreamingContext context) : base(info, context) {}
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Exceptions/UpdateDataException.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Data/Exceptions/UpdateDataException.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Exceptions/UpdateDataException.cs (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -0,0 +1,68 @@
+// 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.Runtime.Serialization;
+
+namespace Ringtoets.Common.Data.Exceptions
+{
+ ///
+ /// Exception that is thrown when updating data has failed.
+ ///
+ [Serializable]
+ public class UpdateDataException : Exception
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public UpdateDataException() {}
+
+ ///
+ /// Initializes a new instance of the class
+ /// with a specified error message.
+ ///
+ /// The error message that explains the reason for the exception.
+ public UpdateDataException(string message) : base(message) {}
+
+ ///
+ /// Initializes a new instance of the class
+ /// with a specified error message and a reference to the inner exception that is
+ /// the cause of this exception.
+ ///
+ /// The error message that explains the reason for the exception.
+ /// The exception that is the cause of the current exception,
+ /// or null if no inner exception is specified.
+ public UpdateDataException(string message, Exception inner) : base(message, inner) {}
+
+ ///
+ /// Initializes a new instance of with
+ /// serialized data.
+ /// The that holds the serialized
+ /// object data about the exception being thrown.
+ /// The that contains contextual
+ /// information about the source or destination.
+ /// The parameter is
+ /// null.
+ /// The class name is null or
+ /// is zero (0).
+ protected UpdateDataException(SerializationInfo info, StreamingContext context) : base(info, context) {}
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs
===================================================================
diff -u -r49bbac8914b80005625cc41f2dee8a4812b67ab8 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 49bbac8914b80005625cc41f2dee8a4812b67ab8)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -335,6 +335,24 @@
}
///
+ /// Looks up a localized string similar to Dijkprofielen.
+ ///
+ public static string DikeProfileCollection_TypeDescriptor {
+ get {
+ return ResourceManager.GetString("DikeProfileCollection_TypeDescriptor", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to id.
+ ///
+ public static string DikeProfileCollection_UniqueFeature_id_FeatureDescription {
+ get {
+ return ResourceManager.GetString("DikeProfileCollection_UniqueFeature_id_FeatureDescription", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Berekeningen.
///
public static string FailureMechanism_Calculations_DisplayName {
@@ -578,5 +596,15 @@
return ResourceManager.GetString("StructureInflowModelType_LowSill_DisplayName", resourceCulture);
}
}
+
+ ///
+ /// Looks up a localized string similar to Geïmporteerde data moet unieke elementen bevatten..
+ ///
+ public static string UpdateDataStrategyBase_UpdateTargetCollectionData_Imported_data_must_contain_unique_items {
+ get {
+ return ResourceManager.GetString("UpdateDataStrategyBase_UpdateTargetCollectionData_Imported_data_must_contain_uniq" +
+ "ue_items", resourceCulture);
+ }
+ }
}
}
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx
===================================================================
diff -u -r49bbac8914b80005625cc41f2dee8a4812b67ab8 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision 49bbac8914b80005625cc41f2dee8a4812b67ab8)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -282,4 +282,13 @@
OpenStreetMap
+
+ Geïmporteerde data moet unieke elementen bevatten.
+
+
+ Dijkprofielen
+
+
+ id
+
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj
===================================================================
diff -u -rc90fad2c6d012238ac0b62e52f9820047de76ad6 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision c90fad2c6d012238ac0b62e52f9820047de76ad6)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -53,9 +53,11 @@
+
+
@@ -110,6 +112,7 @@
+
Index: Ringtoets/Common/src/Ringtoets.Common.Data/UpdateDataStrategies/ReplaceDataStrategyBase.cs
===================================================================
diff -u -rdd4e75e27880fc06f6823cca424a010ab19adb33 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.Data/UpdateDataStrategies/ReplaceDataStrategyBase.cs (.../ReplaceDataStrategyBase.cs) (revision dd4e75e27880fc06f6823cca424a010ab19adb33)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/UpdateDataStrategies/ReplaceDataStrategyBase.cs (.../ReplaceDataStrategyBase.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -22,6 +22,7 @@
using System;
using System.Collections.Generic;
using Core.Common.Base;
+using Ringtoets.Common.Data.Exceptions;
using Ringtoets.Common.Data.FailureMechanism;
namespace Ringtoets.Common.Data.UpdateDataStrategies
@@ -33,8 +34,8 @@
/// The target data type.
/// The failure mechanism in which the target collection should be updated.
public abstract class ReplaceDataStrategyBase
- where TTargetData : class
- where TFailureMechanism : IFailureMechanism
+ where TTargetData : class
+ where TFailureMechanism : IFailureMechanism
{
private readonly TFailureMechanism failureMechanism;
@@ -63,27 +64,22 @@
protected abstract IEnumerable ClearData(TFailureMechanism failureMechanism);
///
- /// Replaces the data of the with the imported data in .
+ /// Replaces the data of the with the imported data in .
///
- /// The collection that needs to be updated.
+ /// The collection that needs to be updated.
/// The data that was imported.
/// The source file path where the imported data comes from.
/// An with affected objects.
/// Thrown when any of the input parameters are null.
- /// Thrown when:
- ///
- /// - contains null items.
- /// - contains duplicate items.
- /// - is not a valid file path
- ///
+ /// Thrown when replacing the data has failed.
protected IEnumerable ReplaceTargetCollectionWithImportedData(
- ObservableUniqueItemCollectionWithSourcePath targetCollection,
+ ObservableUniqueItemCollectionWithSourcePath targetDataCollection,
IEnumerable importedDataCollection,
string sourceFilePath)
{
- if (targetCollection == null)
+ if (targetDataCollection == null)
{
- throw new ArgumentNullException(nameof(targetCollection));
+ throw new ArgumentNullException(nameof(targetDataCollection));
}
if (importedDataCollection == null)
{
@@ -96,15 +92,30 @@
var affectedObjects = new List();
affectedObjects.AddRange(ClearData(failureMechanism));
- AddData(targetCollection, importedDataCollection, sourceFilePath);
+ AddData(targetDataCollection, importedDataCollection, sourceFilePath);
return affectedObjects;
}
+ ///
+ /// Adds read data from the to the .
+ ///
+ /// The target collection which needs to be updated.
+ /// The data that was imported.
+ /// The source file path where the imported data comes from.
+ /// Thrown when an error occurs while
+ /// adding data to the .
private static void AddData(ObservableUniqueItemCollectionWithSourcePath targetCollection,
- IEnumerable readData, string sourceFilePath)
+ IEnumerable importedDataCollection, string sourceFilePath)
{
- targetCollection.AddRange(readData, sourceFilePath);
+ try
+ {
+ targetCollection.AddRange(importedDataCollection, sourceFilePath);
+ }
+ catch (ArgumentException e)
+ {
+ throw new UpdateDataException(e.Message, e);
+ }
}
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Data/UpdateDataStrategies/UpdateDataStrategyBase.cs
===================================================================
diff -u -r9997d3038d16fb710ffc92f95c781639d63d7855 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.Data/UpdateDataStrategies/UpdateDataStrategyBase.cs (.../UpdateDataStrategyBase.cs) (revision 9997d3038d16fb710ffc92f95c781639d63d7855)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/UpdateDataStrategies/UpdateDataStrategyBase.cs (.../UpdateDataStrategyBase.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -24,7 +24,9 @@
using System.Linq;
using Core.Common.Base;
using Core.Common.Utils;
+using Ringtoets.Common.Data.Exceptions;
using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.Properties;
namespace Ringtoets.Common.Data.UpdateDataStrategies
{
@@ -42,7 +44,7 @@
where TTargetData : class
where TFailureMechanism : IFailureMechanism
{
- protected readonly TFailureMechanism failureMechanism;
+ protected readonly TFailureMechanism FailureMechanism;
private readonly IEqualityComparer equalityComparer;
///
@@ -63,7 +65,7 @@
}
this.equalityComparer = equalityComparer;
- this.failureMechanism = failureMechanism;
+ FailureMechanism = failureMechanism;
}
///
@@ -92,11 +94,7 @@
/// the .
/// The source file path.
/// A of affected objects.
- /// Thrown when any of the input parameters are null.
- /// Thrown when duplicate items are being added to the
- /// .
- /// Thrown when duplicate items are found during the
- /// update of the items in the .
+ /// Thrown when an error occurred while updating the data.
protected IEnumerable UpdateTargetCollectionData(ObservableUniqueItemCollectionWithSourcePath targetDataCollection,
IEnumerable importedDataCollection,
string sourceFilePath)
@@ -114,7 +112,18 @@
throw new ArgumentNullException(nameof(sourceFilePath));
}
- return ModifyDataCollection(targetDataCollection, importedDataCollection, sourceFilePath);
+ try
+ {
+ return ModifyDataCollection(targetDataCollection, importedDataCollection, sourceFilePath);
+ }
+ catch (ArgumentException e)
+ {
+ throw new UpdateDataException(e.Message, e);
+ }
+ catch (InvalidOperationException e)
+ {
+ throw new UpdateDataException(Resources.UpdateDataStrategyBase_UpdateTargetCollectionData_Imported_data_must_contain_unique_items, e);
+ }
}
///
@@ -169,11 +178,14 @@
}
///
- /// Updates all the objects and their dependent data that needs to be updated with data from the imported data collection.
+ /// Updates all the objects and their dependent data that needs to be
+ /// updated with data from the imported data collection.
///
/// The objects that need to be updated.
/// The data to update from.
/// A of affected items.
+ /// Thrown when the imported
+ /// contains duplicate items.
private IEnumerable UpdateData(IEnumerable objectsToUpdate,
IEnumerable importedDataCollection)
{
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/ChangeHandlers/FailureMechanismCalculationChangeHandler.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/ChangeHandlers/FailureMechanismCalculationChangeHandler.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/ChangeHandlers/FailureMechanismCalculationChangeHandler.cs (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -0,0 +1,79 @@
+// 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 Core.Common.Gui;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.IO;
+
+namespace Ringtoets.Common.Forms.ChangeHandlers
+{
+ ///
+ /// Class which can, if required, inquire the user for a confirmation when a change to the
+ /// failure mechanism requires calculation results to be altered.
+ ///
+ public class FailureMechanismCalculationChangeHandler : IConfirmDataChangeHandler
+ {
+ private readonly string query;
+ private readonly IFailureMechanism failureMechanism;
+ private readonly IInquiryHelper inquiryHandler;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// Failure mechanism for which to handle changes of the failure mechanism.
+ /// The query which should be displayed when inquiring for a confirmation.
+ /// Object responsible for inquiring required data.
+ /// Thrown when any input parameter is null.
+ public FailureMechanismCalculationChangeHandler(IFailureMechanism failureMechanism,
+ string query,
+ IInquiryHelper inquiryHandler)
+ {
+ if (failureMechanism == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanism));
+ }
+ if (query == null)
+ {
+ throw new ArgumentNullException(nameof(query));
+ }
+ if (inquiryHandler == null)
+ {
+ throw new ArgumentNullException(nameof(inquiryHandler));
+ }
+
+ this.failureMechanism = failureMechanism;
+ this.query = query;
+ this.inquiryHandler = inquiryHandler;
+ }
+
+ public bool RequireConfirmation()
+ {
+ return failureMechanism.Calculations.Any(calc => calc.HasOutput);
+ }
+
+ public bool InquireConfirmation()
+ {
+ return inquiryHandler.InquireContinuation(query);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r92df0a0ac0a4e0ccd5d7505d748f55167c2aac81 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 92df0a0ac0a4e0ccd5d7505d748f55167c2aac81)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -710,6 +710,15 @@
}
///
+ /// Looks up a localized string similar to Er zijn geen berekeningen om bij te werken..
+ ///
+ public static string CreateUpdateContextMenuItem_No_calculations_to_update_ToolTip {
+ get {
+ return ResourceManager.GetString("CreateUpdateContextMenuItem_No_calculations_to_update_ToolTip", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
public static System.Drawing.Bitmap DatabaseIcon {
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx
===================================================================
diff -u -r92df0a0ac0a4e0ccd5d7505d748f55167c2aac81 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 92df0a0ac0a4e0ccd5d7505d748f55167c2aac81)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -935,4 +935,7 @@
Ringtoets berekeningenconfiguratie (*.xml)
+
+ Er zijn geen berekeningen om bij te werken.
+
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj
===================================================================
diff -u -rf1f130fa156455abb12b76404c36be9c71f797df -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision f1f130fa156455abb12b76404c36be9c71f797df)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -47,6 +47,7 @@
Properties\GlobalAssembly.cs
+
Index: Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/DikeProfilesImporter.cs
===================================================================
diff -u -r1f549a37af503f5da697652b5e5199f8d29ac0fe -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/DikeProfilesImporter.cs (.../DikeProfilesImporter.cs) (revision 1f549a37af503f5da697652b5e5199f8d29ac0fe)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/DikeProfilesImporter.cs (.../DikeProfilesImporter.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -27,42 +27,62 @@
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.IO.DikeProfiles;
+using Ringtoets.Common.IO.FileImporters.MessageProviders;
using Ringtoets.Common.IO.Properties;
+using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources;
namespace Ringtoets.Common.IO.FileImporters
{
///
/// Imports point shapefiles containing dike profile locations and text files containing dike schematizations.
///
- public class DikeProfilesImporter : ProfilesImporter>
+ public class DikeProfilesImporter : ProfilesImporter
{
+ private readonly IDikeProfileUpdateDataStrategy dikeProfileUpdateDataStrategy;
+ private IEnumerable updatedInstances;
+
///
/// Creates a new instance of .
///
/// The dike profiles to import on.
/// The reference line used to check if the
/// objects found in the file are intersecting it.
/// The path to the file to import from.
- /// Thrown when ,
- /// or is null.
- public DikeProfilesImporter(ObservableList importTarget, ReferenceLine referenceLine, string filePath)
- : base(referenceLine, filePath, importTarget) {}
+ /// The strategy to update the dike profiles
+ /// with the imported data.
+ /// The message provide to provide the messages during importer action.
+ /// Thrown when any input parameter is null.
+ public DikeProfilesImporter(DikeProfileCollection importTarget, ReferenceLine referenceLine,
+ string filePath,
+ IDikeProfileUpdateDataStrategy dikeProfileUpdateStrategy,
+ IImporterMessageProvider messageProvider)
+ : base(referenceLine, filePath, importTarget, messageProvider)
+ {
+ if (dikeProfileUpdateStrategy == null)
+ {
+ throw new ArgumentNullException(nameof(dikeProfileUpdateStrategy));
+ }
+ dikeProfileUpdateDataStrategy = dikeProfileUpdateStrategy;
+ updatedInstances = Enumerable.Empty();
+ }
+
protected override void CreateProfiles(ReadResult importProfileLocationResult,
ReadResult importDikeProfileDataResult)
{
IEnumerable importedDikeProfiles = CreateDikeProfiles(importProfileLocationResult.Items,
importDikeProfileDataResult.Items);
- foreach (DikeProfile dikeProfile in importedDikeProfiles)
- {
- ImportTarget.Add(dikeProfile);
- }
+ updatedInstances = dikeProfileUpdateDataStrategy.UpdateDikeProfilesWithImportedData(ImportTarget,
+ importedDikeProfiles,
+ FilePath);
}
protected override void LogImportCanceledMessage()
{
- Log.Info(Resources.DikeProfilesImporter_HandleUserCancelingImport_dikeprofile_import_aborted);
+ string logMessage = MessageProvider.GetCancelledLogMessageText(
+ RingtoetsCommonDataResources.DikeProfileCollection_TypeDescriptor);
+ Log.Info(logMessage);
}
protected override bool DikeProfileDataIsValid(DikeProfileData data, string prflFilePath)
@@ -75,6 +95,14 @@
return false;
}
+ protected override void DoPostImportUpdates()
+ {
+ foreach (IObservable updatedInstance in updatedInstances)
+ {
+ updatedInstance.NotifyObservers();
+ }
+ }
+
private IEnumerable CreateDikeProfiles(IEnumerable dikeProfileLocationCollection,
ICollection dikeProfileDataCollection)
{
@@ -83,7 +111,7 @@
{
string id = dikeProfileLocation.Id;
- var dikeProfileData = GetMatchingDikeProfileData(dikeProfileDataCollection, id);
+ DikeProfileData dikeProfileData = GetMatchingDikeProfileData(dikeProfileDataCollection, id);
if (dikeProfileData == null)
{
Log.ErrorFormat(Resources.DikeProfilesImporter_GetMatchingDikeProfileData_no_dikeprofiledata_for_location_0_, id);
@@ -99,7 +127,7 @@
private static DikeProfile CreateDikeProfile(ProfileLocation dikeProfileLocation, DikeProfileData dikeProfileData)
{
- var dikeProfile = new DikeProfile(dikeProfileLocation.Point, dikeProfileData.DikeGeometry,
+ return new DikeProfile(dikeProfileLocation.Point, dikeProfileData.DikeGeometry,
dikeProfileData.ForeshoreGeometry.Select(fg => fg.Point).ToArray(),
CreateBreakWater(dikeProfileData),
new DikeProfile.ConstructionProperties
@@ -110,8 +138,6 @@
Orientation = dikeProfileData.Orientation,
DikeHeight = dikeProfileData.DikeHeight
});
-
- return dikeProfile;
}
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/ForeshoreProfilesImporter.cs
===================================================================
diff -u -r1f549a37af503f5da697652b5e5199f8d29ac0fe -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/ForeshoreProfilesImporter.cs (.../ForeshoreProfilesImporter.cs) (revision 1f549a37af503f5da697652b5e5199f8d29ac0fe)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/ForeshoreProfilesImporter.cs (.../ForeshoreProfilesImporter.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -27,6 +27,7 @@
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.IO.DikeProfiles;
+using Ringtoets.Common.IO.FileImporters.MessageProviders;
using Ringtoets.Common.IO.Properties;
namespace Ringtoets.Common.IO.FileImporters
@@ -46,7 +47,7 @@
/// Thrown when ,
/// or is null.
public ForeshoreProfilesImporter(ObservableList importTarget, ReferenceLine referenceLine, string filePath)
- : base(referenceLine, filePath, importTarget) {}
+ : base(referenceLine, filePath, importTarget, new ImportMessageProvider()) {}
protected override void CreateProfiles(ReadResult importProfileLocationResult,
ReadResult importDikeProfileDataResult)
Index: Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/IDikeProfileUpdateDataStrategy.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/IDikeProfileUpdateDataStrategy.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/IDikeProfileUpdateDataStrategy.cs (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -0,0 +1,54 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using Core.Common.Base;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.Exceptions;
+
+namespace Ringtoets.Common.IO.FileImporters
+{
+ ///
+ /// Interface describing the method of updating the date model after new
+ /// dike profiles have been imported.
+ ///
+ public interface IDikeProfileUpdateDataStrategy
+ {
+ ///
+ /// Adds the imported data to the .
+ ///
+ /// The target collection which needs
+ /// to be updated.
+ /// The imported dike profiles.
+ /// The source path from where the dike profiles
+ /// were imported from.
+ /// An of updated instances.
+ /// Thrown when any input
+ /// argument is null.
+ /// Thrown
+ /// when applying the strategy has failed.
+ IEnumerable UpdateDikeProfilesWithImportedData(
+ DikeProfileCollection targetDataCollection,
+ IEnumerable importedDataCollection,
+ string sourceFilePath);
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/ProfilesImporter.cs
===================================================================
diff -u -rba715436cd0186ee10a1edc13d547ee27bea4c89 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/ProfilesImporter.cs (.../ProfilesImporter.cs) (revision ba715436cd0186ee10a1edc13d547ee27bea4c89)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/ProfilesImporter.cs (.../ProfilesImporter.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -33,6 +33,7 @@
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.IO.DikeProfiles;
using Ringtoets.Common.IO.Exceptions;
+using Ringtoets.Common.IO.FileImporters.MessageProviders;
using Ringtoets.Common.IO.Properties;
namespace Ringtoets.Common.IO.FileImporters
@@ -46,23 +47,31 @@
{
protected readonly ILog Log = LogManager.GetLogger(typeof(ProfilesImporter));
private readonly ReferenceLine referenceLine;
+ protected readonly IImporterMessageProvider MessageProvider;
///
/// Initializes a new instance of .
///
/// The reference line used to check if the imported profiles are intersecting it.
/// The path to the file to import from.
/// The import target.
+ /// The message provider to provide messages during the import.
/// Thrown when ,
/// or is null.
- protected ProfilesImporter(ReferenceLine referenceLine, string filePath, T importTarget) : base(filePath, importTarget)
+ protected ProfilesImporter(ReferenceLine referenceLine, string filePath, T importTarget,
+ IImporterMessageProvider messageProvider) : base(filePath, importTarget)
{
if (referenceLine == null)
{
throw new ArgumentNullException(nameof(referenceLine));
}
+ if (messageProvider == null)
+ {
+ throw new ArgumentNullException(nameof(messageProvider));
+ }
this.referenceLine = referenceLine;
+ MessageProvider = messageProvider;
}
protected override bool OnImport()
@@ -81,7 +90,7 @@
return false;
}
- NotifyProgress(Resources.Importer_ProgressText_Adding_imported_data_to_data_model, 1, 1);
+ NotifyProgress(MessageProvider.GetAddDataToModelProgressText(), 1, 1);
CreateProfiles(importDikeProfilesResult, importDikeProfileDataResult);
return true;
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs
===================================================================
diff -u -rb09f4737de300a8cdedc66f9d6ade8bffbd4f619 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision b09f4737de300a8cdedc66f9d6ade8bffbd4f619)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -640,21 +640,21 @@
}
///
- /// Looks up a localized string similar to Kan geen geldige gegevens vinden voor dijkprofiellocatie met ID '{0}'..
+ /// Looks up a localized string similar to Dijkprofiellocaties.
///
- public static string DikeProfilesImporter_GetMatchingDikeProfileData_no_dikeprofiledata_for_location_0_ {
+ public static string DikeProfilesImporter_DisplayName {
get {
- return ResourceManager.GetString("DikeProfilesImporter_GetMatchingDikeProfileData_no_dikeprofiledata_for_location_0" +
- "_", resourceCulture);
+ return ResourceManager.GetString("DikeProfilesImporter_DisplayName", resourceCulture);
}
}
///
- /// Looks up a localized string similar to Dijkprofielen importeren is afgebroken. Geen gegevens ingelezen..
+ /// Looks up a localized string similar to Kan geen geldige gegevens vinden voor dijkprofiellocatie met ID '{0}'..
///
- public static string DikeProfilesImporter_HandleUserCancelingImport_dikeprofile_import_aborted {
+ public static string DikeProfilesImporter_GetMatchingDikeProfileData_no_dikeprofiledata_for_location_0_ {
get {
- return ResourceManager.GetString("DikeProfilesImporter_HandleUserCancelingImport_dikeprofile_import_aborted", resourceCulture);
+ return ResourceManager.GetString("DikeProfilesImporter_GetMatchingDikeProfileData_no_dikeprofiledata_for_location_0" +
+ "_", resourceCulture);
}
}
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx
===================================================================
diff -u -rb09f4737de300a8cdedc66f9d6ade8bffbd4f619 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx (.../Resources.resx) (revision b09f4737de300a8cdedc66f9d6ade8bffbd4f619)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx (.../Resources.resx) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -354,9 +354,6 @@
Kan geen geldige gegevens vinden voor dijkprofiellocatie met ID '{0}'.
-
- Dijkprofielen importeren is afgebroken. Geen gegevens ingelezen.
-
Profielgegevens definiëren geen dijkgeometrie. Bestand '{0}' wordt overgeslagen.
@@ -643,4 +640,7 @@
Er kan geen spreiding voor stochast 'afvoercoefficient' opgegeven worden.
+
+ Dijkprofiellocaties
+
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj
===================================================================
diff -u -r52cc989dff0f8f10fe0db1222ca2bd386c1d8188 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 52cc989dff0f8f10fe0db1222ca2bd386c1d8188)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -75,6 +75,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/BreakWaterTest.cs
===================================================================
diff -u -r30b8231f92b90ea4b05e98e3d0285368f6dfe2e4 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/BreakWaterTest.cs (.../BreakWaterTest.cs) (revision 30b8231f92b90ea4b05e98e3d0285368f6dfe2e4)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/BreakWaterTest.cs (.../BreakWaterTest.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -32,11 +32,11 @@
public void Constructor_Always_ExpectedValues()
{
// Setup
- BreakWaterType type = BreakWaterType.Caisson;
+ const BreakWaterType type = BreakWaterType.Caisson;
const double height = 100.1;
// Call
- BreakWater breakWater = new BreakWater(type, height);
+ var breakWater = new BreakWater(type, height);
// Assert
Assert.AreEqual(type, breakWater.Type);
@@ -50,9 +50,9 @@
public void Properties_Type_ReturnsExpectedValue(BreakWaterType newType)
{
// Setup
- BreakWaterType type = BreakWaterType.Caisson;
+ const BreakWaterType type = BreakWaterType.Caisson;
const double height = 100.1;
- BreakWater breakWater = new BreakWater(type, height);
+ var breakWater = new BreakWater(type, height);
// Call
breakWater.Type = newType;
@@ -65,15 +65,166 @@
public void Properties_Height_ReturnsExpectedValue()
{
// Setup
- BreakWaterType type = BreakWaterType.Caisson;
+ const BreakWaterType type = BreakWaterType.Caisson;
const double height = 100.10;
- BreakWater breakWater = new BreakWater(type, height);
+ var breakWater = new BreakWater(type, height);
// Call
breakWater.Height = (RoundedDouble) 10.00;
// Assert
Assert.AreEqual(10.0, breakWater.Height.Value);
}
+
+ [Test]
+ public void Equals_ToItself_ReturnsTrue()
+ {
+ // Setup
+ var breakWater = new BreakWater(BreakWaterType.Caisson, 100.10);
+
+ // Call
+ bool isBreakWaterEqualToItself = breakWater.Equals(breakWater);
+
+ // Assert
+ Assert.IsTrue(isBreakWaterEqualToItself);
+ }
+
+ [Test]
+ public void Equals_AllPropertiesEqual_ReturnsTrue()
+ {
+ // Setup
+ const BreakWaterType type = BreakWaterType.Caisson;
+ const double height = 100.10;
+
+ var breakWaterOne = new BreakWater(type, height);
+ var breakWaterTwo = new BreakWater(type, height);
+
+ // Call
+ bool isBreakWaterOneEqualToTwo = breakWaterOne.Equals(breakWaterTwo);
+ bool isBreakWaterTwoEqualToOne = breakWaterTwo.Equals(breakWaterOne);
+
+ // Assert
+ Assert.IsTrue(isBreakWaterOneEqualToTwo);
+ Assert.IsTrue(isBreakWaterTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_ToSameReference_ReturnsTrue()
+ {
+ // Setup
+ var breakWaterOne = new BreakWater(BreakWaterType.Caisson, 100.10);
+ BreakWater breakWaterTwo = breakWaterOne;
+
+ // Call
+ bool isBreakWaterOneEqualToTwo = breakWaterOne.Equals(breakWaterTwo);
+ bool isBreakWaterTwoEqualToOne = breakWaterTwo.Equals(breakWaterOne);
+
+ // Assert
+ Assert.IsTrue(isBreakWaterOneEqualToTwo);
+ Assert.IsTrue(isBreakWaterTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_TransitivePropertyEqualBreakWater_ReturnsTrue()
+ {
+ // Setup
+ const BreakWaterType type = BreakWaterType.Caisson;
+ const double height = 100.10;
+
+ var breakWaterOne = new BreakWater(type, height);
+ var breakWaterTwo = new BreakWater(type, height);
+ var breakWaterThree = new BreakWater(type, height);
+
+ // Call
+ bool isBreakWaterOneEqualToTwo = breakWaterOne.Equals(breakWaterTwo);
+ bool isBreakWaterTwoEqualToThree = breakWaterTwo.Equals(breakWaterThree);
+ bool isBreakWaterOneEqualToThree = breakWaterOne.Equals(breakWaterThree);
+
+ // Assert
+ Assert.IsTrue(isBreakWaterOneEqualToTwo);
+ Assert.IsTrue(isBreakWaterTwoEqualToThree);
+ Assert.IsTrue(isBreakWaterOneEqualToThree);
+ }
+
+ [Test]
+ public void Equals_ToNull_ReturnsFalse()
+ {
+ // Setup
+ var breakWater = new BreakWater(BreakWaterType.Caisson, 100.10);
+
+ // Call
+ bool isBreakWaterEqualToNull = breakWater.Equals(null);
+
+ // Assert
+ Assert.IsFalse(isBreakWaterEqualToNull);
+ }
+
+ [Test]
+ public void Equals_ToDifferentType_ReturnsFalse()
+ {
+ // Setup
+ var breakWater = new BreakWater(BreakWaterType.Caisson, 100.10);
+ var differentType = new object();
+
+ // Call
+ bool isBreakWaterEqualToDifferentType = breakWater.Equals(differentType);
+
+ // Assert
+ Assert.IsFalse(isBreakWaterEqualToDifferentType);
+ }
+
+ [Test]
+ public void Equals_DifferentBreakWaterType_ReturnsFalse()
+ {
+ // Setup
+ const double height = 100.10;
+
+ var breakWaterOne = new BreakWater(BreakWaterType.Caisson, height);
+ var breakWaterTwo = new BreakWater(BreakWaterType.Wall, height);
+
+ // Call
+ bool isBreakWaterOneEqualToTwo = breakWaterOne.Equals(breakWaterTwo);
+ bool isBreakWaterTwoEqualToOne = breakWaterTwo.Equals(breakWaterOne);
+
+ // Assert
+ Assert.IsFalse(isBreakWaterOneEqualToTwo);
+ Assert.IsFalse(isBreakWaterTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_DifferentHeight_ReturnsFalse()
+ {
+ // Setup
+ const BreakWaterType type = BreakWaterType.Caisson;
+
+ var breakWaterOne = new BreakWater(type, 100.10);
+ var breakWaterTwo = new BreakWater(type, 100.20);
+
+ // Call
+ bool isBreakWaterOneEqualToTwo = breakWaterOne.Equals(breakWaterTwo);
+ bool isBreakWaterTwoEqualToOne = breakWaterTwo.Equals(breakWaterOne);
+
+ // Assert
+ Assert.IsFalse(isBreakWaterOneEqualToTwo);
+ Assert.IsFalse(isBreakWaterTwoEqualToOne);
+ }
+
+ [Test]
+ public void GetHashCode_EqualBreakWater_ReturnsSameHashCode()
+ {
+ // Setup
+ const BreakWaterType type = BreakWaterType.Caisson;
+ const double height = 100.10;
+
+ var breakWaterOne = new BreakWater(type, height);
+ var breakWaterTwo = new BreakWater(type, height);
+
+ // Call
+ int hashCodeOne = breakWaterOne.GetHashCode();
+ int hashCodeTwo = breakWaterTwo.GetHashCode();
+
+ // Assert
+ Assert.AreEqual(hashCodeOne, hashCodeTwo);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/DikeProfileCollectionTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/DikeProfileCollectionTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/DikeProfileCollectionTest.cs (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -0,0 +1,110 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Core.Common.Base;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.TestUtil;
+
+namespace Ringtoets.Common.Data.Test.DikeProfiles
+{
+ [TestFixture]
+ public class DikeProfileCollectionTest
+ {
+ [Test]
+ public void DefaultConstructor_ReturnsCollectionWithPath()
+ {
+ // Call
+ var collection = new DikeProfileCollection();
+
+ // Assert
+ Assert.IsInstanceOf>(collection);
+ }
+
+ [Test]
+ public void AddRange_DikeProfilesWithDifferentIds_AddsDikeProfiles()
+ {
+ // Setup
+ var dikeProfilesToAdd = new[]
+ {
+ new TestDikeProfile(string.Empty, "Dike ID A"),
+ new TestDikeProfile(string.Empty, "Dike ID B")
+ };
+
+ var collection = new DikeProfileCollection();
+ const string expectedFilePath = "other/path";
+
+ // Call
+ collection.AddRange(dikeProfilesToAdd, expectedFilePath);
+
+ // Assert
+ Assert.AreEqual(expectedFilePath, collection.SourcePath);
+ CollectionAssert.AreEqual(dikeProfilesToAdd, collection);
+ }
+
+ [Test]
+ public void AddRange_WithDikeProfilesWithEqualIds_ThrowsArgumentException()
+ {
+ // Setup
+ var collection = new DikeProfileCollection();
+ const string someId = "Dike profile";
+ const string name = "Standard Dike Profile Name";
+ var modelsToAdd = new[]
+ {
+ new TestDikeProfile(name, someId),
+ new TestDikeProfile(name, someId)
+ };
+
+ // Call
+ TestDelegate call = () => collection.AddRange(modelsToAdd, "valid/file/path");
+
+ // Assert
+ string message = $"Dijkprofielen moeten een unieke id hebben. Gevonden dubbele elementen: {someId}.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message);
+ }
+
+ [Test]
+ public void AddRange_WithMultipleDikeProfilesWithEqualIds_ThrowsArgumentException()
+ {
+ // Setup
+ var collection = new DikeProfileCollection();
+ const string someId = "Dike profile";
+ const string someotherId = "Other dike profile";
+ const string name = "Some Dike profile Name";
+ var modelsToAdd = new[]
+ {
+ new TestDikeProfile(name, someId),
+ new TestDikeProfile(name, someId),
+ new TestDikeProfile(name, someotherId),
+ new TestDikeProfile(name, someotherId)
+ };
+
+ // Call
+ TestDelegate call = () => collection.AddRange(modelsToAdd, "valid/file/path");
+
+ // Assert
+ string message = $"Dijkprofielen moeten een unieke id hebben. Gevonden dubbele elementen: {someId}, {someotherId}.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/DikeProfileTest.cs
===================================================================
diff -u -r1f549a37af503f5da697652b5e5199f8d29ac0fe -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/DikeProfileTest.cs (.../DikeProfileTest.cs) (revision 1f549a37af503f5da697652b5e5199f8d29ac0fe)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/DikeProfileTest.cs (.../DikeProfileTest.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -20,6 +20,7 @@
// All rights reserved.
using System;
+using Core.Common.Base;
using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
using Core.Common.TestUtil;
@@ -35,7 +36,7 @@
public void Constructor_ValidParameters_ExpectedValues()
{
// Setup
- string validId = "id";
+ const string validId = "id";
var worldCoordinate = new Point2D(1.1, 2.2);
var dikeGeometry = new[]
{
@@ -57,6 +58,7 @@
});
// Assert
+ Assert.IsInstanceOf(dikeProfile);
Assert.IsInstanceOf(dikeProfile.Orientation);
Assert.IsInstanceOf(dikeProfile.DikeHeight);
Assert.IsInstanceOf(dikeProfile.X0);
@@ -319,10 +321,525 @@
});
// Call
- var result = dikeProfile.ToString();
+ string result = dikeProfile.ToString();
// Assert
Assert.AreEqual(testName, result);
}
+
+ [Test]
+ public void Equals_ToItself_ReturnsTrue()
+ {
+ // Setup
+ DikeProfile dikeProfile = CreateFullyDefinedDikeProfile();
+
+ // Call
+ bool isEqualToItself = dikeProfile.Equals(dikeProfile);
+
+ // Assert
+ Assert.IsTrue(isEqualToItself);
+ }
+
+ [Test]
+ public void Equals_ToNull_ReturnsFalse()
+ {
+ // Setup
+ DikeProfile dikeProfile = CreateFullyDefinedDikeProfile();
+
+ // Call
+ bool isDikeProfileEqualToNull = dikeProfile.Equals(null);
+
+ // Assert
+ Assert.IsFalse(isDikeProfileEqualToNull);
+ }
+
+ [Test]
+ public void Equal_ToDifferentType_ReturnsFalse()
+ {
+ // Setup
+ DikeProfile dikeProfile = CreateFullyDefinedDikeProfile();
+
+ var differentType = new object();
+
+ // Call
+ bool isDikeProfileEqualToDifferentObject = dikeProfile.Equals(differentType);
+
+ // Assert
+ Assert.IsFalse(isDikeProfileEqualToDifferentObject);
+ }
+
+ [Test]
+ public void Equals_DifferentWorldReferencePoints_ReturnsFalse()
+ {
+ // Setup
+ DikeProfile dikeProfileOne = CreateFullyDefinedDikeProfile();
+
+ var dikeProfileTwo = new DikeProfile(new Point2D(500, 1000),
+ dikeProfileOne.DikeGeometry,
+ dikeProfileOne.ForeshoreGeometry,
+ dikeProfileOne.BreakWater,
+ new DikeProfile.ConstructionProperties
+ {
+ Name = dikeProfileOne.Name,
+ Id = dikeProfileOne.Id,
+ Orientation = dikeProfileOne.Orientation,
+ DikeHeight = dikeProfileOne.DikeHeight,
+ X0 = dikeProfileOne.DikeHeight
+ });
+
+ // Call
+ bool isDikeProfileOneEqualToTwo = dikeProfileOne.Equals(dikeProfileTwo);
+ bool isDikeProfileTwoEqualToOne = dikeProfileTwo.Equals(dikeProfileOne);
+
+ // Assert
+ Assert.IsFalse(isDikeProfileOneEqualToTwo);
+ Assert.IsFalse(isDikeProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_DifferentDikeGeometry_ReturnsFalse()
+ {
+ // Setup
+ DikeProfile dikeProfileOne = CreateFullyDefinedDikeProfile();
+
+ var dikeGeometry = new[]
+ {
+ new RoughnessPoint(new Point2D(1, 0), 1),
+ new RoughnessPoint(new Point2D(2, 1), 3)
+ };
+ var dikeProfileTwo = new DikeProfile(dikeProfileOne.WorldReferencePoint,
+ dikeGeometry,
+ dikeProfileOne.ForeshoreGeometry,
+ dikeProfileOne.BreakWater,
+ new DikeProfile.ConstructionProperties
+ {
+ Name = dikeProfileOne.Name,
+ Id = dikeProfileOne.Id,
+ Orientation = dikeProfileOne.Orientation,
+ DikeHeight = dikeProfileOne.DikeHeight,
+ X0 = dikeProfileOne.DikeHeight
+ });
+
+ // Call
+ bool isDikeProfileOneEqualToTwo = dikeProfileOne.Equals(dikeProfileTwo);
+ bool isDikeProfileTwoEqualToOne = dikeProfileTwo.Equals(dikeProfileOne);
+
+ // Assert
+ Assert.IsFalse(isDikeProfileOneEqualToTwo);
+ Assert.IsFalse(isDikeProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_DifferentForeshoreGeometry_ReturnsFalse()
+ {
+ // Setup
+ DikeProfile dikeProfileOne = CreateFullyDefinedDikeProfile();
+
+ var foreshoreGeometry = new[]
+ {
+ new Point2D(50, 100),
+ new Point2D(100, 50)
+ };
+ var dikeProfileTwo = new DikeProfile(dikeProfileOne.WorldReferencePoint,
+ dikeProfileOne.DikeGeometry,
+ foreshoreGeometry,
+ dikeProfileOne.BreakWater,
+ new DikeProfile.ConstructionProperties
+ {
+ Name = dikeProfileOne.Name,
+ Id = dikeProfileOne.Id,
+ Orientation = dikeProfileOne.Orientation,
+ DikeHeight = dikeProfileOne.DikeHeight,
+ X0 = dikeProfileOne.DikeHeight
+ });
+
+ // Call
+ bool isDikeProfileOneEqualToTwo = dikeProfileOne.Equals(dikeProfileTwo);
+ bool isDikeProfileTwoEqualToOne = dikeProfileTwo.Equals(dikeProfileOne);
+
+ // Assert
+ Assert.IsFalse(isDikeProfileOneEqualToTwo);
+ Assert.IsFalse(isDikeProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_DifferentBreakWater_ReturnsFalse()
+ {
+ // Setup
+ DikeProfile dikeProfileOne = CreateFullyDefinedDikeProfile();
+
+ var dikeProfileTwo = new DikeProfile(dikeProfileOne.WorldReferencePoint,
+ dikeProfileOne.DikeGeometry,
+ dikeProfileOne.ForeshoreGeometry,
+ null,
+ new DikeProfile.ConstructionProperties
+ {
+ Name = dikeProfileOne.Name,
+ Id = dikeProfileOne.Id,
+ Orientation = dikeProfileOne.Orientation,
+ DikeHeight = dikeProfileOne.DikeHeight,
+ X0 = dikeProfileOne.DikeHeight
+ });
+
+ // Call
+ bool isDikeProfileOneEqualToTwo = dikeProfileOne.Equals(dikeProfileTwo);
+ bool isDikeProfileTwoEqualToOne = dikeProfileTwo.Equals(dikeProfileOne);
+
+ // Assert
+ Assert.IsFalse(isDikeProfileOneEqualToTwo);
+ Assert.IsFalse(isDikeProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_DifferentIds_ReturnsFalse()
+ {
+ // Setup
+ DikeProfile dikeProfileOne = CreateFullyDefinedDikeProfile();
+
+ var dikeProfileTwo = new DikeProfile(dikeProfileOne.WorldReferencePoint,
+ dikeProfileOne.DikeGeometry,
+ dikeProfileOne.ForeshoreGeometry,
+ dikeProfileOne.BreakWater,
+ new DikeProfile.ConstructionProperties
+ {
+ Name = dikeProfileOne.Name,
+ Id = "Different ID",
+ Orientation = dikeProfileOne.Orientation,
+ DikeHeight = dikeProfileOne.DikeHeight,
+ X0 = dikeProfileOne.DikeHeight
+ });
+
+ // Call
+ bool isDikeProfileOneEqualToTwo = dikeProfileOne.Equals(dikeProfileTwo);
+ bool isDikeProfileTwoEqualToOne = dikeProfileTwo.Equals(dikeProfileOne);
+
+ // Assert
+ Assert.IsFalse(isDikeProfileOneEqualToTwo);
+ Assert.IsFalse(isDikeProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_DifferentNames_ReturnsFalse()
+ {
+ // Setup
+ DikeProfile dikeProfileOne = CreateFullyDefinedDikeProfile();
+
+ var dikeProfileTwo = new DikeProfile(dikeProfileOne.WorldReferencePoint,
+ dikeProfileOne.DikeGeometry,
+ dikeProfileOne.ForeshoreGeometry,
+ dikeProfileOne.BreakWater,
+ new DikeProfile.ConstructionProperties
+ {
+ Name = "Different Name",
+ Id = dikeProfileOne.Id,
+ Orientation = dikeProfileOne.Orientation,
+ DikeHeight = dikeProfileOne.DikeHeight,
+ X0 = dikeProfileOne.DikeHeight
+ });
+
+ // Call
+ bool isDikeProfileOneEqualToTwo = dikeProfileOne.Equals(dikeProfileTwo);
+ bool isDikeProfileTwoEqualToOne = dikeProfileTwo.Equals(dikeProfileOne);
+
+ // Assert
+ Assert.IsFalse(isDikeProfileOneEqualToTwo);
+ Assert.IsFalse(isDikeProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_DifferentX0_ReturnsFalse()
+ {
+ // Setup
+ const string id = "ID";
+ const string name = "Just a name";
+ const double orientation = 179;
+ const double dikeHeight = 0.5;
+ DikeProfile dikeProfileOne = CreateDikeProfile(new DikeProfile.ConstructionProperties
+ {
+ Id = id,
+ Name = name,
+ X0 = 10.0,
+ Orientation = orientation,
+ DikeHeight = dikeHeight
+ });
+
+ DikeProfile dikeProfileTwo = CreateDikeProfile(new DikeProfile.ConstructionProperties
+ {
+ Id = id,
+ Name = name,
+ X0 = 11.0,
+ Orientation = orientation,
+ DikeHeight = dikeHeight
+ });
+
+ // Call
+ bool isDikeProfileOneEqualToTwo = dikeProfileOne.Equals(dikeProfileTwo);
+ bool isDikeProfileTwoEqualToOne = dikeProfileTwo.Equals(dikeProfileOne);
+
+ // Assert
+ Assert.IsFalse(isDikeProfileOneEqualToTwo);
+ Assert.IsFalse(isDikeProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_DifferentOrientation_ReturnsFalse()
+ {
+ // Setup
+ const string id = "ID";
+ const string name = "Just a name";
+ const double x0 = 179;
+ const double dikeHeight = 0.5;
+ DikeProfile dikeProfileOne = CreateDikeProfile(new DikeProfile.ConstructionProperties
+ {
+ Id = id,
+ Name = name,
+ X0 = x0,
+ Orientation = 180,
+ DikeHeight = dikeHeight
+ });
+
+ DikeProfile dikeProfileTwo = CreateDikeProfile(new DikeProfile.ConstructionProperties
+ {
+ Id = id,
+ Name = name,
+ X0 = x0,
+ Orientation = 170,
+ DikeHeight = dikeHeight
+ });
+
+ // Call
+ bool isDikeProfileOneEqualToTwo = dikeProfileOne.Equals(dikeProfileTwo);
+ bool isDikeProfileTwoEqualToOne = dikeProfileTwo.Equals(dikeProfileOne);
+
+ // Assert
+ Assert.IsFalse(isDikeProfileOneEqualToTwo);
+ Assert.IsFalse(isDikeProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_DifferentDikeHeight_ReturnsFalse()
+ {
+ // Setup
+ const string id = "ID";
+ const string name = "Just a name";
+ const double orientation = 179;
+ const double x0 = 0.5;
+ DikeProfile dikeProfileOne = CreateDikeProfile(new DikeProfile.ConstructionProperties
+ {
+ Id = id,
+ Name = name,
+ X0 = x0,
+ Orientation = orientation,
+ DikeHeight = 0.5
+ });
+
+ DikeProfile dikeProfileTwo = CreateDikeProfile(new DikeProfile.ConstructionProperties
+ {
+ Id = id,
+ Name = name,
+ X0 = x0,
+ Orientation = orientation,
+ DikeHeight = 0.3
+ });
+
+ // Call
+ bool isDikeProfileOneEqualToTwo = dikeProfileOne.Equals(dikeProfileTwo);
+ bool isDikeProfileTwoEqualToOne = dikeProfileTwo.Equals(dikeProfileOne);
+
+ // Assert
+ Assert.IsFalse(isDikeProfileOneEqualToTwo);
+ Assert.IsFalse(isDikeProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_AllPropertiesEqual_ReturnsTrue()
+ {
+ // Setup
+ DikeProfile dikeProfileOne = CreateFullyDefinedDikeProfile();
+ DikeProfile dikeProfileTwo = CreateFullyDefinedDikeProfile();
+
+ // Call
+ bool isDikeProfileOneEqualToTwo = dikeProfileOne.Equals(dikeProfileTwo);
+ bool isDikeProfileTwoEqualToOne = dikeProfileTwo.Equals(dikeProfileOne);
+
+ // Assert
+ Assert.IsTrue(isDikeProfileOneEqualToTwo);
+ Assert.IsTrue(isDikeProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_TransitivePropertyAllPropertiesEqual_ReturnsTrue()
+ {
+ // Setup
+ DikeProfile dikeProfileOne = CreateFullyDefinedDikeProfile();
+ DikeProfile dikeProfileTwo = CreateFullyDefinedDikeProfile();
+ DikeProfile dikeProfileThree = CreateFullyDefinedDikeProfile();
+
+ // Call
+ bool isDikeProfileOneEqualToTwo = dikeProfileOne.Equals(dikeProfileTwo);
+ bool isDikeProfileTwoEqualToThree = dikeProfileTwo.Equals(dikeProfileThree);
+ bool isDikeProfileOneEqualToThree = dikeProfileOne.Equals(dikeProfileThree);
+
+ // Assert
+ Assert.IsTrue(isDikeProfileOneEqualToTwo);
+ Assert.IsTrue(isDikeProfileTwoEqualToThree);
+ Assert.IsTrue(isDikeProfileOneEqualToThree);
+ }
+
+ [Test]
+ public void Equals_SameReference_ReturnsTrue()
+ {
+ // Setup
+ DikeProfile dikeProfileOne = CreateFullyDefinedDikeProfile();
+ DikeProfile dikeProfileTwo = dikeProfileOne;
+
+ // Call
+ bool isDikeProfileOneEqualToTwo = dikeProfileOne.Equals(dikeProfileTwo);
+ bool isDikeProfileTwoEqualToOne = dikeProfileTwo.Equals(dikeProfileOne);
+
+ // Assert
+ Assert.IsTrue(isDikeProfileOneEqualToTwo);
+ Assert.IsTrue(isDikeProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void GetHashCode_EqualDikeProfiles_ReturnsSameHashCode()
+ {
+ // Setup
+ DikeProfile dikeProfileOne = CreateFullyDefinedDikeProfile();
+ DikeProfile dikeProfileTwo = CreateFullyDefinedDikeProfile();
+
+ // Call
+ int hashCodeOne = dikeProfileOne.GetHashCode();
+ int hashCodeTwo = dikeProfileTwo.GetHashCode();
+
+ // Assert
+ Assert.AreEqual(hashCodeOne, hashCodeTwo);
+ }
+
+ [Test]
+ public void CopyProperties_FromDikeProfileNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ DikeProfile dikeProfile = CreateFullyDefinedDikeProfile();
+
+ // Call
+ TestDelegate call = () => dikeProfile.CopyProperties(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("fromDikeProfile", exception.ParamName);
+ }
+
+ [Test]
+ public void CopyProperties_FromDikeProfileAllPropertiesChanged_PropertiesUpdated()
+ {
+ // Setup
+ DikeProfile dikeProfileToUpdate = CreateFullyDefinedDikeProfile();
+
+ const string expectedId = "new_id";
+ const string expectedName = "new_name";
+
+ var random = new Random(21);
+ double expectedX0 = dikeProfileToUpdate.X0 + random.NextDouble();
+ var expectedOrientation = new RoundedDouble(2, (dikeProfileToUpdate.Orientation + random.NextDouble()) % 360);
+ var expectedDikeHeight = new RoundedDouble(2, dikeProfileToUpdate.DikeHeight + random.NextDouble());
+
+ double expectedBreakWaterHeight = dikeProfileToUpdate.BreakWater.Height + random.NextDouble();
+ var expectedBreakWater = new BreakWater(random.NextEnumValue(), expectedBreakWaterHeight);
+
+ var expectedForeshoreGeometry = new[]
+ {
+ new Point2D(10, 10),
+ new Point2D(15, 10)
+ };
+
+ var expectedDikeGeometry = new[]
+ {
+ new RoughnessPoint(new Point2D(10, 10), 1),
+ new RoughnessPoint(new Point2D(15, 10), 2)
+ };
+
+ var expectedWorldReferencePoint = new Point2D(13, 37);
+
+ var dikeProfileToUpdateFrom = new DikeProfile(expectedWorldReferencePoint,
+ expectedDikeGeometry,
+ expectedForeshoreGeometry,
+ expectedBreakWater,
+ new DikeProfile.ConstructionProperties
+ {
+ Id = expectedId,
+ Name = expectedName,
+ X0 = expectedX0,
+ Orientation = expectedOrientation,
+ DikeHeight = expectedDikeHeight
+ });
+
+ // Call
+ dikeProfileToUpdate.CopyProperties(dikeProfileToUpdateFrom);
+
+ // Assert
+ Assert.AreEqual(expectedWorldReferencePoint, dikeProfileToUpdate.WorldReferencePoint);
+ CollectionAssert.AreEqual(expectedForeshoreGeometry, dikeProfileToUpdate.ForeshoreGeometry);
+ CollectionAssert.AreEqual(expectedDikeGeometry, dikeProfileToUpdate.DikeGeometry);
+ Assert.AreEqual(expectedBreakWater, dikeProfileToUpdate.BreakWater);
+
+ Assert.AreEqual(expectedId, dikeProfileToUpdate.Id);
+ Assert.AreEqual(expectedName, dikeProfileToUpdate.Name);
+ Assert.AreEqual(expectedX0, dikeProfileToUpdate.X0);
+ Assert.AreEqual(expectedOrientation, dikeProfileToUpdate.Orientation);
+ Assert.AreEqual(expectedDikeHeight, dikeProfileToUpdate.DikeHeight);
+ }
+
+ ///
+ /// Creates a default with all properties set.
+ ///
+ /// A fully defined .
+ private static DikeProfile CreateFullyDefinedDikeProfile()
+ {
+ const string id = "id";
+ const string name = "What's in a name?";
+
+ const double x0 = 13.37;
+ const double orientation = 179;
+ const double dikeHeight = 10;
+
+ return CreateDikeProfile(new DikeProfile.ConstructionProperties
+ {
+ Id = id,
+ Name = name,
+ X0 = x0,
+ Orientation = orientation,
+ DikeHeight = dikeHeight
+ });
+ }
+
+ ///
+ /// Creates a with all properties set, except for the
+ /// parameters related to which
+ /// are user specified.
+ ///
+ /// The construction properties.
+ /// A with default parameters and
+ /// specified values of the .
+ /// Thrown when
+ /// is null, empty or a whitespace.
+ private static DikeProfile CreateDikeProfile(DikeProfile.ConstructionProperties properties)
+ {
+ var worldCoordinate = new Point2D(0, 0);
+ var foreshoreGeometry = new[]
+ {
+ new Point2D(0, 1),
+ new Point2D(2, 1)
+ };
+ var dikeGeometry = new[]
+ {
+ new RoughnessPoint(new Point2D(0, 1), 1),
+ new RoughnessPoint(new Point2D(1, 2), 3)
+ };
+ var breakWater = new BreakWater(BreakWaterType.Caisson, 1.3);
+
+ return new DikeProfile(worldCoordinate, dikeGeometry, foreshoreGeometry, breakWater, properties);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/ForeshoreProfileTest.cs
===================================================================
diff -u -r1f549a37af503f5da697652b5e5199f8d29ac0fe -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/ForeshoreProfileTest.cs (.../ForeshoreProfileTest.cs) (revision 1f549a37af503f5da697652b5e5199f8d29ac0fe)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/ForeshoreProfileTest.cs (.../ForeshoreProfileTest.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -35,7 +35,7 @@
public void Constructor_ValidParameters_ExpectedValues()
{
// Setup
- string validId = "id";
+ const string validId = "id";
var worldCoordinate = new Point2D(1.1, 2.2);
var foreshoreGeometry = new[]
@@ -273,10 +273,369 @@
});
// Call
- var result = foreshoreProfile.ToString();
+ string result = foreshoreProfile.ToString();
// Assert
Assert.AreEqual(testName, result);
}
+
+ [Test]
+ public void Equals_ToItself_ReturnsTrue()
+ {
+ // Setup
+ ForeshoreProfile foreshoreProfile = CreateFullyDefinedForeshoreProfile();
+
+ // Call
+ bool isEqualToItself = foreshoreProfile.Equals(foreshoreProfile);
+
+ // Assert
+ Assert.IsTrue(isEqualToItself);
+ }
+
+ [Test]
+ public void Equals_ToNull_ReturnsFalse()
+ {
+ // Setup
+ ForeshoreProfile foreshoreProfile = CreateFullyDefinedForeshoreProfile();
+
+ // Call
+ bool isForeshoreProfileEqualToNull = foreshoreProfile.Equals(null);
+
+ // Assert
+ Assert.IsFalse(isForeshoreProfileEqualToNull);
+ }
+
+ [Test]
+ public void Equal_ToDifferentType_ReturnsFalse()
+ {
+ // Setup
+ ForeshoreProfile foreshoreProfile = CreateFullyDefinedForeshoreProfile();
+ var differentType = new object();
+
+ // Call
+ bool isForeshoreProfileEqualToDifferentObject = foreshoreProfile.Equals(differentType);
+
+ // Assert
+ Assert.IsFalse(isForeshoreProfileEqualToDifferentObject);
+ }
+
+ [Test]
+ public void Equals_DifferentWorldReferencePoints_ReturnsFalse()
+ {
+ // Setup
+ ForeshoreProfile foreshoreProfileOne = CreateFullyDefinedForeshoreProfile();
+ var foreshoreProfileTwo = new ForeshoreProfile(new Point2D(13, 37),
+ foreshoreProfileOne.Geometry,
+ foreshoreProfileOne.BreakWater,
+ new ForeshoreProfile.ConstructionProperties
+ {
+ Id = foreshoreProfileOne.Id,
+ Name = foreshoreProfileOne.Name,
+ X0 = foreshoreProfileOne.X0,
+ Orientation = foreshoreProfileOne.Orientation
+ });
+
+ // Call
+ bool isForeshoreProfileOneEqualToTwo = foreshoreProfileOne.Equals(foreshoreProfileTwo);
+ bool isForeshoreProfileTwoEqualToOne = foreshoreProfileTwo.Equals(foreshoreProfileOne);
+
+ // Assert
+ Assert.IsFalse(isForeshoreProfileOneEqualToTwo);
+ Assert.IsFalse(isForeshoreProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_DifferentForeshoreGeometry_ReturnsFalse()
+ {
+ // Setup
+ ForeshoreProfile foreshoreProfileOne = CreateFullyDefinedForeshoreProfile();
+
+ var foreshoreGeometry = new[]
+ {
+ new Point2D(10, 10),
+ new Point2D(11, 11)
+ };
+ var foreshoreProfileTwo = new ForeshoreProfile(foreshoreProfileOne.WorldReferencePoint,
+ foreshoreGeometry,
+ foreshoreProfileOne.BreakWater,
+ new ForeshoreProfile.ConstructionProperties
+ {
+ Id = foreshoreProfileOne.Id,
+ Name = foreshoreProfileOne.Name,
+ X0 = foreshoreProfileOne.X0,
+ Orientation = foreshoreProfileOne.Orientation
+ });
+
+ // Call
+ bool isForeshoreProfileOneEqualToTwo = foreshoreProfileOne.Equals(foreshoreProfileTwo);
+ bool isForeshoreProfileTwoEqualToOne = foreshoreProfileTwo.Equals(foreshoreProfileOne);
+
+ // Assert
+ Assert.IsFalse(isForeshoreProfileOneEqualToTwo);
+ Assert.IsFalse(isForeshoreProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_DifferentBreakWater_ReturnsFalse()
+ {
+ // Setup
+ ForeshoreProfile foreshoreProfileOne = CreateFullyDefinedForeshoreProfile();
+ var foreshoreProfileTwo = new ForeshoreProfile(foreshoreProfileOne.WorldReferencePoint,
+ foreshoreProfileOne.Geometry,
+ null,
+ new ForeshoreProfile.ConstructionProperties
+ {
+ Id = foreshoreProfileOne.Id,
+ Name = foreshoreProfileOne.Name,
+ X0 = foreshoreProfileOne.X0,
+ Orientation = foreshoreProfileOne.Orientation
+ });
+
+ // Call
+ bool isForeshoreProfileOneEqualToTwo = foreshoreProfileOne.Equals(foreshoreProfileTwo);
+ bool isForeshoreProfileTwoEqualToOne = foreshoreProfileTwo.Equals(foreshoreProfileOne);
+
+ // Assert
+ Assert.IsFalse(isForeshoreProfileOneEqualToTwo);
+ Assert.IsFalse(isForeshoreProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_DifferentIds_ReturnsFalse()
+ {
+ // Setup
+ const string name = "Just a name";
+ const double x0 = 10.0;
+ const double orientation = 179;
+ ForeshoreProfile foreshoreProfileOne = CreateForeshoreProfile(new ForeshoreProfile.ConstructionProperties
+ {
+ Id = "id1",
+ Name = name,
+ X0 = x0,
+ Orientation = orientation
+ });
+
+ ForeshoreProfile foreshoreProfileTwo = CreateForeshoreProfile(new ForeshoreProfile.ConstructionProperties
+ {
+ Id = "id2",
+ Name = name,
+ X0 = x0,
+ Orientation = orientation
+ });
+
+ // Call
+ bool isForeshoreProfileOneEqualToTwo = foreshoreProfileOne.Equals(foreshoreProfileTwo);
+ bool isForeshoreProfileTwoEqualToOne = foreshoreProfileTwo.Equals(foreshoreProfileOne);
+
+ // Assert
+ Assert.IsFalse(isForeshoreProfileOneEqualToTwo);
+ Assert.IsFalse(isForeshoreProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_DifferentNames_ReturnsFalse()
+ {
+ // Setup
+ const string id = "id";
+ const double x0 = 10.0;
+ const double orientation = 179;
+ ForeshoreProfile foreshoreProfileOne = CreateForeshoreProfile(new ForeshoreProfile.ConstructionProperties
+ {
+ Id = id,
+ Name = "Name 1",
+ X0 = x0,
+ Orientation = orientation
+ });
+
+ ForeshoreProfile foreshoreProfileTwo = CreateForeshoreProfile(new ForeshoreProfile.ConstructionProperties
+ {
+ Id = id,
+ Name = "Name 2",
+ X0 = x0,
+ Orientation = orientation
+ });
+
+ // Call
+ bool isForeshoreProfileOneEqualToTwo = foreshoreProfileOne.Equals(foreshoreProfileTwo);
+ bool isForeshoreProfileTwoEqualToOne = foreshoreProfileTwo.Equals(foreshoreProfileOne);
+
+ // Assert
+ Assert.IsFalse(isForeshoreProfileOneEqualToTwo);
+ Assert.IsFalse(isForeshoreProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_DifferentX0_ReturnsFalse()
+ {
+ // Setup
+ const string id = "ID";
+ const string name = "Just a name";
+ const double orientation = 179;
+ ForeshoreProfile foreshoreProfileOne = CreateForeshoreProfile(new ForeshoreProfile.ConstructionProperties
+ {
+ Id = id,
+ Name = name,
+ X0 = 10.0,
+ Orientation = orientation
+ });
+
+ ForeshoreProfile foreshoreProfileTwo = CreateForeshoreProfile(new ForeshoreProfile.ConstructionProperties
+ {
+ Id = id,
+ Name = name,
+ X0 = 11.0,
+ Orientation = orientation
+ });
+
+ // Call
+ bool isForeshoreProfileOneEqualToTwo = foreshoreProfileOne.Equals(foreshoreProfileTwo);
+ bool isForeshoreProfileTwoEqualToOne = foreshoreProfileTwo.Equals(foreshoreProfileOne);
+
+ // Assert
+ Assert.IsFalse(isForeshoreProfileOneEqualToTwo);
+ Assert.IsFalse(isForeshoreProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_DifferentOrientation_ReturnsFalse()
+ {
+ // Setup
+ const string id = "ID";
+ const string name = "Just a name";
+ const double x0 = 13.37;
+ ForeshoreProfile foreshoreProfileOne = CreateForeshoreProfile(new ForeshoreProfile.ConstructionProperties
+ {
+ Id = id,
+ Name = name,
+ X0 = x0,
+ Orientation = 179
+ });
+
+ ForeshoreProfile foreshoreProfileTwo = CreateForeshoreProfile(new ForeshoreProfile.ConstructionProperties
+ {
+ Id = id,
+ Name = name,
+ X0 = x0,
+ Orientation = 180
+ });
+
+ // Call
+ bool isForeshoreProfileOneEqualToTwo = foreshoreProfileOne.Equals(foreshoreProfileTwo);
+ bool isForeshoreProfileTwoEqualToOne = foreshoreProfileTwo.Equals(foreshoreProfileOne);
+
+ // Assert
+ Assert.IsFalse(isForeshoreProfileOneEqualToTwo);
+ Assert.IsFalse(isForeshoreProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_AllPropertiesEqual_ReturnsTrue()
+ {
+ // Setup
+ ForeshoreProfile foreshoreProfileOne = CreateFullyDefinedForeshoreProfile();
+ ForeshoreProfile foreshoreProfileTwo = CreateFullyDefinedForeshoreProfile();
+
+ // Call
+ bool isForeshoreProfileOneEqualToTwo = foreshoreProfileOne.Equals(foreshoreProfileTwo);
+ bool isForeshoreProfileTwoEqualToOne = foreshoreProfileTwo.Equals(foreshoreProfileOne);
+
+ // Assert
+ Assert.IsTrue(isForeshoreProfileOneEqualToTwo);
+ Assert.IsTrue(isForeshoreProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_TransitivePropertyAllPropertiesEqual_ReturnsTrue()
+ {
+ // Setup
+ ForeshoreProfile foreshoreProfileOne = CreateFullyDefinedForeshoreProfile();
+ ForeshoreProfile foreshoreProfileTwo = CreateFullyDefinedForeshoreProfile();
+ ForeshoreProfile foreshoreProfileThree = CreateFullyDefinedForeshoreProfile();
+
+ // Call
+ bool isForeshoreProfileOneEqualToTwo = foreshoreProfileOne.Equals(foreshoreProfileTwo);
+ bool isForeshoreProfileTwoEqualToThree = foreshoreProfileTwo.Equals(foreshoreProfileThree);
+ bool isForeshoreProfileOneEqualToThree = foreshoreProfileOne.Equals(foreshoreProfileThree);
+
+ // Assert
+ Assert.IsTrue(isForeshoreProfileOneEqualToTwo);
+ Assert.IsTrue(isForeshoreProfileTwoEqualToThree);
+ Assert.IsTrue(isForeshoreProfileOneEqualToThree);
+ }
+
+ [Test]
+ public void Equals_SameReference_ReturnsTrue()
+ {
+ // Setup
+ ForeshoreProfile foreshoreProfileOne = CreateFullyDefinedForeshoreProfile();
+ ForeshoreProfile foreshoreProfileTwo = foreshoreProfileOne;
+
+ // Call
+ bool isForeshoreProfileOneEqualToTwo = foreshoreProfileOne.Equals(foreshoreProfileTwo);
+ bool isForeshoreProfileTwoEqualToOne = foreshoreProfileTwo.Equals(foreshoreProfileOne);
+
+ // Assert
+ Assert.IsTrue(isForeshoreProfileOneEqualToTwo);
+ Assert.IsTrue(isForeshoreProfileTwoEqualToOne);
+ }
+
+ [Test]
+ public void GetHashCode_EqualForeshoreProfiles_ReturnsSameHashCode()
+ {
+ // Setup
+ ForeshoreProfile foreshoreProfileOne = CreateFullyDefinedForeshoreProfile();
+ ForeshoreProfile foreshoreProfileTwo = CreateFullyDefinedForeshoreProfile();
+
+ // Call
+ int hashCodeOne = foreshoreProfileOne.GetHashCode();
+ int hashCodeTwo = foreshoreProfileTwo.GetHashCode();
+
+ // Assert
+ Assert.AreEqual(hashCodeOne, hashCodeTwo);
+ }
+
+ ///
+ /// Creates a default with all properties set.
+ ///
+ /// A fully defined .
+ private static ForeshoreProfile CreateFullyDefinedForeshoreProfile()
+ {
+ const string id = "id";
+ const string name = "What's in a name?";
+
+ const double x0 = 13.37;
+ const double orientation = 179;
+
+ return CreateForeshoreProfile(new ForeshoreProfile.ConstructionProperties
+ {
+ Id = id,
+ Name = name,
+ X0 = x0,
+ Orientation = orientation
+ });
+ }
+
+ ///
+ /// Creates a with all properties set, except for the
+ /// parameters related to which
+ /// are user specified.
+ ///
+ /// The construction properties.
+ /// A with default parameters and
+ /// specified values of the .
+ /// Thrown when
+ /// is null, empty or a whitespace.
+ private static ForeshoreProfile CreateForeshoreProfile(ForeshoreProfile.ConstructionProperties properties)
+ {
+ var worldCoordinate = new Point2D(0, 0);
+ var geometry = new[]
+ {
+ new Point2D(0, 1),
+ new Point2D(2, 1)
+ };
+ var breakWater = new BreakWater(BreakWaterType.Caisson, 1.3);
+
+ return new ForeshoreProfile(worldCoordinate, geometry, breakWater, properties);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/RoughnessPointTest.cs
===================================================================
diff -u -r30b8231f92b90ea4b05e98e3d0285368f6dfe2e4 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/RoughnessPointTest.cs (.../RoughnessPointTest.cs) (revision 30b8231f92b90ea4b05e98e3d0285368f6dfe2e4)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/RoughnessPointTest.cs (.../RoughnessPointTest.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -56,5 +56,156 @@
var exception = Assert.Throws(test);
Assert.AreEqual("point", exception.ParamName);
}
+
+ [Test]
+ public void Equals_ToItself_ReturnsTrue()
+ {
+ // Setup
+ var roughnessPoint = new RoughnessPoint(new Point2D(0, 0), 0);
+
+ // Call
+ bool isRougnessPointEqualToItself = roughnessPoint.Equals(roughnessPoint);
+
+ // Assert
+ Assert.IsTrue(isRougnessPointEqualToItself);
+ }
+
+ [Test]
+ public void Equals_ToSameReference_ReturnsTrue()
+ {
+ // Setup
+ var roughnessPointOne = new RoughnessPoint(new Point2D(0, 0), 0);
+ var roughnessPointTwo = roughnessPointOne;
+
+ // Call
+ bool isRoughnessPointOneEqualToTwo = roughnessPointOne.Equals(roughnessPointTwo);
+ bool isRoughnessPointTwoEqualToOne = roughnessPointTwo.Equals(roughnessPointOne);
+
+ // Assert
+ Assert.IsTrue(isRoughnessPointOneEqualToTwo);
+ Assert.IsTrue(isRoughnessPointTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_PropertiesEqual_ReturnsTrue()
+ {
+ // Setup
+ var geometryPoint = new Point2D(0, 0);
+ const double roughness = 3.14;
+
+ var roughnessPointOne = new RoughnessPoint(geometryPoint, roughness);
+ var roughnessPointTwo = new RoughnessPoint(geometryPoint, roughness);
+
+ // Call
+ bool isRoughnessPointOneEqualToTwo = roughnessPointOne.Equals(roughnessPointTwo);
+ bool isRoughnessPointTwoEqualToOne = roughnessPointTwo.Equals(roughnessPointOne);
+
+ // Assert
+ Assert.IsTrue(isRoughnessPointOneEqualToTwo);
+ Assert.IsTrue(isRoughnessPointTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_TransitivePropertyPropertiesEqual_ReturnsTrue()
+ {
+ // Setup
+ var geometryPoint = new Point2D(0, 0);
+ const double roughness = 3.14;
+
+ var roughnessPointOne = new RoughnessPoint(geometryPoint, roughness);
+ var roughnessPointTwo = new RoughnessPoint(geometryPoint, roughness);
+ var roughnessPointThree = new RoughnessPoint(geometryPoint, roughness);
+
+ // Call
+ bool isRoughnessPointOneEqualToTwo = roughnessPointOne.Equals(roughnessPointTwo);
+ bool isRoughnessPointTwoEqualToThree = roughnessPointTwo.Equals(roughnessPointThree);
+ bool isRoughnessPointOneEqualToThree = roughnessPointOne.Equals(roughnessPointThree);
+
+ // Assert
+ Assert.IsTrue(isRoughnessPointOneEqualToTwo);
+ Assert.IsTrue(isRoughnessPointTwoEqualToThree);
+ Assert.IsTrue(isRoughnessPointOneEqualToThree);
+ }
+
+ [Test]
+ public void Equals_DifferentGeometryPoint_ReturnsTrue()
+ {
+ // Setup
+ const double roughness = 3.14;
+
+ var roughnessPointOne = new RoughnessPoint(new Point2D(0, 0), roughness);
+ var roughnessPointTwo = new RoughnessPoint(new Point2D(1, 1), roughness);
+
+ // Call
+ bool isRoughnessPointOneEqualToTwo = roughnessPointOne.Equals(roughnessPointTwo);
+ bool isRoughnessPointTwoEqualToOne = roughnessPointTwo.Equals(roughnessPointOne);
+
+ // Assert
+ Assert.IsFalse(isRoughnessPointOneEqualToTwo);
+ Assert.IsFalse(isRoughnessPointTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_DifferentRoughness_ReturnsFalse()
+ {
+ // Setup
+ var geometryPoint = new Point2D(0, 0);
+
+ var roughnessPointOne = new RoughnessPoint(geometryPoint, 3.14);
+ var roughnessPointTwo = new RoughnessPoint(geometryPoint, 3.00);
+
+ // Call
+ bool isRoughnessPointOneEqualToTwo = roughnessPointOne.Equals(roughnessPointTwo);
+ bool isRoughnessPointTwoEqualToOne = roughnessPointTwo.Equals(roughnessPointOne);
+
+ // Assert
+ Assert.IsFalse(isRoughnessPointOneEqualToTwo);
+ Assert.IsFalse(isRoughnessPointTwoEqualToOne);
+ }
+
+ [Test]
+ public void Equals_ToNull_ReturnsTrue()
+ {
+ // Setup
+ var roughnessPoint = new RoughnessPoint(new Point2D(0, 0), 0);
+
+ // Call
+ bool isRougnessPointEqualToNull = roughnessPoint.Equals(null);
+
+ // Assert
+ Assert.IsFalse(isRougnessPointEqualToNull);
+ }
+
+ [Test]
+ public void Equals_ToDifferentType_ReturnsFalse()
+ {
+ // Setup
+ var roughnessPoint = new RoughnessPoint(new Point2D(0, 0), 0);
+ var differentType = new object();
+
+ // Call
+ bool isRougnessPointEqualToDifferentType = roughnessPoint.Equals(differentType);
+
+ // Assert
+ Assert.IsFalse(isRougnessPointEqualToDifferentType);
+ }
+
+ [Test]
+ public void GetHashCode_EqualRoughnessPoint_ReturnsSameHashCode()
+ {
+ // Setup
+ var geometryPoint = new Point2D(0, 0);
+ const double roughness = 3.14;
+
+ var roughnessPointOne = new RoughnessPoint(geometryPoint, roughness);
+ var roughnessPointTwo = new RoughnessPoint(geometryPoint, roughness);
+
+ // Call
+ int hashCodeOne = roughnessPointOne.GetHashCode();
+ int hashCodeTwo = roughnessPointTwo.GetHashCode();
+
+ // Assert
+ Assert.AreEqual(hashCodeOne, hashCodeTwo);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Exceptions/DikeProfileUpdateExceptionTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Exceptions/DikeProfileUpdateExceptionTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Exceptions/DikeProfileUpdateExceptionTest.cs (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -0,0 +1,32 @@
+// 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 Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Exceptions;
+
+namespace Ringtoets.Common.Data.Test.Exceptions
+{
+ [TestFixture]
+ public class DikeProfileUpdateExceptionTest
+ : CustomExceptionDesignGuidelinesTestFixture {}
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Exceptions/UpdateDataExceptionTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Exceptions/UpdateDataExceptionTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Exceptions/UpdateDataExceptionTest.cs (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -0,0 +1,32 @@
+// 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 Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Exceptions;
+
+namespace Ringtoets.Common.Data.Test.Exceptions
+{
+ [TestFixture]
+ public class UpdateDataExceptionTest :
+ CustomExceptionDesignGuidelinesTestFixture {}
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj
===================================================================
diff -u -rc90fad2c6d012238ac0b62e52f9820047de76ad6 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision c90fad2c6d012238ac0b62e52f9820047de76ad6)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -66,8 +66,10 @@
+
+
@@ -104,6 +106,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/UpdateDataStrategies/ReplaceDataStrategyBaseTest.cs
===================================================================
diff -u -r66239a42b315209acc4d124200c58d8be1a18195 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/UpdateDataStrategies/ReplaceDataStrategyBaseTest.cs (.../ReplaceDataStrategyBaseTest.cs) (revision 66239a42b315209acc4d124200c58d8be1a18195)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/UpdateDataStrategies/ReplaceDataStrategyBaseTest.cs (.../ReplaceDataStrategyBaseTest.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -24,6 +24,7 @@
using System.Linq;
using Core.Common.Base;
using NUnit.Framework;
+using Ringtoets.Common.Data.Exceptions;
using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.Data.UpdateDataStrategies;
@@ -64,7 +65,7 @@
// Assert
string paramName = Assert.Throws(call).ParamName;
- Assert.AreEqual("targetCollection", paramName);
+ Assert.AreEqual("targetDataCollection", paramName);
}
[Test]
@@ -112,7 +113,7 @@
}
[Test]
- public void ReplaceData_ImportedDataCollectionContainsDuplicateItems_ThrowsArgumentException()
+ public void ReplaceData_ImportedDataCollectionContainsDuplicateItems_ThrowsUpdateDataException()
{
// Setup
var strategy = new ConcreteStrategyClass(new TestFailureMechanism());
@@ -130,13 +131,14 @@
// Assert
CollectionAssert.IsEmpty(collection);
- var exception = Assert.Throws(call);
+ var exception = Assert.Throws(call);
string expectedMessage = $"TestItem moeten een unieke naam hebben. Gevonden dubbele elementen: {duplicateName}.";
Assert.AreEqual(expectedMessage, exception.Message);
+ Assert.IsInstanceOf(exception.InnerException);
}
[Test]
- public void ReplaceData_ImportedDataCollectionContainsNull_ThrowsArgumentException()
+ public void ReplaceData_ImportedDataCollectionContainsNull_ThrowsUpdateDataException()
{
// Setup
var strategy = new ConcreteStrategyClass(new TestFailureMechanism());
@@ -154,13 +156,15 @@
// Assert
CollectionAssert.IsEmpty(collection);
- Assert.Throws(call);
+
+ var exception = Assert.Throws(call);
+ Assert.IsInstanceOf(exception.InnerException);
}
[Test]
[TestCase("")]
[TestCase(" ")]
- public void ReplaceData_InvalidSourceFilePath_ThrowsArgumentException(string invalidPath)
+ public void ReplaceData_InvalidSourceFilePath_ThrowsUpdateDataException(string invalidPath)
{
// Setup
var strategy = new ConcreteStrategyClass(new TestFailureMechanism());
@@ -178,7 +182,9 @@
// Assert
CollectionAssert.IsEmpty(collection);
- Assert.Throws(call);
+
+ var exception = Assert.Throws(call);
+ Assert.IsInstanceOf(exception.InnerException);
}
[Test]
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/UpdateDataStrategies/UpdateDataStrategyBaseTest.cs
===================================================================
diff -u -r9997d3038d16fb710ffc92f95c781639d63d7855 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/UpdateDataStrategies/UpdateDataStrategyBaseTest.cs (.../UpdateDataStrategyBaseTest.cs) (revision 9997d3038d16fb710ffc92f95c781639d63d7855)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/UpdateDataStrategies/UpdateDataStrategyBaseTest.cs (.../UpdateDataStrategyBaseTest.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -24,6 +24,7 @@
using System.Linq;
using Core.Common.Base;
using NUnit.Framework;
+using Ringtoets.Common.Data.Exceptions;
using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.Data.UpdateDataStrategies;
@@ -203,7 +204,7 @@
}
[Test]
- public void UpdateTargetCollectionData_ImportedDataContainsDuplicateData_ThrowsArgumentException()
+ public void UpdateTargetCollectionData_ImportedDataContainsDuplicateData_ThrowsUpdateDataException()
{
// Setup
var collection = new TestUniqueItemCollection();
@@ -225,9 +226,10 @@
TestDelegate call = () => strategy.ConcreteUpdateData(collection, importedCollection, sourceFilePath);
// Assert
- var exception = Assert.Throws(call);
+ var exception = Assert.Throws(call);
string message = $"TestItem moeten een unieke naam hebben. Gevonden dubbele elementen: {duplicateName}.";
Assert.AreEqual(message, exception.Message);
+ Assert.IsInstanceOf(exception.InnerException);
CollectionAssert.IsEmpty(collection);
}
@@ -440,6 +442,37 @@
}
[Test]
+ public void UpdateTargetCollectionData_CollectionNotEmptyAndImportedDataHasDuplicateDefinitions_ThrowsUpdateDataException()
+ {
+ // Setup
+ const string name = "Double Defined Name";
+ var currentCollection = new[]
+ {
+ new TestItem(name)
+ };
+ var collection = new TestUniqueItemCollection();
+ collection.AddRange(currentCollection, sourceFilePath);
+
+ var importedItems = new[]
+ {
+ new TestItem(name),
+ new TestItem(name)
+ };
+
+ var strategy = new ConcreteUpdateDataStrategy(new TestFailureMechanism());
+
+ // Call
+ TestDelegate call = () => strategy.ConcreteUpdateData(collection,
+ importedItems,
+ sourceFilePath);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("Geïmporteerde data moet unieke elementen bevatten.", exception.Message);
+ Assert.IsInstanceOf(exception.InnerException);
+ }
+
+ [Test]
public void UpdateTargetCollectionData_CalledWithSameObjectReferences_ReturnsOnlyDistinctObjects()
{
// Setup
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/TestDikeProfileTest.cs
===================================================================
diff -u -rba715436cd0186ee10a1edc13d547ee27bea4c89 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/TestDikeProfileTest.cs (.../TestDikeProfileTest.cs) (revision ba715436cd0186ee10a1edc13d547ee27bea4c89)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/TestDikeProfileTest.cs (.../TestDikeProfileTest.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -75,6 +75,31 @@
}
[Test]
+ public void Constructor_WithNameAndId_ExpectedValues()
+ {
+ // Setup
+ const string name = "A";
+ const string id = "Just an id";
+
+ // Call
+ var testProfile = new TestDikeProfile(name, id);
+
+ // Assert
+ Assert.IsInstanceOf(testProfile);
+ Assert.IsNotNull(testProfile.ForeshoreProfile);
+ Assert.IsNull(testProfile.BreakWater);
+ CollectionAssert.IsEmpty(testProfile.DikeGeometry);
+ Assert.AreEqual(0, testProfile.DikeHeight.Value);
+ CollectionAssert.IsEmpty(testProfile.ForeshoreGeometry);
+ Assert.IsFalse(testProfile.HasBreakWater);
+ Assert.AreEqual(id, testProfile.Id);
+ Assert.AreEqual(name, testProfile.Name);
+ Assert.AreEqual(0, testProfile.Orientation.Value);
+ Assert.AreEqual(new Point2D(0, 0), testProfile.WorldReferencePoint);
+ Assert.AreEqual(0, testProfile.X0);
+ }
+
+ [Test]
public void Constructor_WithPoint_ExpectedValues()
{
// Setup
@@ -99,6 +124,31 @@
}
[Test]
+ public void Constructor_WithPointAndId_ExpectedValues()
+ {
+ // Setup
+ var point = new Point2D(1.1, 2.2);
+ const string id = "Just an id";
+
+ // Call
+ var testProfile = new TestDikeProfile(point, id);
+
+ // Assert
+ Assert.IsInstanceOf(testProfile);
+ Assert.IsNotNull(testProfile.ForeshoreProfile);
+ Assert.IsNull(testProfile.BreakWater);
+ CollectionAssert.IsEmpty(testProfile.DikeGeometry);
+ Assert.AreEqual(0, testProfile.DikeHeight.Value);
+ CollectionAssert.IsEmpty(testProfile.ForeshoreGeometry);
+ Assert.IsFalse(testProfile.HasBreakWater);
+ Assert.AreEqual(id, testProfile.Id);
+ Assert.AreEqual(id, testProfile.Name);
+ Assert.AreEqual(0, testProfile.Orientation.Value);
+ Assert.AreEqual(point, testProfile.WorldReferencePoint);
+ Assert.AreEqual(0, testProfile.X0);
+ }
+
+ [Test]
public void Constructor_WithNameAndPoint_ExpectedValues()
{
// Setup
@@ -127,10 +177,10 @@
public void Constructor_WithForeshoreGeometry_ExpectedValues()
{
// Setup
- IEnumerable foreshoreProfileGeometry = new []
+ IEnumerable foreshoreProfileGeometry = new[]
{
- new Point2D(0, 0),
- new Point2D(1, 1),
+ new Point2D(0, 0),
+ new Point2D(1, 1),
new Point2D(2, 2),
};
@@ -150,5 +200,63 @@
Assert.AreEqual(new Point2D(0, 0), testProfile.WorldReferencePoint);
Assert.AreEqual(0, testProfile.X0);
}
+
+ [Test]
+ public void Constructor_WithForeshoreProfileAndId_ExpectedValues()
+ {
+ // Setup
+ const string id = "Just an id";
+ IEnumerable foreshoreProfileGeometry = new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1),
+ new Point2D(2, 2),
+ };
+
+ // Call
+ var testProfile = new TestDikeProfile(foreshoreProfileGeometry, id);
+
+ // Assert
+ Assert.IsInstanceOf(testProfile);
+ Assert.IsNotNull(testProfile.ForeshoreProfile);
+ Assert.IsNull(testProfile.BreakWater);
+ CollectionAssert.IsEmpty(testProfile.DikeGeometry);
+ Assert.AreEqual(0, testProfile.DikeHeight.Value);
+ CollectionAssert.AreEqual(foreshoreProfileGeometry, testProfile.ForeshoreGeometry);
+ Assert.IsFalse(testProfile.HasBreakWater);
+ Assert.AreEqual(id, testProfile.Id);
+ Assert.AreEqual(id, testProfile.Name);
+ Assert.AreEqual(0, testProfile.Orientation.Value);
+ Assert.AreEqual(new Point2D(0, 0), testProfile.WorldReferencePoint);
+ Assert.AreEqual(0, testProfile.X0);
+ }
+
+ [Test]
+ public void Constructor_WithDikeGeometry_ExpectedValues()
+ {
+ // Setup
+ IEnumerable foreshoreProfileGeometry = new[]
+ {
+ new RoughnessPoint(new Point2D(0, 0), 5),
+ new RoughnessPoint(new Point2D(1, 1), 6),
+ new RoughnessPoint(new Point2D(2, 2), 7)
+ };
+
+ var testProfile = new TestDikeProfile(foreshoreProfileGeometry);
+
+ // Assert
+ Assert.IsInstanceOf(testProfile);
+ Assert.IsNotNull(testProfile.ForeshoreProfile);
+ Assert.IsNull(testProfile.BreakWater);
+ CollectionAssert.AreEqual(foreshoreProfileGeometry, testProfile.DikeGeometry);
+ Assert.AreEqual(0, testProfile.DikeHeight.Value);
+ CollectionAssert.IsEmpty(testProfile.ForeshoreGeometry);
+ Assert.IsFalse(testProfile.HasBreakWater);
+ Assert.AreEqual("id", testProfile.Id);
+ Assert.AreEqual("id", testProfile.Name);
+ Assert.AreEqual(0, testProfile.Orientation.Value);
+ Assert.AreEqual(new Point2D(0, 0), testProfile.WorldReferencePoint);
+ Assert.AreEqual(0, testProfile.X0);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/TestDikeProfile.cs
===================================================================
diff -u -rba715436cd0186ee10a1edc13d547ee27bea4c89 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/TestDikeProfile.cs (.../TestDikeProfile.cs) (revision ba715436cd0186ee10a1edc13d547ee27bea4c89)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/TestDikeProfile.cs (.../TestDikeProfile.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -19,6 +19,7 @@
// 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 Core.Common.Base.Geometry;
@@ -37,18 +38,42 @@
public TestDikeProfile() : this(new Point2D(0, 0)) {}
///
- /// Initializes default at the world origin.
+ /// Initializes default at the world origin
+ /// with a specified name.
///
/// The name of the dike profile.
public TestDikeProfile(string name) : this(name, new Point2D(0, 0)) {}
///
- /// Initializes default at the world location.
+ /// Initializes default at the world origin
+ /// with a specified name and ID.
///
+ /// The name of the dike profile.
+ /// The ID of the dike profile.
+ /// Thrown when is
+ /// null, empty, or consists of whitespace.
+ public TestDikeProfile(string name, string id)
+ : this(id, name, new Point2D(0, 0), Enumerable.Empty(), Enumerable.Empty()) {}
+
+ ///
+ /// Initializes default at a specified world
+ /// location.
+ ///
/// The world coordinate of the dike profile.
public TestDikeProfile(Point2D point) : this(null, point) {}
///
+ /// Initializes default at a specified world
+ /// location and ID.
+ ///
+ /// The world coordinate of the dike profile.
+ /// The ID of the dike profile.
+ /// Thrown when is
+ /// null, empty, or consists of whitespace.
+ public TestDikeProfile(Point2D point, string id)
+ : this(id, null, point, Enumerable.Empty(), Enumerable.Empty()) {}
+
+ ///
/// Initializes default at the world origin with
/// a specified foreshore profile geometry.
///
@@ -58,6 +83,17 @@
///
/// Initializes default at the world origin with
+ /// a specified foreshore profile geometry and ID.
+ ///
+ /// The geometry of the .
+ /// The ID of the dike profile.
+ /// Thrown when is
+ /// null, empty, or consists of whitespace.
+ public TestDikeProfile(IEnumerable foreshoreProfileGeometry, string id)
+ : this(id, null, new Point2D(0, 0), Enumerable.Empty(), foreshoreProfileGeometry) {}
+
+ ///
+ /// Initializes default at the world origin with
/// a specified dike profile geometry.
///
/// The geometry of the .
@@ -69,7 +105,8 @@
///
/// The name of the dike profile.
/// The world coordinate of the dike profile.
- public TestDikeProfile(string name, Point2D point) : this("id", name, point, Enumerable.Empty(), Enumerable.Empty()) {}
+ public TestDikeProfile(string name, Point2D point)
+ : this("id", name, point, Enumerable.Empty(), Enumerable.Empty()) {}
///
/// Initializes default at the world location with
@@ -80,6 +117,8 @@
/// The world coordinate of the dike profile.
/// The geometry of the dike.
/// The geometry of the .
+ /// Thrown when is
+ /// null, empty, or consists of whitespace.
private TestDikeProfile(string id, string name, Point2D point, IEnumerable dikeGeometry, IEnumerable foreshoreProfileGeometry)
: base(point, dikeGeometry, foreshoreProfileGeometry, null, new ConstructionProperties
{
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/ChangeHandlers/FailureMechanismCalculationChangeHandlerTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/ChangeHandlers/FailureMechanismCalculationChangeHandlerTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/ChangeHandlers/FailureMechanismCalculationChangeHandlerTest.cs (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -0,0 +1,205 @@
+// 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 Core.Common.Gui;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.ChangeHandlers;
+using Ringtoets.Common.IO;
+
+namespace Ringtoets.Common.Forms.Test.ChangeHandlers
+{
+ [TestFixture]
+ public class FailureMechanismCalculationChangeHandlerTest
+ {
+ [Test]
+ public void Constructor_WithoutFailureMechanism_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var inquiryHandler = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new FailureMechanismCalculationChangeHandler(null, string.Empty, inquiryHandler);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("failureMechanism", paramName);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_WithoutQuery_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var inquiryHandler = mockRepository.Stub();
+ var failureMechanism = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new FailureMechanismCalculationChangeHandler(failureMechanism, null, inquiryHandler);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("query", paramName);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_WithoutInquiryHandler_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var failureMechanism = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new FailureMechanismCalculationChangeHandler(failureMechanism, string.Empty, null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("inquiryHandler", paramName);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_WithParameters_ImplementsExpectedInterface()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var inquiryHandler = mockRepository.Stub();
+ var failureMechanism = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ // Call
+ var handler = new FailureMechanismCalculationChangeHandler(failureMechanism, string.Empty, inquiryHandler);
+
+ // Assert
+ Assert.IsInstanceOf(handler);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void RequireConfirmation_FailureMechanismWithoutCalculations_ReturnsFalse()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var inquiryHandler = mockRepository.StrictMock();
+ mockRepository.ReplayAll();
+
+ var failureMechanism = new TestFailureMechanism(Enumerable.Empty());
+
+ var handler = new FailureMechanismCalculationChangeHandler(failureMechanism, string.Empty, inquiryHandler);
+
+ // Call
+ bool requireConfirmation = handler.RequireConfirmation();
+
+ // Assert
+ Assert.IsFalse(requireConfirmation);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void RequireConfirmation_FailureMechanismWithCalculationWithoutOutput_ReturnFalse()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var inquiryHandler = mockRepository.StrictMock();
+
+ var calculation = mockRepository.StrictMock();
+ calculation.Expect(calc => calc.HasOutput).Return(false);
+ mockRepository.ReplayAll();
+
+ var failureMechanism = new TestFailureMechanism(new[]
+ {
+ calculation
+ });
+
+ var handler = new FailureMechanismCalculationChangeHandler(failureMechanism, string.Empty, inquiryHandler);
+
+ // Call
+ bool requireConfirmation = handler.RequireConfirmation();
+
+ // Assert
+ Assert.IsFalse(requireConfirmation);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void RequireConfirmation_FailureMechanismWithCalculationWithOutput_ReturnTrue()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var inquiryHandler = mockRepository.StrictMock();
+
+ var calculation = mockRepository.StrictMock();
+ calculation.Expect(calc => calc.HasOutput).Return(true);
+ mockRepository.ReplayAll();
+
+ var failureMechanism = new TestFailureMechanism(new[]
+ {
+ calculation
+ });
+
+ var handler = new FailureMechanismCalculationChangeHandler(failureMechanism, string.Empty, inquiryHandler);
+
+ // Call
+ bool requireConfirmation = handler.RequireConfirmation();
+
+ // Assert
+ Assert.IsTrue(requireConfirmation);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ [TestCase("I am a query", true)]
+ [TestCase("I am a query", false)]
+ [TestCase("", true)]
+ [TestCase("", false)]
+ [TestCase(" ", true)]
+ [TestCase(" ", false)]
+ public void InquireConfirmation_Always_ShowsConfirmationDialogReturnResultOfInquiry(string message, bool expectedResult)
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var inquiryHandler = mockRepository.StrictMock();
+ inquiryHandler.Expect(ih => ih.InquireContinuation(message)).Return(expectedResult);
+ var failureMechanism = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ var handler = new FailureMechanismCalculationChangeHandler(failureMechanism, message, inquiryHandler);
+
+ // Call
+ bool result = handler.InquireConfirmation();
+
+ // Assert
+ Assert.AreEqual(expectedResult, result);
+ mockRepository.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj
===================================================================
diff -u -rc63ac515f0ce88fbc058e1838d1a43ed6a912360 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision c63ac515f0ce88fbc058e1838d1a43ed6a912360)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -67,6 +67,7 @@
Properties\GlobalAssembly.cs
+
@@ -196,6 +197,10 @@
{4d840673-3812-4338-a352-84854e32b8a0}
Ringtoets.Common.Forms
+
+ {52BA7627-CBAB-4209-BE77-3B5F31378277}
+ Ringtoets.Common.IO
+
{d951d6da-fe83-4920-9fdb-63bf96480b54}
Ringtoets.Common.Service
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/DikeProfilesImporterTest.cs
===================================================================
diff -u -r1f549a37af503f5da697652b5e5199f8d29ac0fe -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/DikeProfilesImporterTest.cs (.../DikeProfilesImporterTest.cs) (revision 1f549a37af503f5da697652b5e5199f8d29ac0fe)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/DikeProfilesImporterTest.cs (.../DikeProfilesImporterTest.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -22,40 +22,63 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Linq;
using Core.Common.Base;
using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
using Core.Common.TestUtil;
using NUnit.Framework;
+using Rhino.Mocks;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.IO.FileImporters;
+using Ringtoets.Common.IO.FileImporters.MessageProviders;
+using Ringtoets.Common.IO.TestUtil;
namespace Ringtoets.Common.IO.Test.FileImporters
{
[TestFixture]
public class DikeProfilesImporterTest
{
+ private MockRepository mocks;
+
+ [SetUp]
+ public void Setup()
+ {
+ mocks = new MockRepository();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ mocks.VerifyAll();
+ }
+
[Test]
public void Constructor_WithValidParameters_ReturnsNewInstance()
{
// Setup
- var importTarget = new ObservableList();
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
+ var importTarget = new DikeProfileCollection();
var referenceLine = new ReferenceLine();
// Call
- var importer = new DikeProfilesImporter(importTarget, referenceLine, "");
+ var importer = new DikeProfilesImporter(importTarget, referenceLine, "", new TestDikeProfileUpdateStrategy(), messageProvider);
// Assert
- Assert.IsInstanceOf>>(importer);
+ Assert.IsInstanceOf>(importer);
}
[Test]
public void Constructor_ImportTargetNull_ThrowArgumentNullException()
{
+ // Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
// Call
- TestDelegate call = () => new DikeProfilesImporter(null, new ReferenceLine(), "");
+ TestDelegate call = () => new DikeProfilesImporter(null, new ReferenceLine(), "", new TestDikeProfileUpdateStrategy(), messageProvider);
// Assert
var exception = Assert.Throws(call);
@@ -65,8 +88,12 @@
[Test]
public void Constructor_ReferenceLineNull_ThrowArgumentNullException()
{
+ // Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
// Call
- TestDelegate call = () => new DikeProfilesImporter(new ObservableList(), null, "");
+ TestDelegate call = () => new DikeProfilesImporter(new DikeProfileCollection(), null, "", new TestDikeProfileUpdateStrategy(), messageProvider);
// Assert
var exception = Assert.Throws(call);
@@ -76,75 +103,118 @@
[Test]
public void Constructor_FilePathNull_ThrowArgumentNullException()
{
+ // Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
// Call
- TestDelegate call = () => new DikeProfilesImporter(new ObservableList(), new ReferenceLine(), null);
+ TestDelegate call = () => new DikeProfilesImporter(new DikeProfileCollection(), new ReferenceLine(), null, new TestDikeProfileUpdateStrategy(), messageProvider);
// Assert
var exception = Assert.Throws(call);
Assert.AreEqual("filePath", exception.ParamName);
}
[Test]
+ public void Constructor_UpdateStrategyNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate call = () => new DikeProfilesImporter(new DikeProfileCollection(), new ReferenceLine(), string.Empty, null, messageProvider);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("dikeProfileUpdateStrategy", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_MessageProviderNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new DikeProfilesImporter(new DikeProfileCollection(), new ReferenceLine(), string.Empty,
+ new TestDikeProfileUpdateStrategy(), null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("messageProvider", exception.ParamName);
+ }
+
+ [Test]
public void Import_FromFileWithUnmatchableId_TrueAndLogError()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO,
Path.Combine("DikeProfiles", "IpflWithUnmatchableId", "Voorlanden_12-2_UnmatchableId.shp"));
ReferenceLine referenceLine = CreateMatchingReferenceLine();
- var dikeProfiles = new ObservableList();
-
- var dikeProfilesImporter = new DikeProfilesImporter(dikeProfiles, referenceLine, filePath);
+ var dikeProfilesImporter = new DikeProfilesImporter(new DikeProfileCollection(),
+ referenceLine, filePath,
+ new TestDikeProfileUpdateStrategy(), messageProvider);
var importResult = false;
// Call
Action call = () => importResult = dikeProfilesImporter.Import();
// Assert
- TestHelper.AssertLogMessages(call, messages =>
- {
- string[] messageArray = messages.ToArray();
- string expectedMessage = "Kan geen geldige gegevens vinden voor dijkprofiellocatie met ID 'unmatchable'.";
- Assert.AreEqual(expectedMessage, messageArray[0]);
- });
+ const string expectedMessage = "Kan geen geldige gegevens vinden voor dijkprofiellocatie met ID 'unmatchable'.";
+ var expectedLogMessage = new Tuple(expectedMessage, LogLevelConstant.Error);
+ TestHelper.AssertLogMessageWithLevelIsGenerated(call, expectedLogMessage, 1);
Assert.IsTrue(importResult);
}
[Test]
public void Import_FiveDikeProfilesWithoutGeometries_TrueAndLogWarningAndNoDikeProfiles()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string fileDirectory = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin,
Path.Combine("DikeProfiles", "NoDikeProfileGeometries"));
string filePath = Path.Combine(fileDirectory, "Voorlanden 12-2.shp");
ReferenceLine referenceLine = CreateMatchingReferenceLine();
- var dikeProfiles = new ObservableList();
- var dikeProfilesImporter = new DikeProfilesImporter(dikeProfiles, referenceLine, filePath);
+ var updateStrategy = new TestDikeProfileUpdateStrategy();
+ var dikeProfilesImporter = new DikeProfilesImporter(new DikeProfileCollection(), referenceLine, filePath, updateStrategy, messageProvider);
// Call
- bool importResult = false;
+ var importResult = false;
Action call = () => importResult = dikeProfilesImporter.Import();
// Assert
- string[] expectedMessages =
+ var expectedMessages = new[]
{
- string.Format("Profielgegevens definiëren geen dijkgeometrie. Bestand '{0}' wordt overgeslagen.", Path.Combine(fileDirectory, "profiel001 - Ringtoets.prfl")),
- string.Format("Profielgegevens definiëren geen dijkgeometrie. Bestand '{0}' wordt overgeslagen.", Path.Combine(fileDirectory, "profiel002 - Ringtoets.prfl")),
- string.Format("Profielgegevens definiëren geen dijkgeometrie. Bestand '{0}' wordt overgeslagen.", Path.Combine(fileDirectory, "profiel003 - Ringtoets.prfl")),
- string.Format("Profielgegevens definiëren geen dijkgeometrie. Bestand '{0}' wordt overgeslagen.", Path.Combine(fileDirectory, "profiel004 - Ringtoets.prfl")),
- string.Format("Profielgegevens definiëren geen dijkgeometrie. Bestand '{0}' wordt overgeslagen.", Path.Combine(fileDirectory, "profiel005 - Ringtoets.prfl"))
+ Tuple.Create($"Profielgegevens definiëren geen dijkgeometrie. Bestand '{Path.Combine(fileDirectory, "profiel001 - Ringtoets.prfl")}' wordt overgeslagen.",
+ LogLevelConstant.Warn),
+ Tuple.Create($"Profielgegevens definiëren geen dijkgeometrie. Bestand '{Path.Combine(fileDirectory, "profiel002 - Ringtoets.prfl")}' wordt overgeslagen.",
+ LogLevelConstant.Warn),
+ Tuple.Create($"Profielgegevens definiëren geen dijkgeometrie. Bestand '{Path.Combine(fileDirectory, "profiel003 - Ringtoets.prfl")}' wordt overgeslagen.",
+ LogLevelConstant.Warn),
+ Tuple.Create($"Profielgegevens definiëren geen dijkgeometrie. Bestand '{Path.Combine(fileDirectory, "profiel004 - Ringtoets.prfl")}' wordt overgeslagen.",
+ LogLevelConstant.Warn),
+ Tuple.Create($"Profielgegevens definiëren geen dijkgeometrie. Bestand '{Path.Combine(fileDirectory, "profiel005 - Ringtoets.prfl")}' wordt overgeslagen.",
+ LogLevelConstant.Warn)
};
- TestHelper.AssertLogMessagesAreGenerated(call, expectedMessages);
+ TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedMessages);
Assert.IsTrue(importResult);
- Assert.AreEqual(0, dikeProfiles.Count);
+ Assert.IsTrue(updateStrategy.Updated);
+ Assert.AreEqual(0, updateStrategy.ReadDikeProfiles.Length);
}
[Test]
public void Import_OneDikeProfileLocationNotCloseEnoughToReferenceLine_TrueAndLogErrorAndFourDikeProfiles()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO,
Path.Combine("DikeProfiles", "AllOkTestData", "Voorlanden 12-2.shp"));
@@ -159,8 +229,8 @@
var referenceLine = new ReferenceLine();
referenceLine.SetGeometry(referencePoints);
- var dikeProfiles = new ObservableList();
- var dikeProfilesImporter = new DikeProfilesImporter(dikeProfiles, referenceLine, filePath);
+ var updateDataStrategy = new TestDikeProfileUpdateStrategy();
+ var dikeProfilesImporter = new DikeProfilesImporter(new DikeProfileCollection(), referenceLine, filePath, updateDataStrategy, messageProvider);
var importResult = false;
@@ -171,32 +241,40 @@
string expectedMessage = "Fout bij het lezen van profiellocatie 5. De profiellocatie met " +
"ID 'profiel005' ligt niet op de referentielijn. " +
"Dit profiel wordt overgeslagen.";
- TestHelper.AssertLogMessageIsGenerated(call, expectedMessage);
+ var expectedLogMessage = new Tuple(expectedMessage,
+ LogLevelConstant.Error);
+ TestHelper.AssertLogMessageWithLevelIsGenerated(call, expectedLogMessage, 1);
Assert.IsTrue(importResult);
- Assert.AreEqual(4, dikeProfiles.Count);
+ Assert.IsTrue(updateDataStrategy.Updated);
+ Assert.AreEqual(4, updateDataStrategy.ReadDikeProfiles.Length);
}
[Test]
public void Import_AllOkTestData_TrueAndLogMessagesAndFiveDikeProfiles()
{
// Setup
+ const string expectedAddDataToModelProgressText = "Adding data";
+ var messageProvider = mocks.StrictMock();
+ messageProvider.Expect(mp => mp.GetAddDataToModelProgressText()).Return(expectedAddDataToModelProgressText);
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO,
Path.Combine("DikeProfiles", "AllOkTestData", "Voorlanden 12-2.shp"));
ReferenceLine referenceLine = CreateMatchingReferenceLine();
var progressChangeNotifications = new List();
- var dikeProfiles = new ObservableList();
- var dikeProfilesImporter = new DikeProfilesImporter(dikeProfiles, referenceLine, filePath);
+ var updateDataStrategy = new TestDikeProfileUpdateStrategy();
+ var dikeProfilesImporter = new DikeProfilesImporter(new DikeProfileCollection(), referenceLine, filePath, updateDataStrategy, messageProvider);
dikeProfilesImporter.SetProgressChanged((description, step, steps) => { progressChangeNotifications.Add(new ProgressNotification(description, step, steps)); });
// Call
bool importResult = dikeProfilesImporter.Import();
// Assert
Assert.IsTrue(importResult);
- List expectedProgressMessages = new List
+ var expectedProgressMessages = new List
{
new ProgressNotification("Inlezen van profiellocaties uit een shapebestand.", 1, 1),
new ProgressNotification("Inlezen van profiellocatie.", 1, 5),
@@ -210,28 +288,36 @@
new ProgressNotification("Inlezen van profielgegevens.", 3, 5),
new ProgressNotification("Inlezen van profielgegevens.", 4, 5),
new ProgressNotification("Inlezen van profielgegevens.", 5, 5),
- new ProgressNotification("Geïmporteerde data toevoegen aan het toetsspoor.", 1, 1)
+ new ProgressNotification(expectedAddDataToModelProgressText, 1, 1)
};
ValidateProgressMessages(expectedProgressMessages, progressChangeNotifications);
- Assert.AreEqual(5, dikeProfiles.Count);
+
+ Assert.IsTrue(updateDataStrategy.Updated);
+ Assert.AreEqual(5, updateDataStrategy.ReadDikeProfiles.Length);
}
[Test]
public void Import_AllOkTestData_CorrectDikeProfileProperties()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO,
Path.Combine("DikeProfiles", "AllOkTestData", "Voorlanden 12-2.shp"));
ReferenceLine referenceLine = CreateMatchingReferenceLine();
- var dikeProfiles = new ObservableList();
- var dikeProfilesImporter = new DikeProfilesImporter(dikeProfiles, referenceLine, filePath);
+ var updateDataStrategy = new TestDikeProfileUpdateStrategy();
+ var dikeProfilesImporter = new DikeProfilesImporter(new DikeProfileCollection(), referenceLine, filePath, updateDataStrategy, messageProvider);
// Call
dikeProfilesImporter.Import();
// Assert
+ Assert.IsTrue(updateDataStrategy.Updated);
+
+ DikeProfile[] dikeProfiles = updateDataStrategy.ReadDikeProfiles;
DikeProfile dikeProfile1 = dikeProfiles[0];
Assert.AreEqual("profiel001", dikeProfile1.Id);
Assert.AreEqual("profiel001", dikeProfile1.Name);
@@ -266,23 +352,28 @@
public void Import_AllDamTypes_TrueAndLogMessagesAndFiveDikeProfiles()
{
// Setup
+ const string expectedAddDataToModelProgressText = "Adding data";
+ var messageProvider = mocks.Stub();
+ messageProvider.Expect(mp => mp.GetAddDataToModelProgressText()).Return(expectedAddDataToModelProgressText);
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO,
Path.Combine("DikeProfiles", "AllDamTypes", "Voorlanden 12-2.shp"));
ReferenceLine referenceLine = CreateMatchingReferenceLine();
var progressChangeNotifications = new List();
- var dikeProfiles = new ObservableList();
- var dikeProfilesImporter = new DikeProfilesImporter(dikeProfiles, referenceLine, filePath);
+ var updateDataStrategy = new TestDikeProfileUpdateStrategy();
+ var dikeProfilesImporter = new DikeProfilesImporter(new DikeProfileCollection(), referenceLine, filePath, updateDataStrategy, messageProvider);
dikeProfilesImporter.SetProgressChanged((description, step, steps) => progressChangeNotifications.Add(new ProgressNotification(description, step, steps)));
// Call
bool importResult = dikeProfilesImporter.Import();
// Assert
Assert.IsTrue(importResult);
- List expectedProgressMessages = new List
+ var expectedProgressMessages = new List
{
new ProgressNotification("Inlezen van profiellocaties uit een shapebestand.", 1, 1),
new ProgressNotification("Inlezen van profiellocatie.", 1, 5),
@@ -296,22 +387,31 @@
new ProgressNotification("Inlezen van profielgegevens.", 3, 5),
new ProgressNotification("Inlezen van profielgegevens.", 4, 5),
new ProgressNotification("Inlezen van profielgegevens.", 5, 5),
- new ProgressNotification("Geïmporteerde data toevoegen aan het toetsspoor.", 1, 1)
+ new ProgressNotification(expectedAddDataToModelProgressText, 1, 1)
};
ValidateProgressMessages(expectedProgressMessages, progressChangeNotifications);
- Assert.AreEqual(5, dikeProfiles.Count);
+ Assert.IsTrue(updateDataStrategy.Updated);
+ Assert.AreEqual(5, updateDataStrategy.ReadDikeProfiles.Length);
}
[Test]
public void Import_CancelOfImportWhileReadingProfileLocations_CancelImportAndLogs()
{
// Setup
+ const string cancelledLogMessage = "Operation Cancelled";
+
+ var mocks = new MockRepository();
+ var messageProvider = mocks.StrictMock();
+ messageProvider.Expect(mp => mp.GetCancelledLogMessageText("Dijkprofielen")).Return(cancelledLogMessage);
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO,
Path.Combine("DikeProfiles", "AllOkTestData", "Voorlanden 12-2.shp"));
ReferenceLine referenceLine = CreateMatchingReferenceLine();
- var dikeProfiles = new ObservableList();
- var dikeProfilesImporter = new DikeProfilesImporter(dikeProfiles, referenceLine, filePath);
+ var updateDataStrategy = new TestDikeProfileUpdateStrategy();
+ var dikeProfilesImporter = new DikeProfilesImporter(new DikeProfileCollection(), referenceLine, filePath,
+ updateDataStrategy, messageProvider);
dikeProfilesImporter.SetProgressChanged((description, step, steps) =>
{
if (description.Contains("Inlezen van profiellocaties uit een shapebestand."))
@@ -320,27 +420,35 @@
}
});
- bool importResult = true;
+ var importResult = true;
// Call
Action call = () => importResult = dikeProfilesImporter.Import();
// Assert
- TestHelper.AssertLogMessageIsGenerated(call, "Dijkprofielen importeren is afgebroken. Geen gegevens ingelezen.", 1);
+ var expectedLogMessage = new Tuple(cancelledLogMessage,
+ LogLevelConstant.Info);
+ TestHelper.AssertLogMessageWithLevelIsGenerated(call, expectedLogMessage, 1);
Assert.IsFalse(importResult);
- CollectionAssert.IsEmpty(dikeProfiles);
+ Assert.IsFalse(updateDataStrategy.Updated);
}
[Test]
public void Import_CancelOfImportWhileReadingDikeProfileData_CancelImportAndLogs()
{
// Setup
+ const string cancelledLogMessage = "Operation Cancelled";
+ var messageProvider = mocks.StrictMock();
+ messageProvider.Expect(mp => mp.GetCancelledLogMessageText("Dijkprofielen")).Return(cancelledLogMessage);
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO,
Path.Combine("DikeProfiles", "AllOkTestData", "Voorlanden 12-2.shp"));
ReferenceLine referenceLine = CreateMatchingReferenceLine();
- var dikeProfiles = new ObservableList();
- var dikeProfilesImporter = new DikeProfilesImporter(dikeProfiles, referenceLine, filePath);
+ var updateDataStrategy = new TestDikeProfileUpdateStrategy();
+ var dikeProfilesImporter = new DikeProfilesImporter(new DikeProfileCollection(), referenceLine, filePath,
+ updateDataStrategy, messageProvider);
dikeProfilesImporter.SetProgressChanged((description, step, steps) =>
{
if (description.Contains("Inlezen van profielgegevens uit een prfl bestand."))
@@ -349,34 +457,39 @@
}
});
- bool importResult = true;
+ var importResult = true;
// Call
Action call = () => importResult = dikeProfilesImporter.Import();
// Assert
- TestHelper.AssertLogMessageIsGenerated(call, "Dijkprofielen importeren is afgebroken. Geen gegevens ingelezen.", 1);
+ var expectedLogMessage = new Tuple(cancelledLogMessage,
+ LogLevelConstant.Info);
+ TestHelper.AssertLogMessageWithLevelIsGenerated(call, expectedLogMessage, 1);
Assert.IsFalse(importResult);
- CollectionAssert.IsEmpty(dikeProfiles);
+ Assert.IsFalse(updateDataStrategy.Updated);
}
[Test]
public void Import_ReuseOfCanceledImportToValidTargetWithValidFile_TrueAndLogMessagesAndFiveDikeProfiles()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO,
Path.Combine("DikeProfiles", "AllOkTestData", "Voorlanden 12-2.shp"));
ReferenceLine referenceLine = CreateMatchingReferenceLine();
- var dikeProfiles = new ObservableList();
- var dikeProfilesImporter = new DikeProfilesImporter(dikeProfiles, referenceLine, filePath);
+ var updateDataStrategy = new TestDikeProfileUpdateStrategy();
+ var dikeProfilesImporter = new DikeProfilesImporter(new DikeProfileCollection(), referenceLine, filePath, updateDataStrategy, messageProvider);
dikeProfilesImporter.SetProgressChanged((description, step, steps) => dikeProfilesImporter.Cancel());
- // Pre-condition
+ // Pre-condition
bool importResult = dikeProfilesImporter.Import();
Assert.IsFalse(importResult);
- CollectionAssert.IsEmpty(dikeProfiles);
+ CollectionAssert.IsEmpty(new DikeProfileCollection());
dikeProfilesImporter.SetProgressChanged(null);
@@ -385,11 +498,47 @@
// Assert
Assert.IsTrue(importResult);
- Assert.AreEqual(5, dikeProfiles.Count);
+ Assert.IsTrue(updateDataStrategy.Updated);
+ Assert.AreEqual(5, updateDataStrategy.ReadDikeProfiles.Length);
}
- private ReferenceLine CreateMatchingReferenceLine()
+ [Test]
+ public void DoPostImport_AfterImport_ObserversNotified()
{
+ // Setup
+ var messageProvider = mocks.Stub();
+ var observableA = mocks.StrictMock();
+ observableA.Expect(o => o.NotifyObservers());
+ var observableB = mocks.StrictMock();
+ observableB.Expect(o => o.NotifyObservers());
+ mocks.ReplayAll();
+
+ var updateDataStrategy = new TestDikeProfileUpdateStrategy();
+ updateDataStrategy.UpdatedInstances = new[]
+ {
+ observableA,
+ observableB
+ };
+
+ string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO,
+ Path.Combine("DikeProfiles", "AllOkTestData", "Voorlanden 12-2.shp"));
+ ReferenceLine referenceLine = CreateMatchingReferenceLine();
+
+ var importer = new DikeProfilesImporter(new DikeProfileCollection(),
+ referenceLine,
+ filePath,
+ updateDataStrategy, messageProvider);
+ importer.Import();
+
+ // Call
+ importer.DoPostImport();
+
+ // Assert
+ // Asserts done in TearDown()
+ }
+
+ private static ReferenceLine CreateMatchingReferenceLine()
+ {
var referenceLine = new ReferenceLine();
referenceLine.SetGeometry(new[]
{
@@ -402,13 +551,14 @@
return referenceLine;
}
- private static void ValidateProgressMessages(List expectedProgressMessages, List progressChangeNotifications)
+ private static void ValidateProgressMessages(List expectedProgressMessages,
+ List progressChangeNotifications)
{
Assert.AreEqual(expectedProgressMessages.Count, progressChangeNotifications.Count);
for (var i = 0; i < expectedProgressMessages.Count; i++)
{
- var notification = expectedProgressMessages[i];
- var actualNotification = progressChangeNotifications[i];
+ ProgressNotification notification = expectedProgressMessages[i];
+ ProgressNotification actualNotification = progressChangeNotifications[i];
Assert.AreEqual(notification.Text, actualNotification.Text);
Assert.AreEqual(notification.CurrentStep, actualNotification.CurrentStep);
Assert.AreEqual(notification.TotalSteps, actualNotification.TotalSteps);
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/ProfilesImporterTest.cs
===================================================================
diff -u -r7b85dbce8bcc39e824c367468892764778527ce4 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/ProfilesImporterTest.cs (.../ProfilesImporterTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/ProfilesImporterTest.cs (.../ProfilesImporterTest.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -30,9 +30,11 @@
using Core.Common.TestUtil;
using Core.Common.Utils.Builders;
using NUnit.Framework;
+using Rhino.Mocks;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.IO.DikeProfiles;
using Ringtoets.Common.IO.FileImporters;
+using Ringtoets.Common.IO.FileImporters.MessageProviders;
using CoreCommonUtilsResources = Core.Common.Utils.Properties.Resources;
namespace Ringtoets.Common.IO.Test.FileImporters
@@ -44,11 +46,29 @@
private readonly ReferenceLine testReferenceLine = new ReferenceLine();
private readonly string testFilePath = string.Empty;
+ private MockRepository mocks;
+
+ [SetUp]
+ public void Setup()
+ {
+ mocks = new MockRepository();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ mocks.VerifyAll();
+ }
+
[Test]
public void ParameteredConstructor_ExpectedValues()
{
+ // Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
// Call
- var importer = new TestProfilesImporter(testImportTarget, testReferenceLine, testFilePath);
+ var importer = new TestProfilesImporter(testImportTarget, testReferenceLine, testFilePath, messageProvider);
// Assert
Assert.IsInstanceOf(importer);
@@ -57,8 +77,12 @@
[Test]
public void ParameteredConstructor_ImportTargetNull_ThrowArgumentNullException()
{
+ // Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
// Call
- TestDelegate call = () => new TestProfilesImporter(null, testReferenceLine, testFilePath);
+ TestDelegate call = () => new TestProfilesImporter(null, testReferenceLine, testFilePath, messageProvider);
// Assert
var exception = Assert.Throws(call);
@@ -68,8 +92,12 @@
[Test]
public void ParameteredConstructor_ReferenceLineNull_ThrowArgumentNullException()
{
+ // Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
// Call
- TestDelegate call = () => new TestProfilesImporter(testImportTarget, null, testFilePath);
+ TestDelegate call = () => new TestProfilesImporter(testImportTarget, null, testFilePath, messageProvider);
// Assert
var exception = Assert.Throws(call);
@@ -79,22 +107,40 @@
[Test]
public void ParameteredConstructor_FilePathNull_ThrowArgumentNullException()
{
+ // Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
// Call
- TestDelegate call = () => new TestProfilesImporter(testImportTarget, testReferenceLine, null);
+ TestDelegate call = () => new TestProfilesImporter(testImportTarget, testReferenceLine, null, messageProvider);
// Assert
var exception = Assert.Throws(call);
Assert.AreEqual("filePath", exception.ParamName);
}
[Test]
+ public void ParameteredConstructor_MessageProviderNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new TestProfilesImporter(testImportTarget, testReferenceLine, testFilePath, null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("messageProvider", exception.ParamName);
+ }
+
+ [Test]
[TestCase("")]
[TestCase(" ")]
public void Import_FromInvalidEmptyPath_FalseAndLogError(string filePath)
{
// Setup
- var testProfilesImporter = new TestProfilesImporter(testImportTarget, testReferenceLine, filePath);
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+ var testProfilesImporter = new TestProfilesImporter(testImportTarget, testReferenceLine, filePath, messageProvider);
+
// Call
var importResult = true;
Action call = () => importResult = testProfilesImporter.Import();
@@ -114,12 +160,15 @@
public void Import_FromPathContainingInvalidPathCharacters_FalseAndLogError()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
const string filePath = "c:\\Invalid_Characters.shp";
var invalidPathChars = Path.GetInvalidPathChars();
var invalidPath = filePath.Replace('_', invalidPathChars[0]);
- var testProfilesImporter = new TestProfilesImporter(testImportTarget, testReferenceLine, invalidPath);
+ var testProfilesImporter = new TestProfilesImporter(testImportTarget, testReferenceLine, invalidPath, messageProvider);
// Call
var importResult = true;
@@ -140,9 +189,12 @@
public void Import_FromDirectoryPath_FalseAndLogError()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string folderPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin) + Path.DirectorySeparatorChar;
- var testProfilesImporter = new TestProfilesImporter(testImportTarget, testReferenceLine, folderPath);
+ var testProfilesImporter = new TestProfilesImporter(testImportTarget, testReferenceLine, folderPath, messageProvider);
// Call
var importResult = true;
@@ -169,10 +221,13 @@
public void Import_FromFileWithNonPointFeatures_FalseAndLogError(string shapeFileName)
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Core.Components.Gis.IO,
shapeFileName);
- var testProfilesImporter = new TestProfilesImporter(testImportTarget, testReferenceLine, filePath);
+ var testProfilesImporter = new TestProfilesImporter(testImportTarget, testReferenceLine, filePath, messageProvider);
// Call
var importResult = true;
@@ -197,10 +252,13 @@
string shapeFileName, string missingColumnName)
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin,
Path.Combine("DikeProfiles", shapeFileName));
- var testProfilesImporter = new TestProfilesImporter(testImportTarget, testReferenceLine, filePath);
+ var testProfilesImporter = new TestProfilesImporter(testImportTarget, testReferenceLine, filePath, messageProvider);
// Call
var importResult = true;
@@ -223,11 +281,14 @@
public void Import_FromFileWithIllegalCharactersInId_TrueAndLogError(string fileName)
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin,
Path.Combine("DikeProfiles", fileName));
ReferenceLine referenceLine = CreateMatchingReferenceLine();
- var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath);
+ var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath, messageProvider);
// Call
var importResult = true;
@@ -247,11 +308,14 @@
public void Import_FromFileWithEmptyEntryForId_TrueAndLogError()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin,
Path.Combine("DikeProfiles", "Voorlanden_12-2_EmptyId.shp"));
ReferenceLine referenceLine = CreateMatchingReferenceLine();
- var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath);
+ var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath, messageProvider);
// Call
var importResult = true;
@@ -275,10 +339,13 @@
public void Import_FromFileWithUnrelatedInvalidPrflFilesInSameFolder_TrueAndIgnoresUnrelatedFiles()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin,
Path.Combine("DikeProfiles", "OkTestDataWithUnrelatedPrfl", "Voorland 12-2.shp"));
ReferenceLine referenceLine = CreateMatchingReferenceLine();
- var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath);
+ var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath, messageProvider);
// Call
var importResult = true;
@@ -293,11 +360,14 @@
public void Import_FromFileWithEmptyEntryForX0_TrueAndLogError()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin,
Path.Combine("DikeProfiles", "Voorlanden_12-2_EmptyX0.shp"));
ReferenceLine referenceLine = CreateMatchingReferenceLine();
- var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath);
+ var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath, messageProvider);
// Call
var importResult = true;
@@ -317,6 +387,9 @@
public void Import_DikeProfileLocationsNotCloseEnoughToReferenceLine_TrueAndLogError()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin,
Path.Combine("DikeProfiles", "AllOkTestData", "Voorlanden 12-2.shp"));
@@ -330,7 +403,7 @@
};
ReferenceLine referenceLine = new ReferenceLine();
referenceLine.SetGeometry(referencePoints);
- var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath);
+ var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath, messageProvider);
// Call
var importResult = true;
@@ -348,11 +421,14 @@
public void Import_InvalidDamType_TrueAndLogMessage()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin,
Path.Combine("DikeProfiles", "InvalidDamType", "Voorlanden 12-2.shp"));
ReferenceLine referenceLine = CreateMatchingReferenceLine();
- var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath);
+ var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath, messageProvider);
// Call
var importResult = true;
@@ -372,6 +448,9 @@
public void Import_TwoPrflWithSameId_TrueAndErrorLog()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin,
Path.Combine("DikeProfiles", "TwoPrflWithSameId", "profiel001.shp"));
@@ -382,7 +461,7 @@
};
ReferenceLine referenceLine = new ReferenceLine();
referenceLine.SetGeometry(referencePoints);
- var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath);
+ var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath, messageProvider);
// Call
var importResult = true;
@@ -404,11 +483,14 @@
public void Import_FromFileWithDupplicateId_TrueAndLogWarnings()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin,
Path.Combine("DikeProfiles", "Voorlanden_12-2_same_id_3_times.shp"));
ReferenceLine referenceLine = CreateMatchingReferenceLine();
- var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath);
+ var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath, messageProvider);
// Call
var importResult = true;
@@ -429,11 +511,14 @@
public void Import_PrflWithProfileNotZero_TrueAndErrorLog()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin,
Path.Combine("DikeProfiles", "PrflWithProfileNotZero", "Voorland_12-2.shp"));
ReferenceLine referenceLine = CreateMatchingReferenceLine();
- var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath);
+ var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath, messageProvider);
// Call
var importResult = true;
@@ -453,6 +538,9 @@
public void Import_PrflIsIncomplete_FalseAndErrorLog()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin,
Path.Combine("DikeProfiles", "PrflIsIncomplete", "Voorland_12-2.shp"));
@@ -463,7 +551,7 @@
};
ReferenceLine referenceLine = new ReferenceLine();
referenceLine.SetGeometry(referencePoints);
- var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath);
+ var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath, messageProvider);
// Call
var importResult = true;
@@ -483,10 +571,13 @@
public void Import_CancelOfImportWhileReadingProfileLocations_CancelsImportAndLogs()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin,
Path.Combine("DikeProfiles", "AllOkTestData", "Voorlanden 12-2.shp"));
- var testProfilesImporter = new TestProfilesImporter(testImportTarget, testReferenceLine, filePath);
+ var testProfilesImporter = new TestProfilesImporter(testImportTarget, testReferenceLine, filePath, messageProvider);
testProfilesImporter.SetProgressChanged((description, step, steps) =>
{
if (description.Contains("Inlezen van profiellocaties uit een shapebestand."))
@@ -506,6 +597,9 @@
public void Import_CancelOfImportWhileReadingDikeProfileLocations_CancelsImportAndLogs()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin,
Path.Combine("DikeProfiles", "AllOkTestData", "Voorlanden 12-2.shp"));
@@ -516,7 +610,7 @@
new Point2D(130084.3, 543727.4)
});
- var testProfilesImporter = new TestProfilesImporter(testImportTarget, referenceLine, filePath);
+ var testProfilesImporter = new TestProfilesImporter(testImportTarget, referenceLine, filePath, messageProvider);
testProfilesImporter.SetProgressChanged((description, step, steps) =>
{
if (description.Contains("Inlezen van profielgegevens uit een prfl bestand."))
@@ -536,14 +630,19 @@
public void Import_CancelOfImportWhileCreateProfiles_ContinuesImportAndLogs()
{
// Setup
+ const string addingDataToModel = "Adding Data to Model";
+ var messageProvider = mocks.Stub();
+ messageProvider.Stub(mp => mp.GetAddDataToModelProgressText()).Return(addingDataToModel);
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin,
Path.Combine("DikeProfiles", "AllOkTestData", "Voorlanden 12-2.shp"));
ReferenceLine referenceLine = CreateMatchingReferenceLine();
- var testProfilesImporter = new TestProfilesImporter(testImportTarget, referenceLine, filePath);
+ var testProfilesImporter = new TestProfilesImporter(testImportTarget, referenceLine, filePath, messageProvider);
testProfilesImporter.SetProgressChanged((description, step, steps) =>
{
- if (description.Contains("Geïmporteerde data toevoegen aan het toetsspoor."))
+ if (description.Contains(addingDataToModel))
{
testProfilesImporter.Cancel();
}
@@ -563,6 +662,9 @@
public void Import_ReuseOfCanceledImportToValidTargetWithValidFile_True()
{
// Setup
+ var messageProvider = mocks.Stub();
+ mocks.ReplayAll();
+
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO,
Path.Combine("DikeProfiles", "AllOkTestData", "Voorlanden 12-2.shp"));
@@ -573,7 +675,7 @@
};
ReferenceLine referenceLine = new ReferenceLine();
referenceLine.SetGeometry(referencePoints);
- var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath);
+ var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath, messageProvider);
testProfilesImporter.SetProgressChanged((description, step, steps) => testProfilesImporter.Cancel());
bool importResult = testProfilesImporter.Import();
@@ -589,6 +691,44 @@
Assert.IsTrue(importResult);
}
+ [Test]
+ public void Import_AddingDataToModel_SetsProgressText()
+ {
+ // Setup
+ const string expectedProgressText = "Adding Data to model";
+ var messageProvider = mocks.StrictMock();
+ messageProvider.Expect(mp => mp.GetAddDataToModelProgressText()).Return(expectedProgressText);
+ mocks.ReplayAll();
+
+ string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO,
+ Path.Combine("DikeProfiles", "AllOkTestData", "Voorlanden 12-2.shp"));
+
+ var referencePoints = new List
+ {
+ new Point2D(130074.3, 543717.4),
+ new Point2D(130084.3, 543727.4)
+ };
+ ReferenceLine referenceLine = new ReferenceLine();
+ referenceLine.SetGeometry(referencePoints);
+ var testProfilesImporter = new TestProfilesImporter(new ObservableList(), referenceLine, filePath, messageProvider);
+
+ int callcount = 0;
+ testProfilesImporter.SetProgressChanged((description, step, steps) =>
+ {
+ if (callcount == 12)
+ {
+ Assert.AreEqual(expectedProgressText, description);
+ }
+ callcount++;
+ });
+
+ // Call
+ testProfilesImporter.Import();
+
+ // Assert
+ // Assert done in TearDown
+ }
+
private ReferenceLine CreateMatchingReferenceLine()
{
ReferenceLine referenceLine = new ReferenceLine();
@@ -605,8 +745,9 @@
private class TestProfilesImporter : ProfilesImporter>
{
- public TestProfilesImporter(ObservableList importTarget, ReferenceLine referenceLine, string filePath)
- : base(referenceLine, filePath, importTarget) {}
+ public TestProfilesImporter(ObservableList importTarget, ReferenceLine referenceLine, string filePath,
+ IImporterMessageProvider messageProvider)
+ : base(referenceLine, filePath, importTarget, messageProvider) {}
protected override void CreateProfiles(ReadResult importProfileLocationResult, ReadResult importDikeProfileDataResult) {}
@@ -619,5 +760,19 @@
}
private class TestProfile {}
+
+ private class ProgressNotification
+ {
+ public ProgressNotification(string description, int currentStep, int totalSteps)
+ {
+ Text = description;
+ CurrentStep = currentStep;
+ TotalSteps = totalSteps;
+ }
+
+ public string Text { get; private set; }
+ public int CurrentStep { get; private set; }
+ public int TotalSteps { get; private set; }
+ }
}
}
\ No newline at end of file
Fisheye: Tag 9c07cee1e1a14a24e2d949bf9b32f294f0988f1f refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil.Test/Properties/AssemblyInfo.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 9c07cee1e1a14a24e2d949bf9b32f294f0988f1f refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil.Test/Ringtoets.Common.IO.TestUtil.Test.csproj'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil.Test/TestDikeProfileUpdateStrategyTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil.Test/TestDikeProfileUpdateStrategyTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil.Test/TestDikeProfileUpdateStrategyTest.cs (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -0,0 +1,84 @@
+// 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.Collections.Generic;
+using System.Linq;
+using Core.Common.Base;
+using NUnit.Framework;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.IO.FileImporters;
+
+namespace Ringtoets.Common.IO.TestUtil.Test
+{
+ [TestFixture]
+ public class TestDikeProfileUpdateStrategyTest
+ {
+ [Test]
+ public void Constructor_CreatesNewInstance()
+ {
+ // Call
+ var strategy = new TestDikeProfileUpdateStrategy();
+
+ // Assert
+ Assert.IsInstanceOf(strategy);
+ }
+
+ [Test]
+ public void UpdateDikeProfilesWithImportedData_WithoutSettingUpdatedInstances_SetPropertiesAndReturnSetUpdatedInstances()
+ {
+ // Setup
+ var strategy = new TestDikeProfileUpdateStrategy();
+
+ const string filePath = "path/to/dikeprofiles";
+ var readDikeProfiles = new[]
+ {
+ new TestDikeProfile("Dike One"),
+ new TestDikeProfile("Dike Two"),
+ new TestDikeProfile("Dike Three")
+ };
+
+ // Call
+ strategy.UpdateDikeProfilesWithImportedData(null, readDikeProfiles, filePath);
+
+ // Assert
+ Assert.AreEqual(filePath, strategy.FilePath);
+ Assert.IsTrue(strategy.Updated);
+ CollectionAssert.AreEqual(readDikeProfiles, strategy.ReadDikeProfiles);
+ }
+
+ [Test]
+ public void UpdateDikeProfilesWithImportedData_UpdatedInstancesSet_ReturnsSetUpdatedInstances()
+ {
+ // Setup
+ IEnumerable updatedInstances = Enumerable.Empty();
+
+ var strategy = new TestDikeProfileUpdateStrategy();
+ strategy.UpdatedInstances = updatedInstances;
+
+ // Call
+ strategy.UpdateDikeProfilesWithImportedData(null, Enumerable.Empty(), string.Empty);
+
+ // Assert
+ Assert.AreSame(updatedInstances, strategy.UpdatedInstances);
+ }
+ }
+}
Index: Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil.Test/packages.config
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil.Test/packages.config (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil.Test/packages.config (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -0,0 +1,26 @@
+
+
+
+
+
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/Ringtoets.Common.IO.TestUtil.csproj
===================================================================
diff -u -r43b7d2fe7b1c4209fd2afcd985a5c1f4b7bf14e9 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/Ringtoets.Common.IO.TestUtil.csproj (.../Ringtoets.Common.IO.TestUtil.csproj) (revision 43b7d2fe7b1c4209fd2afcd985a5c1f4b7bf14e9)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/Ringtoets.Common.IO.TestUtil.csproj (.../Ringtoets.Common.IO.TestUtil.csproj) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -56,6 +56,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/TestDikeProfileUpdateStrategy.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/TestDikeProfileUpdateStrategy.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/TestDikeProfileUpdateStrategy.cs (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -0,0 +1,67 @@
+// 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.Collections.Generic;
+using System.Linq;
+using Core.Common.Base;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.IO.FileImporters;
+
+namespace Ringtoets.Common.IO.TestUtil
+{
+ ///
+ /// Implementation of a
+ /// which can be used for testing.
+ ///
+ public class TestDikeProfileUpdateStrategy : IDikeProfileUpdateDataStrategy
+ {
+ ///
+ /// Gets a value to indicate if
+ /// was called.
+ ///
+ public bool Updated { get; private set; }
+
+ ///
+ /// Gets the file path that was passed in .
+ ///
+ public string FilePath { get; private set; }
+
+ ///
+ /// Gets the dike profiles which were passed in .
+ ///
+ public DikeProfile[] ReadDikeProfiles { get; private set; }
+
+ ///
+ /// Gets or sets the updated instances that are returned by .
+ ///
+ public IEnumerable UpdatedInstances { get; set; } = Enumerable.Empty();
+
+ public IEnumerable UpdateDikeProfilesWithImportedData(DikeProfileCollection targetDataCollection,
+ IEnumerable importedDataCollection,
+ string sourceFilePath)
+ {
+ Updated = true;
+ FilePath = sourceFilePath;
+ ReadDikeProfiles = importedDataCollection.ToArray();
+ return UpdatedInstances;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanism.cs
===================================================================
diff -u -r30b8231f92b90ea4b05e98e3d0285368f6dfe2e4 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanism.cs (.../GrassCoverErosionInwardsFailureMechanism.cs) (revision 30b8231f92b90ea4b05e98e3d0285368f6dfe2e4)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanism.cs (.../GrassCoverErosionInwardsFailureMechanism.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -21,7 +21,6 @@
using System.Collections.Generic;
using System.Linq;
-using Core.Common.Base;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Data.FailureMechanism;
@@ -46,7 +45,7 @@
CalculationsGroup = new CalculationGroup(RingtoetsCommonDataResources.FailureMechanism_Calculations_DisplayName, false);
GeneralInput = new GeneralGrassCoverErosionInwardsInput();
sectionResults = new List();
- DikeProfiles = new ObservableList();
+ DikeProfiles = new DikeProfileCollection();
}
public override IEnumerable Calculations
@@ -65,7 +64,7 @@
///
/// Gets the available dike profiles for this instance.
///
- public ObservableList DikeProfiles { get; private set; }
+ public DikeProfileCollection DikeProfiles { get; private set; }
public CalculationGroup CalculationsGroup { get; private set; }
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PresentationObjects/DikeProfilesContext.cs
===================================================================
diff -u -rb2b9fdf365e70928a05c57966eeed30d9050e528 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PresentationObjects/DikeProfilesContext.cs (.../DikeProfilesContext.cs) (revision b2b9fdf365e70928a05c57966eeed30d9050e528)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PresentationObjects/DikeProfilesContext.cs (.../DikeProfilesContext.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -20,7 +20,6 @@
// All rights reserved.
using System;
-using Core.Common.Base;
using Core.Common.Controls.PresentationObjects;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.DikeProfiles;
@@ -29,19 +28,18 @@
namespace Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects
{
///
- /// This is a presentation object for for elements
- /// of type .
+ /// This is a presentation object for the .
///
- public class DikeProfilesContext : ObservableWrappedObjectContextBase>
+ public class DikeProfilesContext : ObservableWrappedObjectContextBase
{
///
/// Initializes a new instance of the class.
///
- /// The observable list of dike profiles.
+ /// The observable collection of dike profiles.
/// The parent failure mechanism.
/// The parent assessment section.
/// Thrown when any input argument is null.
- public DikeProfilesContext(ObservableList dikeProfilesList, GrassCoverErosionInwardsFailureMechanism parentFailureMechanism, IAssessmentSection parentAssessmentSection) : base(dikeProfilesList)
+ public DikeProfilesContext(DikeProfileCollection dikeProfiles, GrassCoverErosionInwardsFailureMechanism parentFailureMechanism, IAssessmentSection parentAssessmentSection) : base(dikeProfiles)
{
if (parentAssessmentSection == null)
{
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -ra39f463976dde75aa79b34ddb0b27323b95e295a -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision a39f463976dde75aa79b34ddb0b27323b95e295a)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -235,6 +235,15 @@
}
///
+ /// Looks up a localized string similar to De locatie van het bestand waaruit de dijkprofielen zijn geïmporteerd..
+ ///
+ public static string DikeProfileCollection_SourcePath_Description {
+ get {
+ return ResourceManager.GetString("DikeProfileCollection_SourcePath_Description", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to {0} - {1}.
///
public static string GrassCoverErosionInwardsChartDataFactory_Create_DataIdentifier_0_DataTypeDisplayName_1_ {
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx
===================================================================
diff -u -ra39f463976dde75aa79b34ddb0b27323b95e295a -r56ac4eb28f5fcc5b20117474e9e4030399d6806a
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision a39f463976dde75aa79b34ddb0b27323b95e295a)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -237,4 +237,7 @@
Is convergentie bereikt in de overslagdebiet berekening?
+
+ De locatie van het bestand waaruit de dijkprofielen zijn geïmporteerd.
+
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DikeProfileCollectionProperties.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DikeProfileCollectionProperties.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DikeProfileCollectionProperties.cs (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a)
@@ -0,0 +1,62 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.Utils.Attributes;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.GrassCoverErosionInwards.Forms.Properties;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses
+{
+ ///
+ /// ViewModel of for properties panel.
+ ///
+ public class DikeProfileCollectionProperties : ObjectProperties
+ {
+ ///
+ /// Instantiates a