Index: Riskeer/Integration/src/Riskeer.Integration.IO/Exporters/HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter.cs =================================================================== diff -u -r7e540f494c98fcd0c8ac3853aa6d2193d2b9440a -r9357d1815220326c14afcb27fd07ce0e20cad0c6 --- Riskeer/Integration/src/Riskeer.Integration.IO/Exporters/HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter.cs (.../HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter.cs) (revision 7e540f494c98fcd0c8ac3853aa6d2193d2b9440a) +++ Riskeer/Integration/src/Riskeer.Integration.IO/Exporters/HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter.cs (.../HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter.cs) (revision 9357d1815220326c14afcb27fd07ce0e20cad0c6) @@ -19,7 +19,10 @@ // 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.IO; +using Core.Common.Util; using Riskeer.Common.Data.Hydraulics; namespace Riskeer.Integration.IO.Exporters @@ -29,6 +32,38 @@ /// public class HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter : IFileExporter { + private readonly IEnumerable locationCalculationsForTargetProbabilities; + private readonly string folderPath; + + /// + /// Creates a new instance of . + /// + /// The collection of + /// to export. + /// The folder path to export to. + /// Thrown when + /// is null. + /// Thrown when is invalid. + /// A valid path: + /// is not empty or null, + /// does not consist out of only whitespace characters, + /// does not contain an invalid character, + /// is not too long. + /// + public HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter( + IEnumerable locationCalculationsForTargetProbabilities, + string folderPath) + { + if (locationCalculationsForTargetProbabilities == null) + { + throw new ArgumentNullException(nameof(locationCalculationsForTargetProbabilities)); + } + + IOUtils.ValidateFolderPath(folderPath); + + this.locationCalculationsForTargetProbabilities = locationCalculationsForTargetProbabilities; + this.folderPath = folderPath; + } public bool Export() { throw new System.NotImplementedException(); Index: Riskeer/Integration/test/Riskeer.Integration.IO.Test/Exporters/HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporterTest.cs =================================================================== diff -u -r7e540f494c98fcd0c8ac3853aa6d2193d2b9440a -r9357d1815220326c14afcb27fd07ce0e20cad0c6 --- Riskeer/Integration/test/Riskeer.Integration.IO.Test/Exporters/HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporterTest.cs (.../HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporterTest.cs) (revision 7e540f494c98fcd0c8ac3853aa6d2193d2b9440a) +++ Riskeer/Integration/test/Riskeer.Integration.IO.Test/Exporters/HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporterTest.cs (.../HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporterTest.cs) (revision 9357d1815220326c14afcb27fd07ce0e20cad0c6) @@ -19,8 +19,11 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; +using System.Linq; using Core.Common.Base.IO; using NUnit.Framework; +using Riskeer.Common.Data.Hydraulics; using Riskeer.Integration.IO.Exporters; namespace Riskeer.Integration.IO.Test.Exporters @@ -29,10 +32,37 @@ public class HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporterTest { [Test] + public void Constructor_LocationCalculationsForTargetProbabilitiesNull_ThrowsArgumentNullException() + { + // Call + void Call() => new HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter(null, string.Empty); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("locationCalculationsForTargetProbabilities", exception.ParamName); + } + + [Test] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] + [TestCase("C:\\Not:Valid")] + public void Constructor_InvalidFolderPath_ThrowsArgumentException(string folderPath) + { + // Call + void Call() => new HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter( + Enumerable.Empty(), folderPath); + + // Assert + Assert.Throws(Call); + } + + [Test] public void Constructor_ExpectedValues() { // Call - var exporter = new HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter(); + var exporter = new HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter( + Enumerable.Empty(), "test"); // Assert Assert.IsInstanceOf(exporter);