Index: Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj
===================================================================
diff -u -r1fa1ff1080811742abffbd23346b23cf1a8aef3d -r866f2505f3d89a2a96a810d18419c840946d0d3b
--- Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 1fa1ff1080811742abffbd23346b23cf1a8aef3d)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 866f2505f3d89a2a96a810d18419c840946d0d3b)
@@ -117,6 +117,7 @@
+
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilDatabaseConstraintsReader.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilDatabaseConstraintsReader.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilDatabaseConstraintsReader.cs (revision 866f2505f3d89a2a96a810d18419c840946d0d3b)
@@ -0,0 +1,43 @@
+// Copyright (C) Stichting Deltares 2017. 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 Core.Common.Base.IO;
+using Core.Common.IO.Readers;
+
+namespace Ringtoets.Common.IO.SoilProfile
+{
+ ///
+ /// This class reads a DSoil database file and validates whether it meets required constraints.
+ ///
+ public class SoilDatabaseConstraintsReader : SqLiteDatabaseReaderBase
+ {
+ ///
+ /// Creates a new instance of ,
+ /// which will use the as its source.
+ ///
+ /// The path of the database file to open.
+ /// Thrown when:
+ /// - The contains invalid characters.
+ /// - No file could be found at .
+ ///
+ public SoilDatabaseConstraintsReader(string databaseFilePath) : base(databaseFilePath) {}
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/StochasticSoilModelReader.cs
===================================================================
diff -u -r190069e93048bfb7abe5a190ada915e4b4e782b0 -r866f2505f3d89a2a96a810d18419c840946d0d3b
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/StochasticSoilModelReader.cs (.../StochasticSoilModelReader.cs) (revision 190069e93048bfb7abe5a190ada915e4b4e782b0)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/StochasticSoilModelReader.cs (.../StochasticSoilModelReader.cs) (revision 866f2505f3d89a2a96a810d18419c840946d0d3b)
@@ -38,8 +38,6 @@
///
/// - The contains invalid characters.
/// - No file could be found at .
- /// - The database version could not be read.
- /// - The database version is incorrect.
///
///
public StochasticSoilModelReader(string databaseFilePath) : base(databaseFilePath) {}
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj
===================================================================
diff -u -r1fa1ff1080811742abffbd23346b23cf1a8aef3d -r866f2505f3d89a2a96a810d18419c840946d0d3b
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision 1fa1ff1080811742abffbd23346b23cf1a8aef3d)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision 866f2505f3d89a2a96a810d18419c840946d0d3b)
@@ -109,6 +109,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilDatabaseConstraintsReaderTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilDatabaseConstraintsReaderTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilDatabaseConstraintsReaderTest.cs (revision 866f2505f3d89a2a96a810d18419c840946d0d3b)
@@ -0,0 +1,86 @@
+// Copyright (C) Stichting Deltares 2017. 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.IO;
+using Core.Common.Base.IO;
+using Core.Common.IO.Readers;
+using Core.Common.TestUtil;
+using Core.Common.Utils.Builders;
+using NUnit.Framework;
+using Ringtoets.Common.IO.SoilProfile;
+
+namespace Ringtoets.Common.IO.Test.SoilProfile
+{
+ [TestFixture]
+ public class SoilDatabaseConstraintsReaderTest
+ {
+ private readonly string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, nameof(SoilDatabaseConstraintsReader));
+
+ [Test]
+ public void Constructor_NonExistingPath_ThrowsCriticalFileReadException()
+ {
+ // Setup
+ string testFile = Path.Combine(testDataPath, "does not exist");
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (new SoilDatabaseConstraintsReader(testFile)) {}
+ };
+
+ // Assert
+ var exception = Assert.Throws(test);
+ string expectedMessage = new FileReaderErrorMessageBuilder(testFile).Build("Het bestand bestaat niet.");
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ [TestCaseSource(typeof(InvalidPathHelper), nameof(InvalidPathHelper.InvalidPaths))]
+ public void Constructor_FileNullOrEmpty_ThrowsCriticalFileReadException(string fileName)
+ {
+ // Call
+ TestDelegate test = () =>
+ {
+ using (new SoilDatabaseConstraintsReader(fileName)) {}
+ };
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ [Test]
+ public void Constructor_PathToExistingFile_ExpectedValues()
+ {
+ // Setup
+ string dbFile = Path.Combine(testDataPath, "emptySchema.soil");
+
+ // Call
+ using (var reader = new SoilDatabaseConstraintsReader(dbFile))
+ {
+ // Assert
+ Assert.AreEqual(dbFile, reader.Path);
+ Assert.IsInstanceOf(reader);
+ }
+
+ Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/SoilDatabaseConstraintsReader/emptySchema.soil
===================================================================
diff -u
Binary files differ