Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/HydraulicBoundaryLocationsExporterTest.cs
===================================================================
diff -u -rae04c23f970bb96e54adbfb8c2fe1aaf95d13326 -rbd9849dce7ed90ca3d20be6431b8f0066b9684a9
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/HydraulicBoundaryLocationsExporterTest.cs (.../HydraulicBoundaryLocationsExporterTest.cs) (revision ae04c23f970bb96e54adbfb8c2fe1aaf95d13326)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/HydraulicBoundaryLocationsExporterTest.cs (.../HydraulicBoundaryLocationsExporterTest.cs) (revision bd9849dce7ed90ca3d20be6431b8f0066b9684a9)
@@ -105,7 +105,7 @@
}
[Test]
- public void Export_ValidData_ReturnTrue()
+ public void Export_ValidData_ReturnTrueAndWritesFile()
{
// Setup
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(123, "aName", 1.1, 2.2)
@@ -118,6 +118,7 @@
"Export_ValidData_ReturnTrue");
Directory.CreateDirectory(directoryPath);
string filePath = Path.Combine(directoryPath, "test.shp");
+ var baseName = "test";
var exporter = new HydraulicBoundaryLocationsExporter(new[]
{
@@ -129,17 +130,58 @@
{
// Call
isExported = exporter.Export();
+
+ // Assert
+ AssertEssentialShapefileExists(directoryPath, baseName, true);
}
finally
{
Directory.Delete(directoryPath, true);
}
- // Assert
Assert.IsTrue(isExported);
}
[Test]
+ public void Export_ValidData_WritesCorrectData()
+ {
+ // 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 baseName = "test";
+
+ var exporter = new HydraulicBoundaryLocationsExporter(new[]
+ {
+ hydraulicBoundaryLocation
+ }, filePath, "Toetspeil");
+
+ // Precondition
+ AssertEssentialShapefileExists(directoryPath, baseName, false);
+
+ try
+ {
+ // Call
+ exporter.Export();
+
+ // Assert
+ AssertEssentialShapefileExists(directoryPath, baseName, true);
+ AssertEssentialShapefileMd5Hashes(directoryPath, baseName);
+ }
+ finally
+ {
+ Directory.Delete(directoryPath, true);
+ }
+ }
+
+ [Test]
public void Export_InvalidDirectoryRights_LogErrorAndReturnFalse()
{
// Setup
@@ -179,5 +221,32 @@
Directory.Delete(directoryPath, true);
}
}
+
+ private static void AssertEssentialShapefileExists(string directoryPath, string baseName, bool shouldExist)
+ {
+ string pathName = Path.Combine(directoryPath, baseName);
+ Assert.AreEqual(shouldExist, File.Exists(pathName + ".shp"));
+ Assert.AreEqual(shouldExist, File.Exists(pathName + ".shx"));
+ Assert.AreEqual(shouldExist, File.Exists(pathName + ".dbf"));
+ }
+
+ private void AssertEssentialShapefileMd5Hashes(string directoryPath, string baseName)
+ {
+ string refPathName = Path.Combine(TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.IO), "PointShapefileMd5");
+ string pathName = Path.Combine(directoryPath, baseName);
+
+ AssertBinaryFileContent(refPathName, pathName, ".shp", 100, 28);
+ AssertBinaryFileContent(refPathName, pathName, ".shx", 100, 8);
+ AssertBinaryFileContent(refPathName, pathName, ".dbf", 32, 441);
+ }
+
+ private static void AssertBinaryFileContent(string refPathName, string pathName, string extension, int headerLength, int bodyLength)
+ {
+ var refContent = File.ReadAllBytes(refPathName + extension);
+ var content = File.ReadAllBytes(pathName + extension);
+ Assert.AreEqual(headerLength + bodyLength, content.Length);
+ Assert.AreEqual(refContent.Skip(headerLength).Take(bodyLength),
+ content.Skip(headerLength).Take(bodyLength));
+ }
}
}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/Properties/Resources.Designer.cs
===================================================================
diff -u -ra0eac32f05f503713d027f116b0194040418ceb2 -rbd9849dce7ed90ca3d20be6431b8f0066b9684a9
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision a0eac32f05f503713d027f116b0194040418ceb2)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision bd9849dce7ed90ca3d20be6431b8f0066b9684a9)
@@ -1,4 +1,25 @@
-//------------------------------------------------------------------------------
+// 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.
+
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000