Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r0d98073e4ba2bdc6b69b7f875508488d1fa0148a -r3865311e0dac61da3aa9ca1b4645c16b90290f1e
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 0d98073e4ba2bdc6b69b7f875508488d1fa0148a)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -1047,6 +1047,16 @@
}
///
+ /// Looks up a localized string similar to {0} Er zijn geen hydraulische randvoorwaarden locaties geëxporteerd..
+ ///
+ public static string HydraulicBoundaryLocationsExporter_Error_Exception_0_no_HydraulicBoundaryLocations_exported {
+ get {
+ return ResourceManager.GetString("HydraulicBoundaryLocationsExporter_Error_Exception_0_no_HydraulicBoundaryLocation" +
+ "s_exported", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
public static System.Drawing.Bitmap InputFolderIcon {
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx
===================================================================
diff -u -r0d98073e4ba2bdc6b69b7f875508488d1fa0148a -r3865311e0dac61da3aa9ca1b4645c16b90290f1e
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 0d98073e4ba2bdc6b69b7f875508488d1fa0148a)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -565,6 +565,9 @@
Voorlandgeometrie
+
+ {0} Er zijn geen hydraulische randvoorwaarden locaties geëxporteerd.
+
Invoer
Index: Ringtoets/Common/src/Ringtoets.Common.IO/HydraulicBoundaryLocationsExporter.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.IO/HydraulicBoundaryLocationsExporter.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/HydraulicBoundaryLocationsExporter.cs (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -0,0 +1,92 @@
+// 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.IO;
+using Core.Common.IO.Exceptions;
+using Core.Common.Utils;
+using log4net;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.HydraRing.IO;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Common.IO
+{
+ ///
+ /// Exports hydraulic boundary locations and stores them as a shapefile.
+ ///
+ public class HydraulicBoundaryLocationsExporter : IFileExporter
+ {
+ private static readonly ILog log = LogManager.GetLogger(typeof(HydraulicBoundaryLocationsExporter));
+
+ private readonly IEnumerable hydraulicBoundaryLocations;
+ private readonly string filePath;
+ private readonly string designWaterLevelName;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The hydraulic boundary locations to export.
+ /// The path of the file to export to.
+ /// The Dutch name of the content of the
+ /// property.
+ /// Thrown when
+ /// or is null.
+ /// Thrown when is invalid.
+ public HydraulicBoundaryLocationsExporter(IEnumerable hydraulicBoundaryLocations,
+ string filePath, string designWaterLevelName)
+ {
+ if (hydraulicBoundaryLocations == null)
+ {
+ throw new ArgumentNullException("hydraulicBoundaryLocations");
+ }
+
+ if (designWaterLevelName == null)
+ {
+ throw new ArgumentNullException("designWaterLevelName");
+ }
+
+ FileUtils.ValidateFilePath(filePath);
+
+ this.hydraulicBoundaryLocations = hydraulicBoundaryLocations;
+ this.filePath = filePath;
+ this.designWaterLevelName = designWaterLevelName;
+ }
+
+ public bool Export()
+ {
+ var hydraulicBoundaryLocationsWriter = new HydraulicBoundaryLocationsWriter(designWaterLevelName);
+
+ try
+ {
+ hydraulicBoundaryLocationsWriter.WriteHydraulicBoundaryLocations(hydraulicBoundaryLocations, filePath);
+ }
+ catch (CriticalFileWriteException e)
+ {
+ log.ErrorFormat(RingtoetsCommonFormsResources.HydraulicBoundaryLocationsExporter_Error_Exception_0_no_HydraulicBoundaryLocations_exported, e.Message);
+ return false;
+ }
+
+ return true;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj
===================================================================
diff -u -r1d1714a744afa41c6da4d755e44d16f4dca7a355 -r3865311e0dac61da3aa9ca1b4645c16b90290f1e
--- Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 1d1714a744afa41c6da4d755e44d16f4dca7a355)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -50,6 +50,7 @@
+
@@ -102,6 +103,16 @@
Core.Components.Gis
False
+
+ {70f8cc9c-5bc8-4fb2-b201-eae7fa8088c2}
+ Ringtoets.HydraRing.Data
+ False
+
+
+ {B69D5B6C-6E14-4FA9-9EBC-8F97678CDB70}
+ Ringtoets.HydraRing.IO
+ False
+
{d4200f43-3f72-4f42-af0a-8ced416a38ec}
Ringtoets.Common.Data
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/HydraulicBoundaryLocationsExporterTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/HydraulicBoundaryLocationsExporterTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/HydraulicBoundaryLocationsExporterTest.cs (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -0,0 +1,186 @@
+// 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.IO;
+using System.Security.AccessControl;
+using Core.Common.Base.Data;
+using Core.Common.Base.IO;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.HydraRing.Data;
+
+namespace Ringtoets.Common.IO.Test
+{
+ public class HydraulicBoundaryLocationsExporterTest
+ {
+ [Test]
+ public void ParameteredConstructor_ValidParameters_ExpectedValues()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(123, "aName", 1.1, 2.2)
+ {
+ DesignWaterLevel = (RoundedDouble) 111.111,
+ WaveHeight = (RoundedDouble) 222.222
+ };
+
+ string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.IO, "test.shp");
+
+ // Call
+ var hydraulicBoundaryLocationsExporter = new HydraulicBoundaryLocationsExporter(new[]
+ {
+ hydraulicBoundaryLocation
+ }, filePath, "aName");
+
+ // Assert
+ Assert.IsInstanceOf(hydraulicBoundaryLocationsExporter);
+ }
+
+ [Test]
+ public void ParameteredConstructor_HydraulicBoundaryLocationsNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.IO, "test.shp");
+
+ // Call
+ TestDelegate call = () => new HydraulicBoundaryLocationsExporter(null, filePath, "aName");
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("hydraulicBoundaryLocations", exception.ParamName);
+ }
+
+ [Test]
+ public void ParameteredConstructor_FilePathNull_ThrowArgumentException()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(123, "aName", 1.1, 2.2)
+ {
+ DesignWaterLevel = (RoundedDouble) 111.111,
+ WaveHeight = (RoundedDouble) 222.222
+ };
+
+ // Call
+ TestDelegate call = () => new HydraulicBoundaryLocationsExporter(new[]
+ {
+ hydraulicBoundaryLocation
+ }, null, "aName");
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ [Test]
+ public void ParameteredConstructor_DesignWaterLevelNameNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(123, "aName", 1.1, 2.2)
+ {
+ DesignWaterLevel = (RoundedDouble) 111.111,
+ WaveHeight = (RoundedDouble) 222.222
+ };
+
+ string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.IO, "test.shp");
+
+ // Call
+ TestDelegate call = () => new HydraulicBoundaryLocationsExporter(new[]
+ {
+ hydraulicBoundaryLocation
+ }, filePath, null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("designWaterLevelName", exception.ParamName);
+ }
+
+ [Test]
+ public void Export_ValidData_ReturnTrue()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(123, "aName", 1.1, 2.2)
+ {
+ DesignWaterLevel = (RoundedDouble) 111.111,
+ WaveHeight = (RoundedDouble) 222.222
+ };
+
+ string directoryPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.IO,
+ "Export_ValidData_ReturnTrue");
+ Directory.CreateDirectory(directoryPath);
+ string filePath = Path.Combine(directoryPath, "test.shp");
+
+ var exporter = new HydraulicBoundaryLocationsExporter(new[]
+ {
+ hydraulicBoundaryLocation
+ }, filePath, "aName");
+
+ bool isExported;
+ try
+ {
+ // Call
+ isExported = exporter.Export();
+ }
+ finally
+ {
+ Directory.Delete(directoryPath, true);
+ }
+
+ // Assert
+ Assert.IsTrue(isExported);
+ }
+
+ [Test]
+ public void Export_InvalidDirectoryRights_LogErrorAndReturnFalse()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(123, "aName", 1.1, 2.2)
+ {
+ DesignWaterLevel = (RoundedDouble) 111.111,
+ WaveHeight = (RoundedDouble) 222.222
+ };
+
+ string directoryPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.IO,
+ "Export_InvalidDirectoryRights_LogErrorAndReturnFalse");
+ Directory.CreateDirectory(directoryPath);
+ string filePath = Path.Combine(directoryPath, "test.shp");
+
+ var exporter = new HydraulicBoundaryLocationsExporter(new[]
+ {
+ hydraulicBoundaryLocation
+ }, filePath, "aName");
+
+ try
+ {
+ using (new DirectoryPermissionsRevoker(directoryPath, FileSystemRights.Write))
+ {
+ // Call
+ var isExported = exporter.Export();
+
+ // Assert
+ Assert.IsFalse(isExported);
+ }
+ }
+ finally
+ {
+ Directory.Delete(directoryPath, true);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj
===================================================================
diff -u -r3d84064b23186da3fb11f19ff0d07f41e1209bbb -r3865311e0dac61da3aa9ca1b4645c16b90290f1e
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision 3d84064b23186da3fb11f19ff0d07f41e1209bbb)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -55,6 +55,7 @@
+
@@ -81,6 +82,10 @@
{d749ee4c-ce50-4c17-bf01-9a953028c126}
Core.Common.TestUtil
+
+ {70f8cc9c-5bc8-4fb2-b201-eae7fa8088c2}
+ Ringtoets.HydraRing.Data
+
{d4200f43-3f72-4f42-af0a-8ced416a38ec}
Ringtoets.Common.Data
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs
===================================================================
diff -u -r3923884225f5ae288c5b78738ebd37f935c97095 -r3865311e0dac61da3aa9ca1b4645c16b90290f1e
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 3923884225f5ae288c5b78738ebd37f935c97095)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -34,13 +34,15 @@
using Ringtoets.Common.Forms.GuiServices;
using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Common.Forms.TreeNodeInfos;
+using Ringtoets.Common.IO;
using Ringtoets.GrassCoverErosionOutwards.Data;
using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects;
using Ringtoets.GrassCoverErosionOutwards.Forms.Properties;
using Ringtoets.GrassCoverErosionOutwards.Forms.PropertyClasses;
using Ringtoets.GrassCoverErosionOutwards.Forms.Views;
using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+using RingtoetsCommonIoResources = Ringtoets.Common.IO.Properties.Resources;
namespace Ringtoets.GrassCoverErosionOutwards.Plugin
{
@@ -133,6 +135,18 @@
};
}
+ public override IEnumerable GetExportInfos()
+ {
+ yield return new ExportInfo
+ {
+ CreateFileExporter = (context, filePath) =>
+ new HydraulicBoundaryLocationsExporter(context.WrappedData.GrassCoverErosionOutwardsHydraulicBoundaryLocations,
+ filePath, "Waterstand bij doorsnede-eis"),
+ IsEnabled = context => context.WrappedData.GrassCoverErosionOutwardsHydraulicBoundaryLocations.Count > 0,
+ FileFilter = RingtoetsCommonIoResources.DataTypeDisplayName_shape_file_filter
+ };
+ }
+
public override void Activate()
{
base.Activate();
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/Ringtoets.GrassCoverErosionOutwards.Plugin.csproj
===================================================================
diff -u -rf2be29fe8c407a4f32cb1bfcbaf4816c1f99c83f -r3865311e0dac61da3aa9ca1b4645c16b90290f1e
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/Ringtoets.GrassCoverErosionOutwards.Plugin.csproj (.../Ringtoets.GrassCoverErosionOutwards.Plugin.csproj) (revision f2be29fe8c407a4f32cb1bfcbaf4816c1f99c83f)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/Ringtoets.GrassCoverErosionOutwards.Plugin.csproj (.../Ringtoets.GrassCoverErosionOutwards.Plugin.csproj) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -80,6 +80,11 @@
Ringtoets.Common.Forms
False
+
+ {52ba7627-cbab-4209-be77-3b5f31378277}
+ Ringtoets.Common.IO
+ False
+
{70f8cc9c-5bc8-4fb2-b201-eae7fa8088c2}
Ringtoets.HydraRing.Data
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs
===================================================================
diff -u -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 -r3865311e0dac61da3aa9ca1b4645c16b90290f1e
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs (.../GrassCoverErosionOutwardsPluginTest.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs (.../GrassCoverErosionOutwardsPluginTest.cs) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -118,5 +118,23 @@
Assert.IsNull(waveHeightLocationContextProperties.AfterCreate);
}
}
+
+ [Test]
+ public void GetExportInfos_ReturnsSupportedExportInfos()
+ {
+ // Setup
+ using (var plugin = new GrassCoverErosionOutwardsPlugin())
+ {
+ // Call
+ ExportInfo[] exportInfos = plugin.GetExportInfos().ToArray();
+
+ // Assert
+ Assert.AreEqual(1, exportInfos.Length);
+ var hydraulicBoundaryLocationExportInfo = exportInfos.Single(ei => ei.DataType == typeof(HydraulicBoundariesGroupContext));
+ Assert.IsNull(hydraulicBoundaryLocationExportInfo.Name);
+ Assert.IsNull(hydraulicBoundaryLocationExportInfo.Image);
+ Assert.IsNull(hydraulicBoundaryLocationExportInfo.Category);
+ }
+ }
}
}
\ No newline at end of file
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryLocationsWriter.cs
===================================================================
diff -u -r3d995a76fbe93cf9801596e6b959e7f5bcde5805 -r3865311e0dac61da3aa9ca1b4645c16b90290f1e
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryLocationsWriter.cs (.../HydraulicBoundaryLocationsWriter.cs) (revision 3d995a76fbe93cf9801596e6b959e7f5bcde5805)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryLocationsWriter.cs (.../HydraulicBoundaryLocationsWriter.cs) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -37,16 +37,35 @@
///
public class HydraulicBoundaryLocationsWriter
{
+ private readonly string designWaterLevelName;
+
///
+ /// Creates a new instance of .
+ ///
+ /// The Dutch name of the content of the
+ /// property.
+ /// Thrown when is null.
+ public HydraulicBoundaryLocationsWriter(string designWaterLevelName)
+ {
+ if (designWaterLevelName == null)
+ {
+ throw new ArgumentNullException("designWaterLevelName");
+ }
+
+ this.designWaterLevelName = designWaterLevelName;
+ }
+
+ ///
/// Writes the locations of a as point features in a shapefile.
///
/// The hydraulic boundary locations to be written to file.
/// The path to the shapefile.
- /// Thrown when or
+ /// Thrown when or
/// is null.
/// Thrown when is invalid.
/// Thrown when the shapefile cannot be written.
- public void WriteHydraulicBoundaryLocations(ICollection hydraulicBoundaryLocations, string filePath)
+ public void WriteHydraulicBoundaryLocations(IEnumerable hydraulicBoundaryLocations,
+ string filePath)
{
if (hydraulicBoundaryLocations == null)
{
@@ -67,7 +86,7 @@
pointShapeFileWriter.SaveAs(filePath);
}
- private MapPointData CreateMapPointData(HydraulicBoundaryLocation hydraulicBoundaryLocation)
+ private MapPointData CreateMapPointData(IHydraulicBoundaryLocation hydraulicBoundaryLocation)
{
if (hydraulicBoundaryLocation == null)
{
@@ -89,9 +108,9 @@
});
mapFeature.MetaData.Add("Naam", hydraulicBoundaryLocation.Name);
- mapFeature.MetaData.Add("Id", hydraulicBoundaryLocation.Id);
- mapFeature.MetaData.Add("Toetspeil", hydraulicBoundaryLocation.DesignWaterLevel.Value);
- mapFeature.MetaData.Add("Hs", hydraulicBoundaryLocation.WaveHeight.Value);
+ mapFeature.MetaData.Add("ID", hydraulicBoundaryLocation.Id);
+ mapFeature.MetaData.Add(designWaterLevelName, hydraulicBoundaryLocation.DesignWaterLevel.Value);
+ mapFeature.MetaData.Add("Golfhoogte", hydraulicBoundaryLocation.WaveHeight.Value);
return new MapPointData(hydraulicBoundaryLocation.Name)
{
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/HydraulicBoundaryLocationsWriterTest.cs
===================================================================
diff -u -r3d995a76fbe93cf9801596e6b959e7f5bcde5805 -r3865311e0dac61da3aa9ca1b4645c16b90290f1e
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/HydraulicBoundaryLocationsWriterTest.cs (.../HydraulicBoundaryLocationsWriterTest.cs) (revision 3d995a76fbe93cf9801596e6b959e7f5bcde5805)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/HydraulicBoundaryLocationsWriterTest.cs (.../HydraulicBoundaryLocationsWriterTest.cs) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -33,14 +33,25 @@
public class HydraulicBoundaryLocationsWriterTest
{
[Test]
+ public void ParameteredConstructor_DesignWaterLevelNameNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new HydraulicBoundaryLocationsWriter(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("designWaterLevelName", exception.ParamName);
+ }
+
+ [Test]
public void WriteHydraulicBoundaryLocations_HydraulicBoundaryLocationsNull_ThrowArgumentNullException()
{
// Setup
string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.IO,
Path.Combine("WriteHydraulicBoundaryLocations_NullhydraulicBoundaryLocations_ThrowArgumentNullException",
"test.shp"));
- var writer = new HydraulicBoundaryLocationsWriter();
+ var writer = new HydraulicBoundaryLocationsWriter("aName");
// Call
TestDelegate call = () => writer.WriteHydraulicBoundaryLocations(null, filePath);
@@ -55,7 +66,7 @@
// Setup
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(123, "aName", 1.1, 2.2);
- var writer = new HydraulicBoundaryLocationsWriter();
+ var writer = new HydraulicBoundaryLocationsWriter("aName");
// Call
TestDelegate call = () => writer.WriteHydraulicBoundaryLocations(new[]
@@ -83,7 +94,7 @@
string filePath = Path.Combine(directoryPath, "test.shp");
var baseName = "test";
- var writer = new HydraulicBoundaryLocationsWriter();
+ var writer = new HydraulicBoundaryLocationsWriter("Toetspeil");
// Precondition
AssertEssentialShapefileExists(directoryPath, baseName, false);
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/test-data/PointShapefileMd5.dbf
===================================================================
diff -u -r3d995a76fbe93cf9801596e6b959e7f5bcde5805 -r3865311e0dac61da3aa9ca1b4645c16b90290f1e
Binary files differ
Fisheye: Tag 3865311e0dac61da3aa9ca1b4645c16b90290f1e refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileExporters/HydraulicBoundaryLocationsExporter.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs
===================================================================
diff -u -rfdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd -r3865311e0dac61da3aa9ca1b4645c16b90290f1e
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -269,88 +269,78 @@
}
///
- /// Looks up a localized string similar to {0} Er zijn geen hydraulische randvoorwaarden locaties geëxporteerd..
- ///
- public static string HydraulicBoundaryLocationsExporter_Error_Exception_0_no_HydraulicBoundaryLocations_exported {
- get {
- return ResourceManager.GetString("HydraulicBoundaryLocationsExporter_Error_Exception_0_no_HydraulicBoundaryLocation" +
- "s_exported", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to LocationID
- ///300130
- ///300131
- ///300189
- ///300353
- ///300354
- ///300355
- ///300357
- ///300358
- ///300359
- ///300360
- ///300361
- ///300362
- ///300363
- ///300364
- ///300365
- ///300366
- ///300367
- ///300368
- ///300369
- ///300370
- ///300371
- ///300372
- ///300373
- ///300374
- ///300375
- ///300376
- ///300608
- ///300609
- ///300610
- ///300611
- ///300612
- ///300633
- ///300634
- ///300635
- ///300636
- ///300637
- ///300657
- ///300658
- ///300659
- ///300660
- ///300661
- ///300662
- ///300663
- ///300664
- ///300665
- ///300703
- ///300704
- ///300745
- ///300748
- ///300761
- ///300762
- ///300765
- ///300766
- ///300767
- ///300824
- ///300825
- ///300826
- ///300828
- ///300829
- ///300830
- ///300864
- ///300865
- ///301595
- ///301596
- ///301597
- ///301598
- ///301599
- ///301600
- ///301601
- ///301602
- ///301603
+ /// Looks up a localized string similar to LocationID
+ ///300130
+ ///300131
+ ///300189
+ ///300353
+ ///300354
+ ///300355
+ ///300357
+ ///300358
+ ///300359
+ ///300360
+ ///300361
+ ///300362
+ ///300363
+ ///300364
+ ///300365
+ ///300366
+ ///300367
+ ///300368
+ ///300369
+ ///300370
+ ///300371
+ ///300372
+ ///300373
+ ///300374
+ ///300375
+ ///300376
+ ///300608
+ ///300609
+ ///300610
+ ///300611
+ ///300612
+ ///300633
+ ///300634
+ ///300635
+ ///300636
+ ///300637
+ ///300657
+ ///300658
+ ///300659
+ ///300660
+ ///300661
+ ///300662
+ ///300663
+ ///300664
+ ///300665
+ ///300703
+ ///300704
+ ///300745
+ ///300748
+ ///300761
+ ///300762
+ ///300765
+ ///300766
+ ///300767
+ ///300824
+ ///300825
+ ///300826
+ ///300828
+ ///300829
+ ///300830
+ ///300864
+ ///300865
+ ///301595
+ ///301596
+ ///301597
+ ///301598
+ ///301599
+ ///301600
+ ///301601
+ ///301602
+ ///301603
///3016 [rest of string was truncated]";.
///
public static string HydraulicBoundaryLocationsFilterList {
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx
===================================================================
diff -u -rfdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd -r3865311e0dac61da3aa9ca1b4645c16b90290f1e
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -157,9 +157,6 @@
Nieuw
-
- {0} Er zijn geen hydraulische randvoorwaarden locaties geëxporteerd.
-
..\Resources\Exceptions_DoNotCalculate.csv;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Ringtoets.Integration.Plugin.csproj
===================================================================
diff -u -r915001caffacbbee15c0e3bf449072245bc5f509 -r3865311e0dac61da3aa9ca1b4645c16b90290f1e
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Ringtoets.Integration.Plugin.csproj (.../Ringtoets.Integration.Plugin.csproj) (revision 915001caffacbbee15c0e3bf449072245bc5f509)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Ringtoets.Integration.Plugin.csproj (.../Ringtoets.Integration.Plugin.csproj) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -54,7 +54,6 @@
Properties\GlobalAssembly.cs
-
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs
===================================================================
diff -u -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 -r3865311e0dac61da3aa9ca1b4645c16b90290f1e
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -66,7 +66,6 @@
using Ringtoets.Integration.Forms.PropertyClasses;
using Ringtoets.Integration.Forms.Views;
using Ringtoets.Integration.Forms.Views.SectionResultViews;
-using Ringtoets.Integration.Plugin.FileExporters;
using Ringtoets.Integration.Plugin.FileImporters;
using Ringtoets.Integration.Plugin.Properties;
using Ringtoets.Integration.Service;
@@ -407,7 +406,8 @@
yield return new ExportInfo
{
- CreateFileExporter = (context, filePath) => new HydraulicBoundaryLocationsExporter(context.WrappedData.HydraulicBoundaryDatabase.Locations, filePath),
+ CreateFileExporter = (context, filePath) => new HydraulicBoundaryLocationsExporter(
+ context.WrappedData.HydraulicBoundaryDatabase.Locations, filePath, "Toetspeil"),
IsEnabled = context => context.WrappedData.HydraulicBoundaryDatabase != null,
FileFilter = RingtoetsCommonIoResources.DataTypeDisplayName_shape_file_filter
};
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/ExportInfos/HydraulicBoundariesGroupContextExportInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/ExportInfos/HydraulicBoundariesGroupContextExportInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/ExportInfos/HydraulicBoundariesGroupContextExportInfoTest.cs (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -0,0 +1,140 @@
+// 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.Linq;
+using Core.Common.Base.IO;
+using Core.Common.Gui.Plugin;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.IO;
+using Ringtoets.GrassCoverErosionOutwards.Data;
+using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects;
+using Ringtoets.GrassCoverErosionOutwards.Plugin;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.Integration.Plugin;
+using RingtoetsCommonIoResources = Ringtoets.Common.IO.Properties.Resources;
+
+namespace Ringtoets.Integration.Forms.Test.ExportInfos
+{
+ [TestFixture]
+ public class HydraulicBoundariesGroupContextExportInfoTest
+ {
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var assessmentSectionMock = mockRepository.StrictMock();
+ mockRepository.ReplayAll();
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+
+ HydraulicBoundariesGroupContext context = new HydraulicBoundariesGroupContext(failureMechanism, assessmentSectionMock);
+ string filePath = "test";
+
+ using (GrassCoverErosionOutwardsPlugin plugin = new GrassCoverErosionOutwardsPlugin())
+ {
+ ExportInfo info = GetInfo(plugin);
+
+ // Call
+ IFileExporter fileExporter = info.CreateFileExporter(context, filePath);
+
+ // Assert
+ Assert.IsInstanceOf(fileExporter);
+ mockRepository.VerifyAll();
+ }
+ }
+
+ [Test]
+ public void FileFilter_Always_ReturnsFileFilter()
+ {
+ // Setup
+ using (GrassCoverErosionOutwardsPlugin plugin = new GrassCoverErosionOutwardsPlugin())
+ {
+ ExportInfo info = GetInfo(plugin);
+
+ // Call
+ string fileFilter = info.FileFilter;
+
+ // Assert
+ Assert.AreEqual(RingtoetsCommonIoResources.DataTypeDisplayName_shape_file_filter, fileFilter);
+ }
+ }
+
+ [Test]
+ public void IsEnabled_GrassCoverErosionOutwardsHydraulicBoundaryLocationsEmpty_ReturnsFalse()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var assessmentSectionMock = mockRepository.StrictMock();
+ mockRepository.ReplayAll();
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+
+ HydraulicBoundariesGroupContext context = new HydraulicBoundariesGroupContext(failureMechanism, assessmentSectionMock);
+
+ using (GrassCoverErosionOutwardsPlugin plugin = new GrassCoverErosionOutwardsPlugin())
+ {
+ ExportInfo info = GetInfo(plugin);
+
+ // Call
+ bool isEnabled = info.IsEnabled(context);
+
+ // Assert
+ Assert.IsFalse(isEnabled);
+ }
+ }
+
+ [Test]
+ public void IsEnabled_GrassCoverErosionOutwardsHydraulicBoundaryLocationsNotEmpty_ReturnsTrue()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var assessmentSectionMock = mockRepository.StrictMock();
+ mockRepository.ReplayAll();
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+ failureMechanism.SetGrassCoverErosionOutwardsHydraulicBoundaryLocations(new HydraulicBoundaryDatabase
+ {
+ Locations =
+ {
+ new HydraulicBoundaryLocation(0, "aName", 0, 0)
+ }
+ });
+
+ HydraulicBoundariesGroupContext context = new HydraulicBoundariesGroupContext(failureMechanism, assessmentSectionMock);
+
+ using (GrassCoverErosionOutwardsPlugin plugin = new GrassCoverErosionOutwardsPlugin())
+ {
+ ExportInfo info = GetInfo(plugin);
+
+ // Call
+ bool isEnabled = info.IsEnabled(context);
+
+ // Assert
+ Assert.IsTrue(isEnabled);
+ }
+ }
+
+ private static ExportInfo GetInfo(GrassCoverErosionOutwardsPlugin plugin)
+ {
+ return plugin.GetExportInfos().First(ei => ei.DataType == typeof(HydraulicBoundariesGroupContext));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/ExportInfos/HydraulicBoundaryDatabaseContextExportInfoTest.cs
===================================================================
diff -u -r718348fd1a88ab775f495dad750379e4cbedb25f -r3865311e0dac61da3aa9ca1b4645c16b90290f1e
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/ExportInfos/HydraulicBoundaryDatabaseContextExportInfoTest.cs (.../HydraulicBoundaryDatabaseContextExportInfoTest.cs) (revision 718348fd1a88ab775f495dad750379e4cbedb25f)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/ExportInfos/HydraulicBoundaryDatabaseContextExportInfoTest.cs (.../HydraulicBoundaryDatabaseContextExportInfoTest.cs) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -24,11 +24,11 @@
using Core.Common.Gui.Plugin;
using NUnit.Framework;
using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.IO;
using Ringtoets.HydraRing.Data;
using Ringtoets.Integration.Data;
using Ringtoets.Integration.Forms.PresentationObjects;
using Ringtoets.Integration.Plugin;
-using Ringtoets.Integration.Plugin.FileExporters;
using RingtoetsCommonIoResources = Ringtoets.Common.IO.Properties.Resources;
namespace Ringtoets.Integration.Forms.Test.ExportInfos
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj
===================================================================
diff -u -r915001caffacbbee15c0e3bf449072245bc5f509 -r3865311e0dac61da3aa9ca1b4645c16b90290f1e
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 915001caffacbbee15c0e3bf449072245bc5f509)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -66,6 +66,7 @@
+
@@ -233,6 +234,10 @@
{41B829C1-630F-40B0-8BEE-B1C4C94EC8C4}
Ringtoets.GrassCoverErosionOutwards.Forms
+
+ {9B3ED064-E29F-4D38-85E0-3A82B77BA702}
+ Ringtoets.GrassCoverErosionOutwards.Plugin
+
{1C0017D8-35B5-4CA0-8FC7-A83F46DBDC99}
Ringtoets.HeightStructures.Data
Fisheye: Tag 3865311e0dac61da3aa9ca1b4645c16b90290f1e refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileExporters/HydraulicBoundaryLocationsExporterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj
===================================================================
diff -u -r915001caffacbbee15c0e3bf449072245bc5f509 -r3865311e0dac61da3aa9ca1b4645c16b90290f1e
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 915001caffacbbee15c0e3bf449072245bc5f509)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
@@ -67,7 +67,6 @@
Properties\GlobalAssembly.cs
-