Index: Riskeer/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/LocationsFileReader.cs
===================================================================
diff -u
--- Riskeer/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/LocationsFileReader.cs (revision 0)
+++ Riskeer/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/LocationsFileReader.cs (revision 6330bca0c4e11043e9d92ea077785bef2b38485e)
@@ -0,0 +1,44 @@
+// Copyright (C) Stichting Deltares 2019. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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 Core.Common.Base.IO;
+using Core.Common.IO.Readers;
+
+namespace Riskeer.HydraRing.IO.HydraulicBoundaryDatabase
+{
+ ///
+ /// Class for reading a locations file.
+ ///
+ public class LocationsFileReader : SqLiteDatabaseReaderBase
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The path of the locations file to open.
+ /// Thrown when:
+ ///
+ /// - The contains invalid characters.
+ /// - No file could be found at .
+ ///
+ ///
+ public LocationsFileReader(string databaseFilePath) : base(databaseFilePath) {}
+ }
+}
Index: Riskeer/HydraRing/test/Riskeer.HydraRing.IO.Test/HydraulicBoundaryDatabase/LocationsFileReaderTest.cs
===================================================================
diff -u
--- Riskeer/HydraRing/test/Riskeer.HydraRing.IO.Test/HydraulicBoundaryDatabase/LocationsFileReaderTest.cs (revision 0)
+++ Riskeer/HydraRing/test/Riskeer.HydraRing.IO.Test/HydraulicBoundaryDatabase/LocationsFileReaderTest.cs (revision 6330bca0c4e11043e9d92ea077785bef2b38485e)
@@ -0,0 +1,86 @@
+// Copyright (C) Stichting Deltares 2019. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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.IO;
+using Core.Common.Base.IO;
+using Core.Common.IO.Readers;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Riskeer.HydraRing.IO.HydraulicBoundaryDatabase;
+
+namespace Riskeer.HydraRing.IO.Test.HydraulicBoundaryDatabase
+{
+ [TestFixture]
+ public class LocationsFileReaderTest
+ {
+ private readonly string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Riskeer.HydraRing.IO, "LocationsFileReader");
+
+ [Test]
+ public void Constructor_NonExistingPath_ThrowsCriticalFileReadException()
+ {
+ // Setup
+ string locationsFilePath = Path.Combine(testDataPath, "doesNotExist.sqlite");
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (new LocationsFileReader(locationsFilePath)) { }
+ };
+
+ // Assert
+ string expectedMessage = $"Fout bij het lezen van bestand '{locationsFilePath}': het bestand bestaat niet.";
+ var exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ [TestCase(null)]
+ [TestCase("")]
+ public void Constructor_PathNullOrEmpty_ThrowsCriticalFileReadException(string locationsFilePath)
+ {
+ // Call
+ TestDelegate test = () =>
+ {
+ using (new LocationsFileReader(locationsFilePath)) { }
+ };
+
+ // Assert
+ string expectedMessage = $"Fout bij het lezen van bestand '{locationsFilePath}': bestandspad mag niet leeg of ongedefinieerd zijn.";
+ var exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Constructor_ValidFile_ExpectedValues()
+ {
+ // Setup
+ string locationsFilePath = Path.Combine(testDataPath, "Locations.sqlite");
+
+ // Call
+ using (var reader = new LocationsFileReader(locationsFilePath))
+ {
+ // Assert
+ Assert.AreEqual(locationsFilePath, reader.Path);
+ Assert.IsInstanceOf(reader);
+ }
+ }
+ }
+}
Index: Riskeer/HydraRing/test/Riskeer.HydraRing.IO.Test/test-data/LocationsFileReader/Locations.sqlite
===================================================================
diff -u
Binary files differ