Index: Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/HydraulicBoundaryDatabaseImporter.cs =================================================================== diff -u -r99e4d6ea2e8c5c2e542357abb2577dd2cd942abf -r81e1fdca83c2788db4466fca8055b3a5cea16171 --- Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/HydraulicBoundaryDatabaseImporter.cs (.../HydraulicBoundaryDatabaseImporter.cs) (revision 99e4d6ea2e8c5c2e542357abb2577dd2cd942abf) +++ Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/HydraulicBoundaryDatabaseImporter.cs (.../HydraulicBoundaryDatabaseImporter.cs) (revision 81e1fdca83c2788db4466fca8055b3a5cea16171) @@ -36,28 +36,27 @@ namespace Ringtoets.Common.IO.FileImporters { /// - /// Imports locations read from an Hydraulic boundary .sqlite file (SqlLite database file) to a - /// collection of in a . + /// Importer for hydraulic boundary database files and corresponding configuration files. /// public class HydraulicBoundaryDatabaseImporter : IDisposable { private readonly ILog log = LogManager.GetLogger(typeof(HydraulicBoundaryDatabaseImporter)); + private HydraulicBoundaryDatabaseReader hydraulicBoundaryDatabaseReader; private HydraulicLocationConfigurationDatabaseReader hydraulicLocationConfigurationDatabaseReader; /// - /// Creates a new instance of , based upon the data read from - /// the hydraulic boundary database file, and saved into . + /// Creates a new instance of . /// - /// to set the newly - /// created . + /// The to set the imported data to. /// The path of the hydraulic boundary database file to import from. /// true if the import was successful, false otherwise. /// Thrown when is null. /// Thrown when: /// /// The given file at cannot be read. /// The file 'HLCD.sqlite' in the same folder as cannot be read. + /// The file 'config.sqlite' in the same folder as cannot be read. /// /// public bool Import(IAssessmentSection targetItem, string filePath) @@ -66,28 +65,33 @@ { throw new ArgumentNullException(nameof(targetItem)); } + ValidateAndConnectTo(filePath); HydraulicBoundaryDatabase hydraulicBoundaryDatabase = targetItem.HydraulicBoundaryDatabase; if (!IsImportRequired(hydraulicBoundaryDatabase)) { bool isNotificationRequired = hydraulicBoundaryDatabase.FilePath != filePath; + hydraulicBoundaryDatabase.FilePath = filePath; + if (isNotificationRequired) { targetItem.NotifyObservers(); } } else { - ReadHydraulicBoundaryDatabase readResult = ReadHydraulicBoundaryDatabase(); + ReadHydraulicBoundaryDatabase readHydraulicBoundaryDatabase = ReadHydraulicBoundaryDatabase(); - if (readResult == null) + if (readHydraulicBoundaryDatabase == null) { return false; } - AddImportedDataToModel(targetItem, readResult, filePath); + targetItem.HydraulicBoundaryDatabase = CreateHydraulicBoundaryDatabase(readHydraulicBoundaryDatabase, filePath); + targetItem.NotifyObservers(); + log.Info(Resources.HydraulicBoundaryDatabaseImporter_Import_All_hydraulic_locations_read); } @@ -101,6 +105,7 @@ hydraulicBoundaryDatabaseReader.Dispose(); hydraulicBoundaryDatabaseReader = null; } + if (hydraulicLocationConfigurationDatabaseReader != null) { hydraulicLocationConfigurationDatabaseReader.Dispose(); @@ -109,13 +114,14 @@ } /// - /// Validates the file and opens a connection. + /// Validates the hydraulic boundary database file and opens a connection. /// /// The path to the file to read. /// Thrown when: /// /// The given file at cannot be read. /// The file 'HLCD.sqlite' in the same folder as cannot be read. + /// The file 'config.sqlite' in the same folder as cannot be read. /// /// private void ValidateAndConnectTo(string filePath) @@ -132,19 +138,16 @@ string message = new FileReaderErrorMessageBuilder(filePath).Build(Resources.HydraulicBoundaryDatabaseImporter_HLCD_sqlite_Not_Found); throw new CriticalFileReadException(message); } + + string settingsFilePath = HydraulicBoundaryDatabaseHelper.GetHydraulicBoundarySettingsDatabase(filePath); try { - string settingsDatabaseFileName = HydraulicBoundaryDatabaseHelper.GetHydraulicBoundarySettingsDatabase(filePath); - using (new DesignTablesSettingsProvider(settingsDatabaseFileName)) {} - using (new TimeIntegrationSettingsProvider(settingsDatabaseFileName)) {} - using (new NumericsSettingsProvider(settingsDatabaseFileName)) {} + using (new HydraRingSettingsDatabaseReader(settingsFilePath)) {} } catch (CriticalFileReadException e) { - string errorMessage = string.Format(Resources.HydraulicBoundaryDatabaseImporter_Cannot_open_hydaulic_calculation_settings_file_0_, - e.Message); - string message = new FileReaderErrorMessageBuilder(filePath).Build(errorMessage); - throw new CriticalFileReadException(message); + string errorMessage = string.Format(Resources.HydraulicBoundaryDatabaseImporter_Cannot_open_hydaulic_calculation_settings_file_0_, e.Message); + throw new CriticalFileReadException(new FileReaderErrorMessageBuilder(filePath).Build(errorMessage)); } } @@ -153,11 +156,6 @@ return hydraulicBoundaryDatabase == null || hydraulicBoundaryDatabaseReader.GetVersion() != hydraulicBoundaryDatabase.Version; } - private void HandleException(Exception e) - { - log.Error(e.Message, e); - } - private ReadHydraulicBoundaryDatabase ReadHydraulicBoundaryDatabase() { long trackId = GetTrackId(); @@ -196,7 +194,7 @@ } catch (Exception e) when (e is LineParseException || e is CriticalFileReadException) { - HandleException(e); + log.Error(e.Message, e); return null; } } @@ -207,18 +205,14 @@ { return hydraulicBoundaryDatabaseReader.GetTrackId(); } - catch (Exception e) + catch (Exception e) when (e is LineParseException || e is CriticalFileReadException) { - if (e is LineParseException || e is CriticalFileReadException) - { - HandleException(e); - return 0; - } - throw; + log.Error(e.Message, e); + return 0; } } - private static void AddImportedDataToModel(IAssessmentSection assessmentSection, ReadHydraulicBoundaryDatabase readData, string filePath) + private static HydraulicBoundaryDatabase CreateHydraulicBoundaryDatabase(ReadHydraulicBoundaryDatabase readData, string filePath) { HydraulicBoundaryDatabase hydraulicBoundaryDatabase = readData.CanUsePreprocessor ? new HydraulicBoundaryDatabase(true, Path.GetDirectoryName(filePath)) @@ -228,8 +222,7 @@ hydraulicBoundaryDatabase.Version = readData.Version; hydraulicBoundaryDatabase.FilePath = filePath; - assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - assessmentSection.NotifyObservers(); + return hydraulicBoundaryDatabase; } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/HydraulicBoundaryDatabaseImporterTest.cs =================================================================== diff -u -r61c2ac2573d82151b0b1593260a419543d07122a -r81e1fdca83c2788db4466fca8055b3a5cea16171 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/HydraulicBoundaryDatabaseImporterTest.cs (.../HydraulicBoundaryDatabaseImporterTest.cs) (revision 61c2ac2573d82151b0b1593260a419543d07122a) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/HydraulicBoundaryDatabaseImporterTest.cs (.../HydraulicBoundaryDatabaseImporterTest.cs) (revision 81e1fdca83c2788db4466fca8055b3a5cea16171) @@ -58,10 +58,7 @@ [Test] public void DefaultConstructor_ExpectedValues() { - // Call is done in SetUp - // Assert - Assert.IsInstanceOf(importer); Assert.IsInstanceOf(importer); } @@ -80,42 +77,21 @@ } [Test] - public void Import_ExistingFile_DoesNotThrowException() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - assessmentSection.Expect(section => section.NotifyObservers()); - mocks.ReplayAll(); - - string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); - - // Call - TestDelegate test = () => importer.Import(assessmentSection, validFilePath); - - // Assert - Assert.DoesNotThrow(test); - - mocks.VerifyAll(); - } - - [Test] public void Import_NonExistingFile_ThrowsCriticalFileReadException() { // Setup var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - assessmentSection.Expect(section => section.NotifyObservers()).Repeat.Never(); + var assessmentSection = mocks.StrictMock(); mocks.ReplayAll(); - string filePath = Path.Combine(testDataPath, "nonexisting.sqlite"); - string expectedExceptionMessage = $"Fout bij het lezen van bestand '{filePath}': het bestand bestaat niet."; + string filePath = Path.Combine(testDataPath, "doesNotExist.sqlite"); // Call TestDelegate test = () => importer.Import(assessmentSection, filePath); // Assert var exception = Assert.Throws(test); + string expectedExceptionMessage = $"Fout bij het lezen van bestand '{filePath}': het bestand bestaat niet."; Assert.AreEqual(expectedExceptionMessage, exception.Message); mocks.VerifyAll(); @@ -126,8 +102,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - assessmentSection.Expect(section => section.NotifyObservers()).Repeat.Never(); + var assessmentSection = mocks.StrictMock(); mocks.ReplayAll(); string invalidPath = Path.Combine(testDataPath, "complete.sqlite"); @@ -137,9 +112,9 @@ TestDelegate test = () => importer.Import(assessmentSection, invalidPath); // Assert + var exception = Assert.Throws(test); string expectedMessage = new FileReaderErrorMessageBuilder(invalidPath) .Build("Er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."); - var exception = Assert.Throws(test); Assert.AreEqual(expectedMessage, exception.Message); Assert.IsInstanceOf(exception.InnerException); @@ -151,18 +126,17 @@ { // Setup var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - assessmentSection.Expect(section => section.NotifyObservers()).Repeat.Never(); + var assessmentSection = mocks.StrictMock(); mocks.ReplayAll(); string filePath = Path.Combine(testDataPath, "/"); - string expectedExceptionMessage = $"Fout bij het lezen van bestand '{filePath}': bestandspad mag niet verwijzen naar een lege bestandsnaam."; // Call TestDelegate test = () => importer.Import(assessmentSection, filePath); // Assert var exception = Assert.Throws(test); + string expectedExceptionMessage = $"Fout bij het lezen van bestand '{filePath}': bestandspad mag niet verwijzen naar een lege bestandsnaam."; Assert.AreEqual(expectedExceptionMessage, exception.Message); Assert.IsInstanceOf(exception.InnerException); @@ -174,8 +148,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - assessmentSection.Expect(section => section.NotifyObservers()).Repeat.Never(); + var assessmentSection = mocks.StrictMock(); mocks.ReplayAll(); string validFilePath = Path.Combine(testDataPath, "withoutHLCD", "empty.sqlite"); @@ -184,8 +157,8 @@ TestDelegate test = () => importer.Import(assessmentSection, validFilePath); // Assert - string expectedMessage = new FileReaderErrorMessageBuilder(validFilePath).Build("Het bijbehorende HLCD bestand is niet gevonden in dezelfde map als het HRD bestand."); var exception = Assert.Throws(test); + string expectedMessage = new FileReaderErrorMessageBuilder(validFilePath).Build("Het bijbehorende HLCD bestand is niet gevonden in dezelfde map als het HRD bestand."); Assert.AreEqual(expectedMessage, exception.Message); mocks.VerifyAll(); @@ -196,8 +169,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - assessmentSection.Expect(section => section.NotifyObservers()).Repeat.Never(); + var assessmentSection = mocks.StrictMock(); mocks.ReplayAll(); string validFilePath = Path.Combine(testDataPath, "withoutSettings", "complete.sqlite"); @@ -218,8 +190,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - assessmentSection.Expect(section => section.NotifyObservers()).Repeat.Never(); + var assessmentSection = mocks.StrictMock(); mocks.ReplayAll(); string validFilePath = Path.Combine(testDataPath, "invalidSettingsSchema", "complete.sqlite"); @@ -237,19 +208,17 @@ } [Test] - public void Import_ImportingToValidTargetWithValidFileWithoutUsePreprocessor_ImportHydraulicBoundaryLocationsToCollectionAndAssessmentSectionNotified() + public void Import_ValidFileWithCanUsePreprocessorFalse_DataImportedAndAssessmentSectionNotified() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub(); assessmentSection.Expect(section => section.NotifyObservers()); mocks.ReplayAll(); - string validFilePath = Path.Combine(testDataPath, "completeWithLocationsToBeFilteredOut.sqlite"); + string directory = Path.Combine(testDataPath, "WithUsePreprocessor"); + string validFilePath = Path.Combine(directory, "completeUsePreprocessorFalse.sqlite"); - // Precondition - Assert.IsTrue(File.Exists(validFilePath), $"Precondition failed. File does not exist: {validFilePath}"); - // Call var importResult = false; Action call = () => importResult = importer.Import(assessmentSection, validFilePath); @@ -270,79 +239,17 @@ } [Test] - public void Import_ImportingToSameDatabaseOnDifferentPath_FilePathUpdatedAndAssessmentSectionNotified() + public void Import_ValidFileWithCanUsePreprocessorTrue_DataImportedAndAssessmentSectionNotified() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub(); - assessmentSection.Expect(section => section.NotifyObservers()).Repeat.Twice(); - mocks.ReplayAll(); - - string validFilePath = Path.Combine(testDataPath, "completeWithLocationsToBeFilteredOut.sqlite"); - string copyValidFilePath = Path.Combine(testDataPath, "copyOfCompleteWithLocationsToBeFilteredOut.sqlite"); - - // Precondition - Assert.IsTrue(File.Exists(validFilePath), $"Precondition failed. File does not exist: {validFilePath}"); - - importer.Import(assessmentSection, validFilePath); - - // Call - bool importResult = importer.Import(assessmentSection, copyValidFilePath); - - // Assert - Assert.IsTrue(importResult); - Assert.AreEqual(copyValidFilePath, assessmentSection.HydraulicBoundaryDatabase.FilePath); - List importedLocations = assessmentSection.HydraulicBoundaryDatabase.Locations; - Assert.AreEqual(9, importedLocations.Count); - CollectionAssert.AllItemsAreNotNull(importedLocations); - CollectionAssert.AllItemsAreUnique(importedLocations); - mocks.VerifyAll(); - } - - [Test] - public void Import_ImportingToSameDatabaseOnSamePath_AssessmentSectionNotNotified() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); assessmentSection.Expect(section => section.NotifyObservers()); mocks.ReplayAll(); - string validFilePath = Path.Combine(testDataPath, "completeWithLocationsToBeFilteredOut.sqlite"); - - // Precondition - Assert.IsTrue(File.Exists(validFilePath), $"Precondition failed. File does not exist: {validFilePath}"); - - importer.Import(assessmentSection, validFilePath); - - // Call - bool importResult = importer.Import(assessmentSection, validFilePath); - - // Assert - Assert.IsTrue(importResult); - Assert.AreEqual(validFilePath, assessmentSection.HydraulicBoundaryDatabase.FilePath); - List importedLocations = assessmentSection.HydraulicBoundaryDatabase.Locations; - Assert.AreEqual(9, importedLocations.Count); - CollectionAssert.AllItemsAreNotNull(importedLocations); - CollectionAssert.AllItemsAreUnique(importedLocations); - mocks.VerifyAll(); - } - - [Test] - public void Import_ImportingToValidTargetWithValidFileCanUsePreprocessorTrue_ImportHydraulicBoundaryLocationsToCollectionAndAssessmentSectionNotified() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - assessmentSection.Expect(section => section.NotifyObservers()); - mocks.ReplayAll(); - string directory = Path.Combine(testDataPath, "WithUsePreprocessor"); string validFilePath = Path.Combine(directory, "completeUsePreprocessorTrue.sqlite"); - // Precondition - Assert.IsTrue(File.Exists(validFilePath), $"Precondition failed. File does not exist: {validFilePath}"); - // Call var importResult = false; Action call = () => importResult = importer.Import(assessmentSection, validFilePath); @@ -365,31 +272,25 @@ } [Test] - public void Import_ImportingToValidTargetWithValidFileCanUsePreprocessorFalse_ImportHydraulicBoundaryLocationsToCollectionAndAssessmentSectionNotified() + public void Import_ImportingToSameDatabaseOnDifferentPath_FilePathUpdatedAndAssessmentSectionNotified() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub(); - assessmentSection.Expect(section => section.NotifyObservers()); + assessmentSection.Expect(section => section.NotifyObservers()).Repeat.Twice(); mocks.ReplayAll(); - string validFilePath = Path.Combine(testDataPath, "WithUsePreprocessor", "completeUsePreprocessorFalse.sqlite"); + string validFilePath = Path.Combine(testDataPath, "completeWithLocationsToBeFilteredOut.sqlite"); + string copyValidFilePath = Path.Combine(testDataPath, "copyOfCompleteWithLocationsToBeFilteredOut.sqlite"); - // Precondition - Assert.IsTrue(File.Exists(validFilePath), $"Precondition failed. File does not exist: {validFilePath}"); + importer.Import(assessmentSection, validFilePath); // Call - var importResult = false; - Action call = () => importResult = importer.Import(assessmentSection, validFilePath); + bool importResult = importer.Import(assessmentSection, copyValidFilePath); // Assert - TestHelper.AssertLogMessages(call, messages => - { - string[] messageArray = messages.ToArray(); - StringAssert.EndsWith("De hydraulische randvoorwaardenlocaties zijn ingelezen.", messageArray[0]); - }); Assert.IsTrue(importResult); - Assert.IsFalse(assessmentSection.HydraulicBoundaryDatabase.CanUsePreprocessor); + Assert.AreEqual(copyValidFilePath, assessmentSection.HydraulicBoundaryDatabase.FilePath); List importedLocations = assessmentSection.HydraulicBoundaryDatabase.Locations; Assert.AreEqual(9, importedLocations.Count); CollectionAssert.AllItemsAreNotNull(importedLocations); @@ -398,53 +299,46 @@ } [Test] - public void Import_ImportingFileWithCorruptSchema_AbortAndLog() + public void Import_ImportingToSameDatabaseOnSamePath_AssessmentSectionNotNotified() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub(); - assessmentSection.Expect(section => section.NotifyObservers()).Repeat.Never(); + assessmentSection.Expect(section => section.NotifyObservers()); mocks.ReplayAll(); - string corruptPath = Path.Combine(testDataPath, "corruptschema.sqlite"); + string validFilePath = Path.Combine(testDataPath, "completeWithLocationsToBeFilteredOut.sqlite"); - var importResult = true; + importer.Import(assessmentSection, validFilePath); // Call - Action call = () => importResult = importer.Import(assessmentSection, corruptPath); + bool importResult = importer.Import(assessmentSection, validFilePath); // Assert - TestHelper.AssertLogMessagesWithLevelAndLoggedExceptions(call, messages => - { - Assert.AreEqual(1, messages.Count()); - Tuple expectedLog = messages.ElementAt(0); - - Assert.AreEqual(Level.Error, expectedLog.Item2); - - Exception loggedException = expectedLog.Item3; - Assert.IsInstanceOf(loggedException); - Assert.AreEqual(loggedException.Message, expectedLog.Item1); - }); - Assert.IsFalse(importResult); - Assert.IsNull(assessmentSection.HydraulicBoundaryDatabase, "No HydraulicBoundaryDatabase object should be created when import from corrupt database."); - + Assert.IsTrue(importResult); + Assert.AreEqual(validFilePath, assessmentSection.HydraulicBoundaryDatabase.FilePath); + List importedLocations = assessmentSection.HydraulicBoundaryDatabase.Locations; + Assert.AreEqual(9, importedLocations.Count); + CollectionAssert.AllItemsAreNotNull(importedLocations); + CollectionAssert.AllItemsAreUnique(importedLocations); mocks.VerifyAll(); } [Test] - public void Import_CorruptSchemaFile_ReturnsFalse() + public void Import_ImportingFileWithCorruptSchema_ReturnsFalseAndLogsErrorMessages() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub(); assessmentSection.Expect(section => section.NotifyObservers()).Repeat.Never(); mocks.ReplayAll(); - string validFilePath = Path.Combine(testDataPath, "corruptschema.sqlite"); + string corruptPath = Path.Combine(testDataPath, "corruptschema.sqlite"); + var importResult = true; // Call - Action call = () => importResult = importer.Import(assessmentSection, validFilePath); + Action call = () => importResult = importer.Import(assessmentSection, corruptPath); // Assert TestHelper.AssertLogMessagesWithLevelAndLoggedExceptions(call, messages => @@ -460,6 +354,7 @@ }); Assert.IsFalse(importResult); Assert.IsNull(assessmentSection.HydraulicBoundaryDatabase, "No HydraulicBoundaryDatabase object should be created when import from corrupt database."); + mocks.VerifyAll(); } } Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/HydraulicBoundaryDatabaseReader.cs =================================================================== diff -u -rcb70bb1b407efb3bb39788178054a0bcc3933c7f -r81e1fdca83c2788db4466fca8055b3a5cea16171 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/HydraulicBoundaryDatabaseReader.cs (.../HydraulicBoundaryDatabaseReader.cs) (revision cb70bb1b407efb3bb39788178054a0bcc3933c7f) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/HydraulicBoundaryDatabaseReader.cs (.../HydraulicBoundaryDatabaseReader.cs) (revision 81e1fdca83c2788db4466fca8055b3a5cea16171) @@ -124,7 +124,7 @@ /// Gets the track id from the hydraulic boundary database. /// /// The track id found in the database, or 0 if the track id cannot be found. - /// Thrown when the database contains incorrect values for required properties. + /// Thrown when the database contains incorrect values for required properties. /// Thrown when a query could not be executed on the database schema. public long GetTrackId() { Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseReaderTest.cs =================================================================== diff -u -r99e4d6ea2e8c5c2e542357abb2577dd2cd942abf -r81e1fdca83c2788db4466fca8055b3a5cea16171 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseReaderTest.cs (.../HydraulicLocationConfigurationDatabaseReaderTest.cs) (revision 99e4d6ea2e8c5c2e542357abb2577dd2cd942abf) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseReaderTest.cs (.../HydraulicLocationConfigurationDatabaseReaderTest.cs) (revision 81e1fdca83c2788db4466fca8055b3a5cea16171) @@ -42,17 +42,17 @@ public void Constructor_InvalidFile_ThrowsCriticalFileReadException() { // Setup - string testFile = Path.Combine(testDataPath, "none.sqlite"); + string dbFile = Path.Combine(testDataPath, "none.sqlite"); // Call TestDelegate test = () => { - using (new HydraulicLocationConfigurationDatabaseReader(testFile)) {} + using (new HydraulicLocationConfigurationDatabaseReader(dbFile)) {} }; // Assert - string expectedMessage = new FileReaderErrorMessageBuilder(testFile).Build("Het bestand bestaat niet."); var exception = Assert.Throws(test); + string expectedMessage = new FileReaderErrorMessageBuilder(dbFile).Build("Het bestand bestaat niet."); Assert.AreEqual(expectedMessage, exception.Message); }