Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/SqLiteDatabaseHelper.cs =================================================================== diff -u -rfadb006ef0285eb3fdbdbfc805729b37c8dbc0e6 -r2ae1c9433c3c28b32105b9778b682b5e512a0f00 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/SqLiteDatabaseHelper.cs (.../SqLiteDatabaseHelper.cs) (revision fadb006ef0285eb3fdbdbfc805729b37c8dbc0e6) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/SqLiteDatabaseHelper.cs (.../SqLiteDatabaseHelper.cs) (revision 2ae1c9433c3c28b32105b9778b682b5e512a0f00) @@ -21,9 +21,8 @@ using System; using System.Data.SQLite; -using System.IO; using Core.Common.Base.Data; -using Core.Common.Base.Storage; +using NUnit.Framework; namespace Application.Ringtoets.Storage.TestUtil { @@ -44,10 +43,6 @@ { throw new ArgumentNullException("databaseSchemaQuery"); } - if (File.Exists(databaseFilePath)) - { - TearDownTempFile(databaseFilePath); - } SQLiteConnection.CreateFile(databaseFilePath); @@ -68,20 +63,17 @@ /// /// Path to database file. /// to save. - /// Thrown when is null. - /// is invalid. - /// Thrown when: - /// - /// The database does not contain the table version - /// THe file was not created. - /// Saving the to the database failed. - /// The connection to the database file failed. - /// - /// public static void CreateValidRingtoetsDatabase(string databaseFilePath, Project project) { - var storageSqLite = new StorageSqLite(); - storageSqLite.SaveProjectAs(databaseFilePath, project); + try + { + var storageSqLite = new StorageSqLite(); + storageSqLite.SaveProjectAs(databaseFilePath, project); + } + catch (Exception exception) + { + Assert.Fail("Precondition failed: creating database file failed due to {0}", exception); + } } /// @@ -94,19 +86,5 @@ "CREATE TABLE Version (VersionId INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," + " FromVersion VARCHAR (16), ToVersion VARCHAR (16),Timestamp NUMERIC); "; } - - /// - /// Removes the . - /// - /// The file to delete. - public static void TearDownTempFile(string filePath) - { - GC.Collect(); - GC.WaitForPendingFinalizers(); - if (!string.IsNullOrWhiteSpace(filePath) && File.Exists(filePath)) - { - File.Delete(filePath); - } - } } } \ No newline at end of file