Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/StochasticSoilModelReaderTest.cs =================================================================== diff -u -rc0bfe8e2e80f2b7430009493647a04c5c75cfcd3 -r6379e5b1f8fd510f54137ceed602bd2900cdf235 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/StochasticSoilModelReaderTest.cs (.../StochasticSoilModelReaderTest.cs) (revision c0bfe8e2e80f2b7430009493647a04c5c75cfcd3) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/StochasticSoilModelReaderTest.cs (.../StochasticSoilModelReaderTest.cs) (revision 6379e5b1f8fd510f54137ceed602bd2900cdf235) @@ -88,15 +88,15 @@ [Test] [TestCase("text.txt")] [TestCase("empty.soil")] - public void Initialize_IncorrectFormatFileOrInvalidSchema_ThrowsCriticalFileReadException(string dbName) + public void Validate_IncorrectFormatFileOrInvalidSchema_ThrowsCriticalFileReadException(string dbName) { // Setup string dbFile = Path.Combine(testDataPath, dbName); using (var reader = new StochasticSoilModelReader(dbFile)) { // Call - TestDelegate test = () => reader.Initialize(); + TestDelegate test = () => reader.Validate(); // Assert var exception = Assert.Throws(test); @@ -110,15 +110,15 @@ } [Test] - public void Initialize_IncorrectVersion_ThrowsCriticalFileReadException() + public void Validate_IncorrectVersion_ThrowsCriticalFileReadException() { // Setup string dbFile = Path.Combine(versionReaderTestDataPath, "incorrectVersion.soil"); using (var reader = new StochasticSoilModelReader(dbFile)) { // Call - TestDelegate test = () => reader.Initialize(); + TestDelegate test = () => reader.Validate(); // Assert var exception = Assert.Throws(test); @@ -134,15 +134,15 @@ } [Test] - public void Initialize_InvalidSchemaThatPassesVersionValidation_ThrowsCriticalFileReadException() + public void Validate_InvalidSchemaThatPassesVersionValidation_ThrowsCriticalFileReadException() { // Setup string dbFile = Path.Combine(constraintsReaderTestDataPath, "missingStochasticSoilModelTable.soil"); using (var reader = new StochasticSoilModelReader(dbFile)) { // Call - TestDelegate test = () => reader.Initialize(); + TestDelegate test = () => reader.Validate(); // Assert var exception = Assert.Throws(test); @@ -156,15 +156,15 @@ } [Test] - public void Initialize_NonUniqueSoilModelNames_ThrowsCriticalFileReadException() + public void Validate_NonUniqueSoilModelNames_ThrowsCriticalFileReadException() { // Setup string dbFile = Path.Combine(constraintsReaderTestDataPath, "nonUniqueSoilModelNames.soil"); using (var reader = new StochasticSoilModelReader(dbFile)) { // Call - TestDelegate test = () => reader.Initialize(); + TestDelegate test = () => reader.Validate(); // Assert var exception = Assert.Throws(test); @@ -175,5 +175,23 @@ Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile)); } + + [Test] + public void Validate_ValidDatabase_InitializesConnection() + { + // Setup + string dbFile = Path.Combine(testDataPath, "complete.soil"); + + using (var reader = new StochasticSoilModelReader(dbFile)) + { + // Call + reader.Validate(); + + // Assert + Assert.IsTrue(reader.HasNext); + } + + Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile)); + } } } \ No newline at end of file