Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Importers/HydraulicLocationConfigurationDatabaseImporterTest.cs =================================================================== diff -u -r9aae00b6756064a13dad1a66a97a62067987048f -r7f9914406799f37e7969a4c0061693772788d0ec --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Importers/HydraulicLocationConfigurationDatabaseImporterTest.cs (.../HydraulicLocationConfigurationDatabaseImporterTest.cs) (revision 9aae00b6756064a13dad1a66a97a62067987048f) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Importers/HydraulicLocationConfigurationDatabaseImporterTest.cs (.../HydraulicLocationConfigurationDatabaseImporterTest.cs) (revision 7f9914406799f37e7969a4c0061693772788d0ec) @@ -166,6 +166,36 @@ mocks.VerifyAll(); } + [Test] + [TestCase("scenarioInformationNoEntries")] + [TestCase("scenarioInformationMultipleEntries")] + public void Import_InvalidNumberOfScenarioInformationEntries_CancelImportWithErrorMessage(string fileName) + { + // Setup + var mocks = new MockRepository(); + var handler = mocks.StrictMock(); + mocks.ReplayAll(); + + string path = Path.Combine(testDataPath, $"{fileName}.sqlite"); + + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase + { + FilePath = path, + TrackId = 13 + }; + + var importer = new HydraulicLocationConfigurationDatabaseImporter(new HydraulicLocationConfigurationSettings(), handler, hydraulicBoundaryDatabase, path); + + // Call + var importSuccessful = true; + Action call = () => importSuccessful = importer.Import(); + + // Assert + string expectedMessage = $"Fout bij het lezen van bestand '{path}': de tabel 'ScenarioInformation' moet exact 1 rij bevatten."; + AssertImportFailed(call, expectedMessage, ref importSuccessful); + mocks.VerifyAll(); + } + private static void AssertImportFailed(Action call, string errorMessage, ref bool importSuccessful) { string expectedMessage = $"{errorMessage}" +