Index: Migration/Scripts/src/Migration.Scripts.Data/UpgradeScript.cs
===================================================================
diff -u -r56e690b056dd0901609e651f6ac3c010d3d002b7 -r85ff91388190d242a5bd74e110b2c5f8b177bff3
--- Migration/Scripts/src/Migration.Scripts.Data/UpgradeScript.cs (.../UpgradeScript.cs) (revision 56e690b056dd0901609e651f6ac3c010d3d002b7)
+++ Migration/Scripts/src/Migration.Scripts.Data/UpgradeScript.cs (.../UpgradeScript.cs) (revision 85ff91388190d242a5bd74e110b2c5f8b177bff3)
@@ -93,8 +93,15 @@
/// Thrown when upgrading failed.
public void Upgrade(string sourceLocation, string targetLocation)
{
- IOUtils.ValidateFilePath(sourceLocation);
- IOUtils.ValidateFilePath(targetLocation);
+ if (!IOUtils.IsValidFilePath(sourceLocation))
+ {
+ throw new ArgumentException($@"'{sourceLocation}' is not a valid file path.", nameof(sourceLocation));
+ }
+ if (!IOUtils.IsValidFilePath(targetLocation))
+ {
+ throw new ArgumentException($@"'{targetLocation}' is not a valid file path.", nameof(targetLocation));
+ }
+
PerformUpgrade(sourceLocation, targetLocation);
}
Index: Migration/Scripts/test/Migration.Scripts.Data.Test/UpgradeScriptTest.cs
===================================================================
diff -u -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 -r85ff91388190d242a5bd74e110b2c5f8b177bff3
--- Migration/Scripts/test/Migration.Scripts.Data.Test/UpgradeScriptTest.cs (.../UpgradeScriptTest.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70)
+++ Migration/Scripts/test/Migration.Scripts.Data.Test/UpgradeScriptTest.cs (.../UpgradeScriptTest.cs) (revision 85ff91388190d242a5bd74e110b2c5f8b177bff3)
@@ -84,7 +84,8 @@
TestDelegate call = () => upgradeScript.Upgrade(sourceFilePath, "Filepath.ext");
// Assert
- Assert.Throws(call);
+ ArgumentException exception = Assert.Throws(call);
+ Assert.AreEqual("sourceLocation", exception.ParamName);
}
[Test]
@@ -102,7 +103,8 @@
TestDelegate call = () => upgradeScript.Upgrade("Filepath.ext", targetFilePath);
// Assert
- Assert.Throws(call);
+ ArgumentException exception = Assert.Throws(call);
+ Assert.AreEqual("targetLocation", exception.ParamName);
}
}
}
\ No newline at end of file