Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/FullTestProject164.rtd =================================================================== diff -u -r92c99376daee71036fa992b005fe0732e037ed82 -ra305afd1b15e9ac9977c2ee3574c6600c2b57705 Binary files differ Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo171IntegrationTest.cs =================================================================== diff -u -r92c99376daee71036fa992b005fe0732e037ed82 -ra305afd1b15e9ac9977c2ee3574c6600c2b57705 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo171IntegrationTest.cs (.../MigrationTo171IntegrationTest.cs) (revision 92c99376daee71036fa992b005fe0732e037ed82) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo171IntegrationTest.cs (.../MigrationTo171IntegrationTest.cs) (revision a305afd1b15e9ac9977c2ee3574c6600c2b57705) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.Collections.ObjectModel; using System.Data; using System.Data.SQLite; @@ -71,6 +72,10 @@ AssertHydraulicBoundaryLocations(reader); AssertDikeProfiles(reader); AssertForeshoreProfiles(reader); + AssertStochasticSoilModels(reader); + AssertSurfaceLines(reader); + + AssertVersions(reader); } AssertLogDatabase(logFilePath); @@ -79,19 +84,58 @@ private static void AssertDikeProfiles(MigratedDatabaseReader reader) { - const string validateDikeProfiles = "SELECT " + - "(SELECT COUNT(DISTINCT(Name)) = COUNT() FROM DikeProfileEntity) " + - "AND (SELECT COUNT() = 0 FROM DikeProfileEntity WHERE Id != Name);"; + const string validateDikeProfiles = + "SELECT " + + "(SELECT COUNT(DISTINCT(Name)) = COUNT() FROM DikeProfileEntity) " + + "AND (SELECT COUNT() = 0 FROM DikeProfileEntity WHERE Id != Name);"; reader.AssertReturnedDataIsValid(validateDikeProfiles); } private static void AssertForeshoreProfiles(MigratedDatabaseReader reader) { - const string validateDikeProfiles = "SELECT COUNT() = 0 " + - "FROM ForeshoreProfileEntity WHERE Id != Name;"; + const string validateDikeProfiles = + "SELECT COUNT() = 0 " + + "FROM ForeshoreProfileEntity WHERE Id != Name;"; reader.AssertReturnedDataIsValid(validateDikeProfiles); } + private static void AssertStochasticSoilModels(MigratedDatabaseReader reader) + { + const string validateStochasticSoilModels = + "SELECT COUNT(DISTINCT(Name)) = COUNT() " + + "FROM StochasticSoilModelEntity;"; + reader.AssertReturnedDataIsValid(validateStochasticSoilModels); + + AssertStochasticSoilProfiles(reader); + } + + private static void AssertStochasticSoilProfiles(MigratedDatabaseReader reader) + { + const string validateStochasticSoilProfiles = + "SELECT " + + "(SELECT COUNT() != 0 FROM StochasticSoilProfileEntity WHERE [Type] = 1) " + + "AND " + + "(SELECT COUNT() = 0 FROM StochasticSoilProfileEntity WHERE [Probability] NOT BETWEEN 0 AND 1 OR[Probability] IS NULL);"; + reader.AssertReturnedDataIsValid(validateStochasticSoilProfiles); + } + + private static void AssertSurfaceLines(MigratedDatabaseReader reader) + { + const string validateSurfaceLines = + "SELECT COUNT(DISTINCT(Name)) = COUNT() " + + "FROM SurfaceLineEntity;"; + reader.AssertReturnedDataIsValid(validateSurfaceLines); + } + + private static void AssertVersions(MigratedDatabaseReader reader) + { + const string validateSurfaceLines = + "SELECT COUNT() != 0 " + + "FROM VersionEntity " + + "WHERE [Version] = \"17.1\";"; + reader.AssertReturnedDataIsValid(validateSurfaceLines); + } + private static void AssertLogDatabase(string logFilePath) { using (var reader = new MigrationLogDatabaseReader(logFilePath)) @@ -234,17 +278,26 @@ { using (IDataReader dataReader = CreateDataReader(queryString)) { - Assert.IsFalse(dataReader.Read()); + Assert.IsFalse(dataReader.Read(), "Result should be empty when using query " + + $"'{queryString}'."); } } + /// + /// Asserts that the results in one field with the value true. + /// + /// The query to execute. + /// The execution of + /// failed. public void AssertReturnedDataIsValid(string queryString) { using (IDataReader dataReader = CreateDataReader(queryString)) { - Assert.IsTrue(dataReader.Read()); - Assert.AreEqual(1, dataReader.FieldCount); - Assert.AreEqual(1, dataReader[0]); + Assert.IsTrue(dataReader.Read(), "No data can be read from the data reader " + + $"when using query '{queryString}'."); + Assert.AreEqual(1, dataReader.FieldCount, $"Expected one field, was {dataReader.FieldCount} " + + $"fields when using query '{queryString}'."); + Assert.IsTrue(Convert.ToBoolean(dataReader[0])); } } }