Index: Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsCreateScript.cs
===================================================================
diff -u -r5e9874d26ba517fd2271c5319aebbc879d7d27f3 -r4adc05fb0d7306ef1c21c56052193f526a4fad54
--- Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsCreateScript.cs (.../RingtoetsCreateScript.cs) (revision 5e9874d26ba517fd2271c5319aebbc879d7d27f3)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsCreateScript.cs (.../RingtoetsCreateScript.cs) (revision 4adc05fb0d7306ef1c21c56052193f526a4fad54)
@@ -46,7 +46,7 @@
using (var databaseFile = new RingtoetsDatabaseFile(location))
{
databaseFile.OpenDatabaseConnection();
- databaseFile.CreateStructure(CreateQuery);
+ databaseFile.ExecuteQuery(CreateQuery);
}
return new RingtoetsVersionedFile(location);
Index: Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsDatabaseFile.cs
===================================================================
diff -u -r090bf03ca13a96b9e7c0a71b89f6853c303f7c02 -r4adc05fb0d7306ef1c21c56052193f526a4fad54
--- Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsDatabaseFile.cs (.../RingtoetsDatabaseFile.cs) (revision 090bf03ca13a96b9e7c0a71b89f6853c303f7c02)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsDatabaseFile.cs (.../RingtoetsDatabaseFile.cs) (revision 4adc05fb0d7306ef1c21c56052193f526a4fad54)
@@ -69,37 +69,14 @@
}
///
- /// Executes the that will create the database structure.
+ /// Executes the that will on the database.
///
/// Create structure query to execute.
/// Thrown when is null
/// or consist out of only whitespace characters.
/// Thrown when executing failed.
- public void CreateStructure(string query)
+ public void ExecuteQuery(string query)
{
- PerformExecuteQuery(query);
- }
-
- ///
- /// Executes the that will migrate the data.
- ///
- /// Migration query to execute.
- /// Thrown when is null
- /// or consist out of only whitespace characters.
- /// Thrown when executing failed.
- public void ExecuteMigration(string query)
- {
- PerformExecuteQuery(query);
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- private void PerformExecuteQuery(string query)
- {
if (string.IsNullOrWhiteSpace(query))
{
throw new ArgumentException(@"Parameter must be a valid database script.", nameof(query));
@@ -113,6 +90,12 @@
}
}
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
private void Dispose(bool disposing)
{
if (disposed)
Index: Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsUpgradeScript.cs
===================================================================
diff -u -r58d375a1c6b920e8597eae37dde622fda6a456ee -r4adc05fb0d7306ef1c21c56052193f526a4fad54
--- Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsUpgradeScript.cs (.../RingtoetsUpgradeScript.cs) (revision 58d375a1c6b920e8597eae37dde622fda6a456ee)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsUpgradeScript.cs (.../RingtoetsUpgradeScript.cs) (revision 4adc05fb0d7306ef1c21c56052193f526a4fad54)
@@ -59,7 +59,7 @@
using (var databaseFile = new RingtoetsDatabaseFile(target.Location))
{
databaseFile.OpenDatabaseConnection();
- databaseFile.ExecuteMigration(query);
+ databaseFile.ExecuteQuery(query);
}
}
}
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsCreateScriptTest.cs
===================================================================
diff -u -raf53f335d0fa6920f7a5c4ab27b112bae9eeaede -r4adc05fb0d7306ef1c21c56052193f526a4fad54
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsCreateScriptTest.cs (.../RingtoetsCreateScriptTest.cs) (revision af53f335d0fa6920f7a5c4ab27b112bae9eeaede)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsCreateScriptTest.cs (.../RingtoetsCreateScriptTest.cs) (revision 4adc05fb0d7306ef1c21c56052193f526a4fad54)
@@ -94,7 +94,7 @@
// Assert
Assert.IsTrue(File.Exists(versionedFile.Location));
- using (new FileDisposeHelper(filePath)) { }
+ using (new FileDisposeHelper(filePath)) {}
}
[Test]
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsDatabaseFileTest.cs
===================================================================
diff -u -r090bf03ca13a96b9e7c0a71b89f6853c303f7c02 -r4adc05fb0d7306ef1c21c56052193f526a4fad54
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsDatabaseFileTest.cs (.../RingtoetsDatabaseFileTest.cs) (revision 090bf03ca13a96b9e7c0a71b89f6853c303f7c02)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsDatabaseFileTest.cs (.../RingtoetsDatabaseFileTest.cs) (revision 4adc05fb0d7306ef1c21c56052193f526a4fad54)
@@ -81,7 +81,7 @@
[TestCase("")]
[TestCase(" ")]
[TestCase(null)]
- public void CreateStructure_QueryIsNullOrWhiteSpace_ThrowsArgumentException(string query)
+ public void ExecuteQuery_QueryIsNullOrWhiteSpace_ThrowsArgumentException(string query)
{
// Setup
string filename = Path.GetRandomFileName();
@@ -93,7 +93,7 @@
databaseFile.OpenDatabaseConnection();
// Call
- TestDelegate call = () => databaseFile.CreateStructure(query);
+ TestDelegate call = () => databaseFile.ExecuteQuery(query);
// Assert
string paramName = Assert.Throws(call).ParamName;
@@ -102,7 +102,7 @@
}
[Test]
- public void CreateStructure_InvalidQuery_ThrowsSQLiteException()
+ public void ExecuteQuery_InvalidQuery_ThrowsSQLiteException()
{
// Setup
string filename = Path.GetRandomFileName();
@@ -114,15 +114,15 @@
databaseFile.OpenDatabaseConnection();
// Call
- TestDelegate call = () => databaseFile.CreateStructure("THIS WILL FAIL");
+ TestDelegate call = () => databaseFile.ExecuteQuery("THIS WILL FAIL");
// Assert
Assert.Throws(call);
}
}
[Test]
- public void CreateStructure_ValidQuery_CreatesFile()
+ public void ExecuteQuery_ValidQuery_CreatesFile()
{
// Setup
string filename = Path.GetRandomFileName();
@@ -133,7 +133,7 @@
databaseFile.OpenDatabaseConnection();
// Call
- databaseFile.CreateStructure(";");
+ databaseFile.ExecuteQuery(";");
// Assert
Assert.IsTrue(File.Exists(filePath));
@@ -143,71 +143,6 @@
}
[Test]
- [TestCase("")]
- [TestCase(" ")]
- [TestCase(null)]
- public void ExecuteMigration_QueryIsNullOrWhiteSpace_ThrowsArgumentException(string query)
- {
- // Setup
- string filename = Path.GetRandomFileName();
- string filePath = TestHelper.GetTestDataPath(TestDataPath.Migration.Core.Storage, filename);
-
- using (new FileDisposeHelper(filePath))
- using (var databaseFile = new RingtoetsDatabaseFile(filePath))
- {
- databaseFile.OpenDatabaseConnection();
-
- // Call
- TestDelegate call = () => databaseFile.ExecuteMigration(query);
-
- // Assert
- string paramName = Assert.Throws(call).ParamName;
- Assert.AreEqual("query", paramName);
- }
- }
-
- [Test]
- public void ExecuteMigration_InvalidQuery_ThrowsSQLiteException()
- {
- // Setup
- string filename = Path.GetRandomFileName();
- string filePath = TestHelper.GetTestDataPath(TestDataPath.Migration.Core.Storage, filename);
-
- using (new FileDisposeHelper(filePath))
- using (var databaseFile = new RingtoetsDatabaseFile(filePath))
- {
- databaseFile.OpenDatabaseConnection();
-
- // Call
- TestDelegate call = () => databaseFile.ExecuteMigration("THIS WILL FAIL");
-
- // Assert
- Assert.Throws(call);
- }
- }
-
- [Test]
- public void ExecuteMigration_ValidQuery_CreatesFile()
- {
- // Setup
- string filename = Path.GetRandomFileName();
- string filePath = TestHelper.GetTestDataPath(TestDataPath.Migration.Core.Storage, filename);
-
- using (var databaseFile = new RingtoetsDatabaseFile(filePath))
- {
- databaseFile.OpenDatabaseConnection();
-
- // Call
- databaseFile.ExecuteMigration(";");
-
- // Assert
- Assert.IsTrue(File.Exists(filePath));
- }
-
- using (new FileDisposeHelper(filePath)) {}
- }
-
- [Test]
public void Dispose_AlreadyDisposed_DoesNotThrowException()
{
// Setup