Index: Ringtoets/Migration/test/Ringtoets.Migration.Integration.Test/MigrationTo182IntegrationTest.cs =================================================================== diff -u -r4abfa78a7646ed9974c1765f39da457eb3bfd283 -r5ec3bc519497b68a2905a9267fd36bfed53b04eb --- Ringtoets/Migration/test/Ringtoets.Migration.Integration.Test/MigrationTo182IntegrationTest.cs (.../MigrationTo182IntegrationTest.cs) (revision 4abfa78a7646ed9974c1765f39da457eb3bfd283) +++ Ringtoets/Migration/test/Ringtoets.Migration.Integration.Test/MigrationTo182IntegrationTest.cs (.../MigrationTo182IntegrationTest.cs) (revision 5ec3bc519497b68a2905a9267fd36bfed53b04eb) @@ -59,12 +59,46 @@ AssertVersions(reader); AssertDatabase(reader); + + AssertBackgroundData(reader, sourceFilePath); } AssertLogDatabase(logFilePath); } } + private static void AssertBackgroundData(MigratedDatabaseReader reader, string sourceFilePath) + { + string validateTransparency = + $"ATTACH DATABASE \"{sourceFilePath}\" AS SOURCEPROJECT;" + + "SELECT SUM([IsInvalid]) = 0 " + + "FROM " + + "(" + + "SELECT " + + "CASE WHEN (NEW.[Transparency] = OLD.[Transparency] AND OLD.[Transparency] > 0) " + + "OR (NEW.[Transparency] = 0.6 AND OLD.[Transparency] = 0) " + + "THEN 0 " + + "ELSE 1 " + + "END AS [IsInvalid] " + + "FROM BackgroundDataEntity NEW " + + "JOIN [SOURCEPROJECT].BackgroundDataEntity OLD USING(BackgroundDataEntityId) " + + "); " + + "DETACH SOURCEPROJECT;"; + reader.AssertReturnedDataIsValid(validateTransparency); + + string validateBackgroundData = + $"ATTACH DATABASE \"{sourceFilePath}\" AS SOURCEPROJECT;" + + "SELECT COUNT() = (SELECT COUNT() FROM [SOURCEPROJECT].BackgroundDataEntity) " + + "FROM BackgroundDataEntity NEW " + + "JOIN [SOURCEPROJECT].BackgroundDataEntity OLD USING(BackgroundDataEntityId) " + + "WHERE NEW.[AssessmentSectionEntityId] = OLD.[AssessmentSectionEntityId] " + + "AND NEW.[Name] = OLD.[Name] " + + "AND NEW.[IsVisible] = OLD.[IsVisible] " + + "AND NEW.[BackgroundDataType] = OLD.[BackgroundDataType]; " + + "DETACH SOURCEPROJECT;"; + reader.AssertReturnedDataIsValid(validateBackgroundData); + } + private static void AssertTablesContentMigrated(MigratedDatabaseReader reader, string sourceFilePath) { string[] tables =