Index: Core/Components/src/Core.Components.Gis.IO/Properties/Resources.Designer.cs =================================================================== diff -u -rd1c832128168938c7cb5ed4b1ac54382e0fc96fe -r24e6bba4341f818f1dd3dfd168aff1c41070979a --- Core/Components/src/Core.Components.Gis.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d1c832128168938c7cb5ed4b1ac54382e0fc96fe) +++ Core/Components/src/Core.Components.Gis.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 24e6bba4341f818f1dd3dfd168aff1c41070979a) @@ -82,7 +82,7 @@ } /// - /// Looks up a localized string similar to Bestand bevat geen enkele lijn.. + /// Looks up a localized string similar to Het bestand bevat geometrieën anders dan een lijn.. /// internal static string LineShapeFileReader_File_contains_geometries_not_line { get { Index: Core/Components/src/Core.Components.Gis.IO/Properties/Resources.resx =================================================================== diff -u -rd1c832128168938c7cb5ed4b1ac54382e0fc96fe -r24e6bba4341f818f1dd3dfd168aff1c41070979a --- Core/Components/src/Core.Components.Gis.IO/Properties/Resources.resx (.../Resources.resx) (revision d1c832128168938c7cb5ed4b1ac54382e0fc96fe) +++ Core/Components/src/Core.Components.Gis.IO/Properties/Resources.resx (.../Resources.resx) (revision 24e6bba4341f818f1dd3dfd168aff1c41070979a) @@ -118,7 +118,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Bestand bevat geen enkele lijn. + Het bestand bevat geometrieën anders dan een lijn. Lijn Index: Core/Components/test/Core.Components.Gis.IO.Test/Readers/PolylineShapeFileReaderTest.cs =================================================================== diff -u -r997937ce7659313e714efcd5fe47101c6b53d984 -r24e6bba4341f818f1dd3dfd168aff1c41070979a --- Core/Components/test/Core.Components.Gis.IO.Test/Readers/PolylineShapeFileReaderTest.cs (.../PolylineShapeFileReaderTest.cs) (revision 997937ce7659313e714efcd5fe47101c6b53d984) +++ Core/Components/test/Core.Components.Gis.IO.Test/Readers/PolylineShapeFileReaderTest.cs (.../PolylineShapeFileReaderTest.cs) (revision 24e6bba4341f818f1dd3dfd168aff1c41070979a) @@ -66,7 +66,7 @@ TestDelegate call = () => new PolylineShapeFileReader(nonLineShapeFile); // Assert - var expectedMessage = string.Format("Fout bij het lezen van bestand '{0}': Bestand bevat geen enkele lijn.", + var expectedMessage = string.Format("Fout bij het lezen van bestand '{0}': Het bestand bevat geometrieën anders dan een lijn.", nonLineShapeFile); var message = Assert.Throws(call).Message; Assert.AreEqual(expectedMessage, message); Index: Ringtoets/Common/src/Ringtoets.Common.IO/FailureMechanismSectionReader.cs =================================================================== diff -u -re259b10bd28ea0011da2fd77f7fc0c9011831c37 -r24e6bba4341f818f1dd3dfd168aff1c41070979a --- Ringtoets/Common/src/Ringtoets.Common.IO/FailureMechanismSectionReader.cs (.../FailureMechanismSectionReader.cs) (revision e259b10bd28ea0011da2fd77f7fc0c9011831c37) +++ Ringtoets/Common/src/Ringtoets.Common.IO/FailureMechanismSectionReader.cs (.../FailureMechanismSectionReader.cs) (revision 24e6bba4341f818f1dd3dfd168aff1c41070979a) @@ -120,23 +120,21 @@ } } + /// + /// Opens the polyline shapefile. + /// + /// The file path to the shapefile. + /// The reader that can be used to read the shapefile. + /// When either: + /// + /// points to a file that doesn't exist. + /// The shapefile has non-line geometries in it. + /// An unexpected error occurred when reading the shapefile. + /// + /// private static PolylineShapeFileReader OpenPolyLineShapeFile(string shapeFilePath) { - try - { - return new PolylineShapeFileReader(shapeFilePath); - } - catch (CriticalFileReadException e) - { - if (e.InnerException.GetType() == typeof(ArgumentException)) - { - string message = new FileReaderErrorMessageBuilder(shapeFilePath) - .Build(RingtoetsCommonIOResources.FailureMechanismSectionReader_OpenPolyLineShapeFile_File_can_only_have_polylines); - throw new CriticalFileReadException(message, e); - } - - throw; - } + return new PolylineShapeFileReader(shapeFilePath); } /// Index: Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs =================================================================== diff -u -ra0eac32f05f503713d027f116b0194040418ceb2 -r24e6bba4341f818f1dd3dfd168aff1c41070979a --- Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision a0eac32f05f503713d027f116b0194040418ceb2) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 24e6bba4341f818f1dd3dfd168aff1c41070979a) @@ -22,7 +22,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Runtime Version:4.0.30319.17929 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -405,15 +405,6 @@ } /// - /// Looks up a localized string similar to Het bestand mag uitsluitend polylijnen bevatten.. - /// - public static string FailureMechanismSectionReader_OpenPolyLineShapeFile_File_can_only_have_polylines { - get { - return ResourceManager.GetString("FailureMechanismSectionReader_OpenPolyLineShapeFile_File_can_only_have_polylines", resourceCulture); - } - } - - /// /// 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 { Index: Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx =================================================================== diff -u -ra0eac32f05f503713d027f116b0194040418ceb2 -r24e6bba4341f818f1dd3dfd168aff1c41070979a --- Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx (.../Resources.resx) (revision a0eac32f05f503713d027f116b0194040418ceb2) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx (.../Resources.resx) (revision 24e6bba4341f818f1dd3dfd168aff1c41070979a) @@ -123,9 +123,6 @@ Het bestand moet exact 1 gehele polylijn bevatten. - - Het bestand mag uitsluitend polylijnen bevatten. - Het bestand bevat een of meerdere multi-polylijnen. Multi-polylijnen worden niet ondersteund. Index: Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLineReader.cs =================================================================== diff -u -r997937ce7659313e714efcd5fe47101c6b53d984 -r24e6bba4341f818f1dd3dfd168aff1c41070979a --- Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLineReader.cs (.../ReferenceLineReader.cs) (revision 997937ce7659313e714efcd5fe47101c6b53d984) +++ Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLineReader.cs (.../ReferenceLineReader.cs) (revision 24e6bba4341f818f1dd3dfd168aff1c41070979a) @@ -85,21 +85,7 @@ /// private static PolylineShapeFileReader OpenPolyLineShapeFile(string shapeFilePath) { - try - { - return new PolylineShapeFileReader(shapeFilePath); - } - catch (CriticalFileReadException e) - { - if (e.InnerException.GetType() == typeof(ArgumentException)) - { - string message = new FileReaderErrorMessageBuilder(shapeFilePath) - .Build(RingtoetsCommonIOResources.ReferenceLineReader_File_must_contain_1_polyline); - throw new CriticalFileReadException(message, e); - } - - throw; - } + return new PolylineShapeFileReader(shapeFilePath); } /// Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/DikeProfiles/ProfileLocationReaderTest.cs =================================================================== diff -u -rbd0179e92bcc6367c2760df65b80b08e52acbb86 -r24e6bba4341f818f1dd3dfd168aff1c41070979a --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/DikeProfiles/ProfileLocationReaderTest.cs (.../ProfileLocationReaderTest.cs) (revision bd0179e92bcc6367c2760df65b80b08e52acbb86) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/DikeProfiles/ProfileLocationReaderTest.cs (.../ProfileLocationReaderTest.cs) (revision 24e6bba4341f818f1dd3dfd168aff1c41070979a) @@ -291,10 +291,10 @@ using (var reader = new ProfileLocationReader(invalidFilePath)) { - // Call int count = reader.GetLocationCount; for (int i = 0; i < count; i++) { + // Call dikeProfileLocations.Add(reader.GetNextProfileLocation()); } @@ -313,10 +313,10 @@ using (var reader = new ProfileLocationReader(validFilePath)) { - // Call int count = reader.GetLocationCount; for (int i = 0; i < count; i++) { + // Call dikeProfileLocations.Add(reader.GetNextProfileLocation()); } @@ -351,10 +351,10 @@ using (var reader = new ProfileLocationReader(validFilePath)) { - // Call int count = reader.GetLocationCount; for (int i = 0; i < count; i++) { + // Call dikeProfileLocations.Add(reader.GetNextProfileLocation()); } @@ -377,10 +377,10 @@ using (var reader = new ProfileLocationReader(validFilePath)) { - // Call int count = reader.GetLocationCount; for (int i = 0; i < count; i++) { + // Call dikeProfileLocations.Add(reader.GetNextProfileLocation()); } Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/FailureMechanismSectionReaderTest.cs =================================================================== diff -u -re259b10bd28ea0011da2fd77f7fc0c9011831c37 -r24e6bba4341f818f1dd3dfd168aff1c41070979a --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/FailureMechanismSectionReaderTest.cs (.../FailureMechanismSectionReaderTest.cs) (revision e259b10bd28ea0011da2fd77f7fc0c9011831c37) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/FailureMechanismSectionReaderTest.cs (.../FailureMechanismSectionReaderTest.cs) (revision 24e6bba4341f818f1dd3dfd168aff1c41070979a) @@ -131,7 +131,7 @@ TestDelegate call = () => new FailureMechanismSectionReader(invalidFilePath); // Assert - var expectedMessage = string.Format("Fout bij het lezen van bestand '{0}': Het bestand mag uitsluitend polylijnen bevatten.", + var expectedMessage = string.Format("Fout bij het lezen van bestand '{0}': Het bestand bevat geometrieën anders dan een lijn.", invalidFilePath); var message = Assert.Throws(call).Message; Assert.AreEqual(expectedMessage, message); Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLineReaderTest.cs =================================================================== diff -u -r997937ce7659313e714efcd5fe47101c6b53d984 -r24e6bba4341f818f1dd3dfd168aff1c41070979a --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLineReaderTest.cs (.../ReferenceLineReaderTest.cs) (revision 997937ce7659313e714efcd5fe47101c6b53d984) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLineReaderTest.cs (.../ReferenceLineReaderTest.cs) (revision 24e6bba4341f818f1dd3dfd168aff1c41070979a) @@ -130,13 +130,32 @@ } [Test] - [TestCase("Empty_PolyLine_with_ID.shp")] [TestCase("Multiple_Point_with_ID.shp")] [TestCase("Multiple_Polygon_with_ID.shp")] - [TestCase("Multiple_PolyLine_with_ID.shp")] [TestCase("Single_Multi-Polygon_with_ID.shp")] [TestCase("Single_Point_with_ID.shp")] [TestCase("Single_Polygon_with_ID.shp")] + public void ReadReferenceLine_ShapefileContainsOtherThanPolyline_ThrowCriticalFileReadException(string shapeFileName) + { + // Setup + string invalidFilePath = TestHelper.GetTestDataPath(TestDataPath.Core.Components.Gis.IO, + shapeFileName); + + var reader = new ReferenceLineReader(); + + // Call + TestDelegate call = () => reader.ReadReferenceLine(invalidFilePath); + + // Assert + var expectedMessage = string.Format("Fout bij het lezen van bestand '{0}': Het bestand bevat geometrieën anders dan een lijn.", + invalidFilePath); + var message = Assert.Throws(call).Message; + Assert.AreEqual(expectedMessage, message); + } + + [Test] + [TestCase("Empty_PolyLine_with_ID.shp")] + [TestCase("Multiple_PolyLine_with_ID.shp")] public void ReadReferenceLine_ShapefileDoesNotHaveSinglePolyline_ThrowCriticalFileReadException(string shapeFileName) { // Setup Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLinesMetaReaderTest.cs =================================================================== diff -u -rce31448a066c084f755439f3e7d453bfb042b291 -r24e6bba4341f818f1dd3dfd168aff1c41070979a --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLinesMetaReaderTest.cs (.../ReferenceLinesMetaReaderTest.cs) (revision ce31448a066c084f755439f3e7d453bfb042b291) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLinesMetaReaderTest.cs (.../ReferenceLinesMetaReaderTest.cs) (revision 24e6bba4341f818f1dd3dfd168aff1c41070979a) @@ -114,7 +114,7 @@ TestDelegate call = () => ReferenceLinesMetaReader.ReadReferenceLinesMetas(invalidFilePath); // Assert . - var expectedMessage = string.Format("Fout bij het lezen van bestand '{0}': Bestand bevat geen enkele lijn.", + var expectedMessage = string.Format("Fout bij het lezen van bestand '{0}': Het bestand bevat geometrieën anders dan een lijn.", invalidFilePath); var message = Assert.Throws(call).Message; Assert.AreEqual(expectedMessage, message);