Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/ISurfaceLineUpdateDataStrategy.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/ISurfaceLineUpdateDataStrategy.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/ISurfaceLineUpdateDataStrategy.cs (revision 92549be285a5082435e9625732cf33ff50cd60b9)
@@ -0,0 +1,52 @@
+// 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.Piping.Data;
+using Ringtoets.Piping.Primitives;
+
+namespace Ringtoets.Piping.IO.Importers
+{
+ ///
+ /// Interface describing the method of updating the data model after new surface lines
+ /// have been imported.
+ ///
+ public interface ISurfaceLineUpdateDataStrategy
+ {
+ ///
+ /// Adds the imported data to the .
+ ///
+ /// The target collection which needs to be updated.
+ /// The imported surface lines.
+ /// The source path from where the surface lines were imported from.
+ /// An of updated instances.
+ /// Thrown when any of the input parameters is null.
+ /// Thrown when applying the strategy has failed. The
+ /// is set with a more detailed explanation
+ /// of why the exception occurs.
+ IEnumerable UpdateSurfaceLinesWithImportedData(
+ RingtoetsPipingSurfaceLineCollection targetCollection,
+ IEnumerable readRingtoetsPipingSurfaceLines,
+ string sourceFilePath);
+ }
+}
Fisheye: Tag 92549be285a5082435e9625732cf33ff50cd60b9 refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/ISurfaceLineUpdateSurfaceLineStrategy.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj
===================================================================
diff -u -r36b1ab8fe4c395ade52f057cb2ce07960d04098c -r92549be285a5082435e9625732cf33ff50cd60b9
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision 36b1ab8fe4c395ade52f057cb2ce07960d04098c)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision 92549be285a5082435e9625732cf33ff50cd60b9)
@@ -56,7 +56,7 @@
-
+
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs
===================================================================
diff -u -r425a1030cf1f383e0a8f5cbd712c52c5cc2d3369 -r92549be285a5082435e9625732cf33ff50cd60b9
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs (.../PipingSurfaceLinesCsvImporter.cs) (revision 425a1030cf1f383e0a8f5cbd712c52c5cc2d3369)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs (.../PipingSurfaceLinesCsvImporter.cs) (revision 92549be285a5082435e9625732cf33ff50cd60b9)
@@ -54,7 +54,7 @@
private const string characteristicPointsFileSubExtension = ".krp";
private const string csvFileExtension = ".csv";
- private readonly ISurfaceLineUpdateSurfaceLineStrategy surfaceLineUpdateStrategy;
+ private readonly ISurfaceLineUpdateDataStrategy surfaceLineUpdateStrategy;
private readonly ILog log = LogManager.GetLogger(typeof(PipingSurfaceLinesCsvImporter));
private readonly ReferenceLine referenceLine;
@@ -71,7 +71,7 @@
public PipingSurfaceLinesCsvImporter(RingtoetsPipingSurfaceLineCollection importTarget,
ReferenceLine referenceLine,
string filePath,
- ISurfaceLineUpdateSurfaceLineStrategy surfaceLineUpdateStrategy) : base(filePath, importTarget)
+ ISurfaceLineUpdateDataStrategy surfaceLineUpdateStrategy) : base(filePath, importTarget)
{
if (importTarget == null)
{
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/RingtoetsPipingSurfaceLineReplaceDataStrategy.cs
===================================================================
diff -u -r425a1030cf1f383e0a8f5cbd712c52c5cc2d3369 -r92549be285a5082435e9625732cf33ff50cd60b9
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/RingtoetsPipingSurfaceLineReplaceDataStrategy.cs (.../RingtoetsPipingSurfaceLineReplaceDataStrategy.cs) (revision 425a1030cf1f383e0a8f5cbd712c52c5cc2d3369)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/RingtoetsPipingSurfaceLineReplaceDataStrategy.cs (.../RingtoetsPipingSurfaceLineReplaceDataStrategy.cs) (revision 92549be285a5082435e9625732cf33ff50cd60b9)
@@ -33,7 +33,7 @@
///
/// Strategy to replace the surface lines with the imported surface lines.
///
- public class RingtoetsPipingSurfaceLineReplaceDataStrategy : ISurfaceLineUpdateSurfaceLineStrategy
+ public class RingtoetsPipingSurfaceLineReplaceDataStrategy : ISurfaceLineUpdateDataStrategy
{
private readonly PipingFailureMechanism failureMechanism;
@@ -53,8 +53,8 @@
}
public IEnumerable UpdateSurfaceLinesWithImportedData(RingtoetsPipingSurfaceLineCollection targetCollection,
- IEnumerable readRingtoetsPipingSurfaceLines,
- string sourceFilePath)
+ IEnumerable readRingtoetsPipingSurfaceLines,
+ string sourceFilePath)
{
if (targetCollection == null)
{
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/RingtoetsPipingSurfaceLineUpdateStrategy.cs
===================================================================
diff -u -r393f18543bc78061b83f61fce09ca094d8fb1a05 -r92549be285a5082435e9625732cf33ff50cd60b9
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/RingtoetsPipingSurfaceLineUpdateStrategy.cs (.../RingtoetsPipingSurfaceLineUpdateStrategy.cs) (revision 393f18543bc78061b83f61fce09ca094d8fb1a05)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/RingtoetsPipingSurfaceLineUpdateStrategy.cs (.../RingtoetsPipingSurfaceLineUpdateStrategy.cs) (revision 92549be285a5082435e9625732cf33ff50cd60b9)
@@ -34,11 +34,13 @@
{
///
/// Strategy for updating the current surface lines with the imported surface lines:
- /// - Adds imported surface lines that are not part of the current collection.
- /// - Removes surface lines that are part of the current collection, but are not part of the imported surface line collection.
- /// - Updates the surface lines that are part of the current collection and are part of the imported surface line collection.
+ ///
+ /// - Adds imported surface lines that are not part of the current collection.
+ /// - Removes surface lines that are part of the current collection, but are not part of the imported surface line collection.
+ /// - Updates the surface lines that are part of the current collection and are part of the imported surface line collection.
+ ///
///
- public class RingtoetsPipingSurfaceLineUpdateDataStrategy : ISurfaceLineUpdateSurfaceLineStrategy
+ public class RingtoetsPipingSurfaceLineUpdateDataStrategy : ISurfaceLineUpdateDataStrategy
{
private readonly PipingFailureMechanism failureMechanism;
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/StochasticSoilModelUpdateDataStrategy.cs
===================================================================
diff -u -r3c3bc4318d728483de24e464ae6e15f3f02fa146 -r92549be285a5082435e9625732cf33ff50cd60b9
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/StochasticSoilModelUpdateDataStrategy.cs (.../StochasticSoilModelUpdateDataStrategy.cs) (revision 3c3bc4318d728483de24e464ae6e15f3f02fa146)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/StochasticSoilModelUpdateDataStrategy.cs (.../StochasticSoilModelUpdateDataStrategy.cs) (revision 92549be285a5082435e9625732cf33ff50cd60b9)
@@ -34,11 +34,14 @@
{
///
/// Strategy for updating the current stochastic soil models with the imported stochastic soil models.
- /// Adds stochastic soil models that are imported and are not part of current stochastic soil model collection.
- /// Removes stochastic soil models that are part of the current stochastic soil model collection, but were not
+ ///
+ /// - Adds stochastic soil models that are imported and are not part of current stochastic soil model collection.
+ /// - Removes stochastic soil models that are part of the current stochastic soil model collection, but were not
/// amongst the imported stochastic soil models.
- /// Updates stochastic soil models that are part of the current stochastic soil model collection and are also
- /// imported.
+ ///
+ /// - Updates stochastic soil models that are part of the current stochastic soil model collection and are also
+ /// imported.
+ ///
///
public class StochasticSoilModelUpdateDataStrategy : IStochasticSoilModelUpdateModelStrategy
{
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs
===================================================================
diff -u -r7ee2bf67507878c09c5c587c38e6c82e5e213720 -r92549be285a5082435e9625732cf33ff50cd60b9
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 7ee2bf67507878c09c5c587c38e6c82e5e213720)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 92549be285a5082435e9625732cf33ff50cd60b9)
@@ -971,7 +971,7 @@
private static PipingSurfaceLinesCsvImporter PipingSurfaceLinesCsvImporter(RingtoetsPipingSurfaceLinesContext context,
string filePath,
- ISurfaceLineUpdateSurfaceLineStrategy strategy)
+ ISurfaceLineUpdateDataStrategy strategy)
{
return new PipingSurfaceLinesCsvImporter(context.WrappedData,
context.AssessmentSection.ReferenceLine,
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineCollectionTest.cs
===================================================================
diff -u -r425a1030cf1f383e0a8f5cbd712c52c5cc2d3369 -r92549be285a5082435e9625732cf33ff50cd60b9
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineCollectionTest.cs (.../RingtoetsPipingSurfaceLineCollectionTest.cs) (revision 425a1030cf1f383e0a8f5cbd712c52c5cc2d3369)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineCollectionTest.cs (.../RingtoetsPipingSurfaceLineCollectionTest.cs) (revision 92549be285a5082435e9625732cf33ff50cd60b9)
@@ -41,6 +41,33 @@
}
[Test]
+ public void AddRange_SurfaceLinesWithDifferentNames_AddsSurfaceLines()
+ {
+ // Setup
+ var surfaceLinesToAdd = new[]
+ {
+ new RingtoetsPipingSurfaceLine
+ {
+ Name = "Name A"
+ },
+ new RingtoetsPipingSurfaceLine
+ {
+ Name = "Name B"
+ }
+ };
+
+ var collection = new RingtoetsPipingSurfaceLineCollection();
+ const string expectedFilePath = "other/path";
+
+ // Call
+ collection.AddRange(surfaceLinesToAdd, expectedFilePath);
+
+ // Assert
+ Assert.AreEqual(expectedFilePath, collection.SourcePath);
+ CollectionAssert.AreEqual(surfaceLinesToAdd, collection);
+ }
+
+ [Test]
public void AddRange_SurfaceLinesWithSameNames_ThrowsArgumentException()
{
// Setup
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilModelCollectionTest.cs
===================================================================
diff -u -re1a8e98d60853beefbdb8c84e70f14165680ad7b -r92549be285a5082435e9625732cf33ff50cd60b9
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilModelCollectionTest.cs (.../StochasticSoilModelCollectionTest.cs) (revision e1a8e98d60853beefbdb8c84e70f14165680ad7b)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilModelCollectionTest.cs (.../StochasticSoilModelCollectionTest.cs) (revision 92549be285a5082435e9625732cf33ff50cd60b9)
@@ -40,6 +40,27 @@
}
[Test]
+ public void AddRange_SurfaceLinesWithDifferentNames_AddsSurfaceLines()
+ {
+ // Setup
+ var stochasticSoilModelsToAdd = new[]
+ {
+ new StochasticSoilModel(5, "Model A", "segmentA"),
+ new StochasticSoilModel(6, "Model B", "segmentA")
+ };
+
+ var collection = new StochasticSoilModelCollection();
+ const string expectedFilePath = "other/path";
+
+ // Call
+ collection.AddRange(stochasticSoilModelsToAdd, expectedFilePath);
+
+ // Assert
+ Assert.AreEqual(expectedFilePath, collection.SourcePath);
+ CollectionAssert.AreEqual(stochasticSoilModelsToAdd, collection);
+ }
+
+ [Test]
public void AddRange_WithStochasticSoilModelsWithEqualNames_ThrowsArgumentException()
{
// Setup
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLinesCsvImporterTest.cs
===================================================================
diff -u -r7b85dbce8bcc39e824c367468892764778527ce4 -r92549be285a5082435e9625732cf33ff50cd60b9
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLinesCsvImporterTest.cs (.../PipingSurfaceLinesCsvImporterTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLinesCsvImporterTest.cs (.../PipingSurfaceLinesCsvImporterTest.cs) (revision 92549be285a5082435e9625732cf33ff50cd60b9)
@@ -181,7 +181,7 @@
bool importResult = importer.Import();
// Assert
- RingtoetsPipingSurfaceLine[] importTargetArray = AssertSuccesfulImport(importResult, expectedNumberOfSurfaceLines, validFilePath, surfaceLineUpdateStrategy);
+ RingtoetsPipingSurfaceLine[] importTargetArray = AssertSuccessfulImport(importResult, expectedNumberOfSurfaceLines, validFilePath, surfaceLineUpdateStrategy);
// Sample some of the imported data:
RingtoetsPipingSurfaceLine firstSurfaceLine = importTargetArray[0];
@@ -240,7 +240,7 @@
};
TestHelper.AssertLogMessagesAreGenerated(call, mesages, 4);
- RingtoetsPipingSurfaceLine[] importTargetArray = AssertSuccesfulImport(importResult, 1, validFilePath, surfaceLineUpdateStrategy);
+ RingtoetsPipingSurfaceLine[] importTargetArray = AssertSuccessfulImport(importResult, 1, validFilePath, surfaceLineUpdateStrategy);
// Sample some of the imported data:
RingtoetsPipingSurfaceLine firstSurfaceLine = importTargetArray[0];
@@ -400,7 +400,7 @@
importResult = importer.Import();
// Assert
- AssertSuccesfulImport(importResult, expectedNumberOfSurfaceLines, validFilePath, surfaceLineUpdateStrategy);
+ AssertSuccessfulImport(importResult, expectedNumberOfSurfaceLines, validFilePath, surfaceLineUpdateStrategy);
}
[Test]
@@ -610,7 +610,7 @@
TestHelper.AssertLogMessagesAreGenerated(call, expectedLogMessages, 4);
- RingtoetsPipingSurfaceLine[] importedSurfaceLines = AssertSuccesfulImport(importResult, 1, corruptPath, surfaceLineUpdateStrategy);
+ RingtoetsPipingSurfaceLine[] importedSurfaceLines = AssertSuccessfulImport(importResult, 1, corruptPath, surfaceLineUpdateStrategy);
Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "Rotterdam1"));
Assert.AreEqual(3, importedSurfaceLines.First(sl => sl.Name == "Rotterdam1").Points.Length, "First line should have been added to the model.");
}
@@ -661,7 +661,7 @@
};
TestHelper.AssertLogMessagesAreGenerated(call, expectedLogMessages, 4);
- RingtoetsPipingSurfaceLine[] importedSurfaceLines = AssertSuccesfulImport(importResult, 2, corruptPath, surfaceLineUpdateStrategy);
+ RingtoetsPipingSurfaceLine[] importedSurfaceLines = AssertSuccessfulImport(importResult, 2, corruptPath, surfaceLineUpdateStrategy);
Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "Rotterdam1"));
Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "ArtifcialLocal"));
@@ -715,7 +715,7 @@
Path.Combine(ioTestDataPath, "InvalidRow_DuplicatePointsCausingRecline.krp.csv"))
};
TestHelper.AssertLogMessagesAreGenerated(call, expectedLogMessages, 4);
- AssertSuccesfulImport(importResult, 0, path, surfaceLineUpdateStrategy);
+ AssertSuccessfulImport(importResult, 0, path, surfaceLineUpdateStrategy);
Assert.IsTrue(TestHelper.CanOpenFileForWrite(path));
}
@@ -757,7 +757,7 @@
Path.Combine(ioTestDataPath, "InvalidRow_DuplicatePointsCausingZeroLength.krp.csv"))
};
TestHelper.AssertLogMessagesAreGenerated(call, expectedLogMessages, 4);
- AssertSuccesfulImport(importResult, 0, path, surfaceLineUpdateStrategy);
+ AssertSuccessfulImport(importResult, 0, path, surfaceLineUpdateStrategy);
Assert.IsTrue(TestHelper.CanOpenFileForWrite(path));
}
@@ -798,7 +798,7 @@
nonExistingCharacteristicFile);
TestHelper.AssertLogMessageIsGenerated(call, expectedLogMessage, 3);
- AssertSuccesfulImport(importResult, 2, surfaceLinesFile, surfaceLineUpdateStrategy);
+ AssertSuccessfulImport(importResult, 2, surfaceLinesFile, surfaceLineUpdateStrategy);
}
[Test]
@@ -992,7 +992,7 @@
};
TestHelper.AssertLogMessagesAreGenerated(call, expectedLogMessages, 5);
- RingtoetsPipingSurfaceLine[] importedSurfaceLines = AssertSuccesfulImport(importResult, 2, surfaceLinesFile, surfaceLineUpdateStrategy);
+ RingtoetsPipingSurfaceLine[] importedSurfaceLines = AssertSuccessfulImport(importResult, 2, surfaceLinesFile, surfaceLineUpdateStrategy);
Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "Rotterdam1"));
Assert.AreEqual(-1.02, importedSurfaceLines.First(sl => sl.Name == "Rotterdam1").DitchPolderSide.Z, "First characteristic points definition should be added to data model.");
Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "ArtifcialLocal"));
@@ -1049,7 +1049,7 @@
};
TestHelper.AssertLogMessagesAreGenerated(call, expectedLogMessages, 6);
- RingtoetsPipingSurfaceLine[] importedSurfaceLines = AssertSuccesfulImport(importResult, 2, surfaceLinesFile, surfaceLineUpdateStrategy);
+ RingtoetsPipingSurfaceLine[] importedSurfaceLines = AssertSuccessfulImport(importResult, 2, surfaceLinesFile, surfaceLineUpdateStrategy);
Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "Rotterdam1Invalid"));
Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "ArtifcialLocal"));
@@ -1112,7 +1112,7 @@
};
TestHelper.AssertLogMessagesAreGenerated(call, expectedLogMessages, 5);
- RingtoetsPipingSurfaceLine[] importedSurfaceLines = AssertSuccesfulImport(importResult, 2, surfaceLinesPath, surfaceLineUpdateStrategy);
+ RingtoetsPipingSurfaceLine[] importedSurfaceLines = AssertSuccessfulImport(importResult, 2, surfaceLinesPath, surfaceLineUpdateStrategy);
Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "Rotterdam1"));
Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "ArtifcialLocal"));
@@ -1175,7 +1175,7 @@
};
TestHelper.AssertLogMessagesAreGenerated(call, expectedLogMessages, 5);
- RingtoetsPipingSurfaceLine[] importedSurfaceLines = AssertSuccesfulImport(importResult, 2, surfaceLinesPath, surfaceLineUpdateStrategy);
+ RingtoetsPipingSurfaceLine[] importedSurfaceLines = AssertSuccessfulImport(importResult, 2, surfaceLinesPath, surfaceLineUpdateStrategy);
Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "Rotterdam1"));
Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "ArtifcialLocal"));
@@ -1247,7 +1247,7 @@
};
TestHelper.AssertLogMessagesAreGenerated(call, expectedLogMessages);
- RingtoetsPipingSurfaceLine[] importedSurfaceLines = AssertSuccesfulImport(importResult, 2, surfaceLinesPath, surfaceLineUpdateStrategy);
+ RingtoetsPipingSurfaceLine[] importedSurfaceLines = AssertSuccessfulImport(importResult, 2, surfaceLinesPath, surfaceLineUpdateStrategy);
Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "Rotterdam1Invalid"));
Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "ArtifcialLocal"));
@@ -1341,7 +1341,7 @@
bool importResult = importer.Import();
// Assert
- RingtoetsPipingSurfaceLine[] importTargetArray = AssertSuccesfulImport(importResult, expectedNumberOfSurfaceLines, validSurfaceLinesFilePath, surfaceLineUpdateStrategy);
+ RingtoetsPipingSurfaceLine[] importTargetArray = AssertSuccessfulImport(importResult, expectedNumberOfSurfaceLines, validSurfaceLinesFilePath, surfaceLineUpdateStrategy);
// Sample some of the imported data:
RingtoetsPipingSurfaceLine firstSurfaceLine = importTargetArray[0];
@@ -1404,7 +1404,7 @@
var message = "Profielschematisatie ArtifcialLocal doorkruist de huidige referentielijn niet of op meer dan één punt en kan niet worden geïmporteerd. Dit kan komen doordat de profielschematisatie een lokaal coördinaatsysteem heeft.";
TestHelper.AssertLogMessageIsGenerated(call, message);
- RingtoetsPipingSurfaceLine[] importTargetArray = AssertSuccesfulImport(importResult, expectedNumberOfSurfaceLines, validFilePath, surfaceLineUpdateStrategy);
+ RingtoetsPipingSurfaceLine[] importTargetArray = AssertSuccessfulImport(importResult, expectedNumberOfSurfaceLines, validFilePath, surfaceLineUpdateStrategy);
// Sample some of the imported data:
RingtoetsPipingSurfaceLine firstSurfaceLine = importTargetArray[0];
@@ -1451,7 +1451,7 @@
var mesagge = "Profielschematisatie Rotterdam1 doorkruist de huidige referentielijn niet of op meer dan één punt en kan niet worden geïmporteerd.";
TestHelper.AssertLogMessageIsGenerated(call, mesagge);
- RingtoetsPipingSurfaceLine[] importTargetArray = AssertSuccesfulImport(importResult, expectedNumberOfSurfaceLines, validFilePath, surfaceLineUpdateStrategy);
+ RingtoetsPipingSurfaceLine[] importTargetArray = AssertSuccessfulImport(importResult, expectedNumberOfSurfaceLines, validFilePath, surfaceLineUpdateStrategy);
// Sample some of the imported data:
RingtoetsPipingSurfaceLine firstSurfaceLine = importTargetArray[0];
@@ -1496,7 +1496,7 @@
"ArtifcialLocal");
TestHelper.AssertLogMessageIsGenerated(call, message);
- RingtoetsPipingSurfaceLine[] importTargetArray = AssertSuccesfulImport(importResult, 1, validFilePath, surfaceLineUpdateStrategy);
+ RingtoetsPipingSurfaceLine[] importTargetArray = AssertSuccessfulImport(importResult, 1, validFilePath, surfaceLineUpdateStrategy);
// Sample some of the imported data:
RingtoetsPipingSurfaceLine firstSurfaceLine = importTargetArray[0];
@@ -1505,7 +1505,7 @@
Assert.AreEqual(427776.654093, firstSurfaceLine.StartingWorldPoint.Y);
}
- private static RingtoetsPipingSurfaceLine[] AssertSuccesfulImport(bool importResult,
+ private static RingtoetsPipingSurfaceLine[] AssertSuccessfulImport(bool importResult,
int expectedSurfaceLineCount,
string expectedFilePath,
TestSurfaceLineUpdateStrategy updateStrategy)
@@ -1534,7 +1534,7 @@
expectedPoint, actualPoint));
}
- private class TestSurfaceLineUpdateStrategy : ISurfaceLineUpdateSurfaceLineStrategy
+ private class TestSurfaceLineUpdateStrategy : ISurfaceLineUpdateDataStrategy
{
public bool Updated { get; private set; }
public string FilePath { get; private set; }
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/RingtoetsPipingSurfaceLineReplaceDataStrategyTest.cs
===================================================================
diff -u -r425a1030cf1f383e0a8f5cbd712c52c5cc2d3369 -r92549be285a5082435e9625732cf33ff50cd60b9
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/RingtoetsPipingSurfaceLineReplaceDataStrategyTest.cs (.../RingtoetsPipingSurfaceLineReplaceDataStrategyTest.cs) (revision 425a1030cf1f383e0a8f5cbd712c52c5cc2d3369)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/RingtoetsPipingSurfaceLineReplaceDataStrategyTest.cs (.../RingtoetsPipingSurfaceLineReplaceDataStrategyTest.cs) (revision 92549be285a5082435e9625732cf33ff50cd60b9)
@@ -55,7 +55,7 @@
var strategy = new RingtoetsPipingSurfaceLineReplaceDataStrategy(new PipingFailureMechanism());
// Assert
- Assert.IsInstanceOf(strategy);
+ Assert.IsInstanceOf(strategy);
}
[Test]
@@ -195,7 +195,7 @@
}
[Test]
- public void UpdateSurfaceLinesWithImportedData_CalculationWithOutputRemovedSurfaceLine_CalculationUpdatedAndReturnsAffectedObject()
+ public void UpdateSurfaceLinesWithImportedData_CalculationWithOutputSurfaceLine_CalculationUpdatedAndReturnsAffectedObject()
{
// Setup
var existingSurfaceLine = new RingtoetsPipingSurfaceLine();
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/RingtoetsPipingSurfaceLineUpdateDataStrategyTest.cs
===================================================================
diff -u -r393f18543bc78061b83f61fce09ca094d8fb1a05 -r92549be285a5082435e9625732cf33ff50cd60b9
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/RingtoetsPipingSurfaceLineUpdateDataStrategyTest.cs (.../RingtoetsPipingSurfaceLineUpdateDataStrategyTest.cs) (revision 393f18543bc78061b83f61fce09ca094d8fb1a05)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/RingtoetsPipingSurfaceLineUpdateDataStrategyTest.cs (.../RingtoetsPipingSurfaceLineUpdateDataStrategyTest.cs) (revision 92549be285a5082435e9625732cf33ff50cd60b9)
@@ -55,7 +55,7 @@
var strategy = new RingtoetsPipingSurfaceLineUpdateDataStrategy(new PipingFailureMechanism());
// Assert
- Assert.IsInstanceOf(strategy);
+ Assert.IsInstanceOf(strategy);
}
[Test]
@@ -79,7 +79,7 @@
var strategy = new RingtoetsPipingSurfaceLineUpdateDataStrategy(new PipingFailureMechanism());
// Call
- TestDelegate test = () => strategy.UpdateSurfaceLinesWithImportedData(new RingtoetsPipingSurfaceLineCollection(),
+ TestDelegate test = () => strategy.UpdateSurfaceLinesWithImportedData(new RingtoetsPipingSurfaceLineCollection(),
null,
string.Empty);
@@ -95,7 +95,7 @@
var strategy = new RingtoetsPipingSurfaceLineUpdateDataStrategy(new PipingFailureMechanism());
// Call
- TestDelegate test = () => strategy.UpdateSurfaceLinesWithImportedData(new RingtoetsPipingSurfaceLineCollection(),
+ TestDelegate test = () => strategy.UpdateSurfaceLinesWithImportedData(new RingtoetsPipingSurfaceLineCollection(),
Enumerable.Empty(),
null);
@@ -141,15 +141,27 @@
{
// Setup
const string duplicateName = "Duplicate name it is";
- var targetCollection = new RingtoetsPipingSurfaceLineCollection();
- targetCollection.AddRange(new[]
+
+ var expectedSurfaceLine = new RingtoetsPipingSurfaceLine
{
- new RingtoetsPipingSurfaceLine
- {
- Name = duplicateName
- }
- }, sourceFilePath);
+ Name = duplicateName
+ };
+ Point3D[] expectedGeometry =
+ {
+ new Point3D(0, 1, 2),
+ new Point3D(3, 4, 5),
+ new Point3D(6, 7, 8)
+ };
+ expectedSurfaceLine.SetGeometry(expectedGeometry);
+ var expectedCollection = new[]
+ {
+ expectedSurfaceLine
+ };
+
+ var targetCollection = new RingtoetsPipingSurfaceLineCollection();
+ targetCollection.AddRange(expectedCollection, sourceFilePath);
+
RingtoetsPipingSurfaceLine[] importedSurfaceLines =
{
new RingtoetsPipingSurfaceLine
@@ -173,6 +185,11 @@
var exception = Assert.Throws(call);
Assert.AreEqual("Het bijwerken van de profielschematisaties is mislukt.", exception.Message);
Assert.IsInstanceOf(exception.InnerException);
+
+ CollectionAssert.AreEqual(expectedCollection, targetCollection);
+ RingtoetsPipingSurfaceLine actualSurfaceLine = targetCollection[0];
+ Assert.AreEqual(expectedSurfaceLine.Name, actualSurfaceLine.Name);
+ CollectionAssert.AreEqual(expectedGeometry, actualSurfaceLine.Points);
}
[Test]
@@ -249,37 +266,5 @@
targetSurfaceLine
}, affectedObjects);
}
-
- [Test]
- public void UpdateSurfaceLinesWithImportedData_ImportedDataContainsDuplicateNames_ThrowsUpdateException()
- {
- // Setup
- const string duplicateName = "Duplicate name it is";
- RingtoetsPipingSurfaceLine[] importedSurfaceLines =
- {
- new RingtoetsPipingSurfaceLine
- {
- Name = duplicateName
- },
- new RingtoetsPipingSurfaceLine
- {
- Name = duplicateName
- }
- };
-
- var failureMechanism = new PipingFailureMechanism();
- var strategy = new RingtoetsPipingSurfaceLineReplaceDataStrategy(failureMechanism);
-
- // Call
- TestDelegate call = () => strategy.UpdateSurfaceLinesWithImportedData(failureMechanism.SurfaceLines,
- importedSurfaceLines,
- sourceFilePath);
-
- // Assert
- var exception = Assert.Throws(call);
- string expectedMessage = $"Profielschematisaties moeten een unieke naam hebben. Gevonden dubbele namen: {duplicateName}.";
- Assert.AreEqual(expectedMessage, exception.Message);
- Assert.IsInstanceOf(exception.InnerException);
- }
}
}
\ No newline at end of file