Index: Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataImportHelper.cs
===================================================================
diff -u -r8905298103eb01ce13dd5c1a2f267f879d4fda3e -rd27087d79e3bf708f5910f95d0e92b0dc269cebf
--- Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataImportHelper.cs (.../DataImportHelper.cs) (revision 8905298103eb01ce13dd5c1a2f267f879d4fda3e)
+++ Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataImportHelper.cs (.../DataImportHelper.cs) (revision d27087d79e3bf708f5910f95d0e92b0dc269cebf)
@@ -19,7 +19,10 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System.Collections.Generic;
using System.IO;
+using System.Linq;
+using Core.Common.Base.Geometry;
using Core.Common.Base.Service;
using Core.Common.Utils.IO;
using Ringtoets.Common.Data.AssessmentSection;
@@ -68,7 +71,11 @@
///
/// The to import on.
/// The to import on.
- /// This will import 283 failure mechanism sections.
+ ///
+ /// This will import 283 failure mechanism sections.
+ /// Imports using .
+ ///
+ ///
public static void ImportFailureMechanismSections(AssessmentSection assessmentSection, IFailureMechanism failureMechanism)
{
using (var embeddedResourceFileWriter = new EmbeddedResourceFileWriter(typeof(DataImportHelper).Assembly,
@@ -87,6 +94,50 @@
}
///
+ /// Imports the data for a given .
+ ///
+ /// The to import on.
+ /// The to import on.
+ ///
+ /// This will import the same 283 failure mechanism sections on all failure mechanisms.
+ /// Does not import using .
+ ///
+ ///
+ public static void ImportFailureMechanismSections(AssessmentSection assessmentSection, IEnumerable targetFailureMechanisms)
+ {
+ using (var embeddedResourceFileWriter = new EmbeddedResourceFileWriter(typeof(DataImportHelper).Assembly,
+ true,
+ "traject_6-3_vakken.shp",
+ "traject_6-3_vakken.dbf",
+ "traject_6-3_vakken.prj",
+ "traject_6-3_vakken.shx"))
+ {
+ IFailureMechanism[] failureMechanisms = targetFailureMechanisms.ToArray();
+ for (int i = 0; i < failureMechanisms.Length; i++)
+ {
+ if (i == 0)
+ {
+ string filePath = Path.Combine(embeddedResourceFileWriter.TargetFolderPath,
+ "traject_6-3_vakken.shp");
+ var importer = new FailureMechanismSectionsImporter(failureMechanisms[i],
+ assessmentSection.ReferenceLine,
+ filePath);
+ importer.Import();
+ }
+ else
+ {
+ // Copy same FailureMechanismSection instances to other failure mechanisms
+ foreach (FailureMechanismSection section in failureMechanisms[0].Sections)
+ {
+ FailureMechanismSection clonedSection = DeepCloneSection(section);
+ failureMechanisms[i].AddSection(clonedSection);
+ }
+ }
+ }
+ }
+ }
+
+ ///
/// Imports the for the given .
///
/// The to import on.
@@ -105,6 +156,12 @@
}
}
+ private static FailureMechanismSection DeepCloneSection(FailureMechanismSection section)
+ {
+ return new FailureMechanismSection(section.Name,
+ section.Points.Select(p => new Point2D(p.X, p.Y)));
+ }
+
#region Piping Specific Imports
///