Index: Core/Common/src/Core.Common.Utils/FileUtils.cs =================================================================== diff -u -r6cc96c5f52e06c2dc083a1ae3eb56d358b28a62b -r5aa0269872b446cab9f68c55dead92b6c5f49a64 --- Core/Common/src/Core.Common.Utils/FileUtils.cs (.../FileUtils.cs) (revision 6cc96c5f52e06c2dc083a1ae3eb56d358b28a62b) +++ Core/Common/src/Core.Common.Utils/FileUtils.cs (.../FileUtils.cs) (revision 5aa0269872b446cab9f68c55dead92b6c5f49a64) @@ -139,14 +139,27 @@ } } - public static void ValidateFilePathIsWritable(string filePath) + /// + /// Validates if the file path is writable. + /// + /// The file path to be validated. + /// Thrown when is invalid. + /// A valid path: + /// + /// is not empty or null, + /// does not consist out of only whitespace characters, + /// does not contain an invalid character, + /// does not end with a directory or path separator (empty file name), + /// is writable. + /// + public static void ValidateFilePathIsWritable(string path) { - ValidateFilePath(filePath); + ValidateFilePath(path); var canWrite = false; try { - using (var fs = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.Write)) + using (var fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write)) { canWrite = fs.CanWrite; } @@ -155,7 +168,7 @@ { if (!canWrite) { - throw new ArgumentException(string.Format(Resources.Error_General_output_error_0, filePath)); + throw new ArgumentException(string.Format(Resources.Error_General_output_error_0, path), nameof(path)); } } } Index: Core/Common/test/Core.Common.Utils.Test/FileUtilsTest.cs =================================================================== diff -u -r6cc96c5f52e06c2dc083a1ae3eb56d358b28a62b -r5aa0269872b446cab9f68c55dead92b6c5f49a64 --- Core/Common/test/Core.Common.Utils.Test/FileUtilsTest.cs (.../FileUtilsTest.cs) (revision 6cc96c5f52e06c2dc083a1ae3eb56d358b28a62b) +++ Core/Common/test/Core.Common.Utils.Test/FileUtilsTest.cs (.../FileUtilsTest.cs) (revision 5aa0269872b446cab9f68c55dead92b6c5f49a64) @@ -245,9 +245,8 @@ TestDelegate call = () => FileUtils.ValidateFilePathIsWritable(filePath); // Assert - string message = Assert.Throws(call).Message; - Assert.AreEqual($"Er is een onverwachte fout opgetreden tijdens het schrijven van het bestand '{filePath}'.", message); - + string expectedMessage = $"Er is een onverwachte fout opgetreden tijdens het schrijven van het bestand '{filePath}'."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); File.SetAttributes(filePath, attributes); } } Fisheye: Tag 5aa0269872b446cab9f68c55dead92b6c5f49a64 refers to a dead (removed) revision in file `Migration/Core/src/Migration.Core.Storage/Exceptions/CriticalDatabaseMigrationException.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Migration/Core/src/Migration.Core.Storage/Migration.Core.Storage.csproj =================================================================== diff -u -r4d5dca55a70d246ccfc093c982e9805d9c07301e -r5aa0269872b446cab9f68c55dead92b6c5f49a64 --- Migration/Core/src/Migration.Core.Storage/Migration.Core.Storage.csproj (.../Migration.Core.Storage.csproj) (revision 4d5dca55a70d246ccfc093c982e9805d9c07301e) +++ Migration/Core/src/Migration.Core.Storage/Migration.Core.Storage.csproj (.../Migration.Core.Storage.csproj) (revision 5aa0269872b446cab9f68c55dead92b6c5f49a64) @@ -50,17 +50,12 @@ Properties\GlobalAssembly.cs - - True True Resources.resx - - - Index: Migration/Core/test/Migration.Core.Storage.Test/Migration.Core.Storage.Test.csproj =================================================================== diff -u -r6cc96c5f52e06c2dc083a1ae3eb56d358b28a62b -r5aa0269872b446cab9f68c55dead92b6c5f49a64 --- Migration/Core/test/Migration.Core.Storage.Test/Migration.Core.Storage.Test.csproj (.../Migration.Core.Storage.Test.csproj) (revision 6cc96c5f52e06c2dc083a1ae3eb56d358b28a62b) +++ Migration/Core/test/Migration.Core.Storage.Test/Migration.Core.Storage.Test.csproj (.../Migration.Core.Storage.Test.csproj) (revision 5aa0269872b446cab9f68c55dead92b6c5f49a64) @@ -45,6 +45,10 @@ ..\..\..\..\packages\NUnit.3.6.0\lib\net40\nunit.framework.dll True + + ..\..\..\..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll + True + @@ -61,10 +65,7 @@ Properties\GlobalAssembly.cs - - - @@ -81,6 +82,14 @@ {D749EE4C-CE50-4C17-BF01-9A953028C126} Core.Common.TestUtil + + {EED7826A-5397-4EEB-A1F8-A7550078459E} + Migration.Ringtoets.Data + + + {D08DB9E2-6861-44C8-A725-71A70274CC77} + Migration.Scripts.Data + {EFD7E662-5B69-4B71-A448-565B64E9C033} Migration.Core.Storage Index: Migration/Core/test/Migration.Core.Storage.Test/packages.config =================================================================== diff -u -r6a5d7b40b7ba4dcb73e393075338352d194e97c2 -r5aa0269872b446cab9f68c55dead92b6c5f49a64 --- Migration/Core/test/Migration.Core.Storage.Test/packages.config (.../packages.config) (revision 6a5d7b40b7ba4dcb73e393075338352d194e97c2) +++ Migration/Core/test/Migration.Core.Storage.Test/packages.config (.../packages.config) (revision 5aa0269872b446cab9f68c55dead92b6c5f49a64) @@ -23,4 +23,5 @@ --> + \ No newline at end of file Index: Migration/Ringtoets/src/Migration.Ringtoets.Data/Migration.Ringtoets.Data.csproj =================================================================== diff -u -r4d5dca55a70d246ccfc093c982e9805d9c07301e -r5aa0269872b446cab9f68c55dead92b6c5f49a64 --- Migration/Ringtoets/src/Migration.Ringtoets.Data/Migration.Ringtoets.Data.csproj (.../Migration.Ringtoets.Data.csproj) (revision 4d5dca55a70d246ccfc093c982e9805d9c07301e) +++ Migration/Ringtoets/src/Migration.Ringtoets.Data/Migration.Ringtoets.Data.csproj (.../Migration.Ringtoets.Data.csproj) (revision 5aa0269872b446cab9f68c55dead92b6c5f49a64) @@ -34,21 +34,46 @@ + + + ..\..\..\..\packages\System.Data.SQLite.Core.1.0.104.0\lib\net40\System.Data.SQLite.dll + True + Properties\GlobalAssembly.cs - - Copying.licenseheader + + + + {3BBFD65B-B277-4E50-AE6D-BD24C3434609} + Core.Common.Base + + + {E344867E-9AC9-44C8-88A5-8185681679A9} + Core.Common.IO + + + {D08DB9E2-6861-44C8-A725-71A70274CC77} + Migration.Scripts.Data + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file Index: Migration/Scripts/src/Migration.Scripts.Data/Exceptions/CriticalDatabaseMigrationException.cs =================================================================== diff -u --- Migration/Scripts/src/Migration.Scripts.Data/Exceptions/CriticalDatabaseMigrationException.cs (revision 0) +++ Migration/Scripts/src/Migration.Scripts.Data/Exceptions/CriticalDatabaseMigrationException.cs (revision 5aa0269872b446cab9f68c55dead92b6c5f49a64) @@ -0,0 +1,38 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Runtime.Serialization; + +namespace Migration.Core.Storage.Exceptions +{ + [Serializable] + public class CriticalDatabaseMigrationException : Exception + { + public CriticalDatabaseMigrationException() { } + + public CriticalDatabaseMigrationException(string message) : base(message) { } + + public CriticalDatabaseMigrationException(string message, Exception inner) : base(message, inner) { } + + protected CriticalDatabaseMigrationException(SerializationInfo info, StreamingContext context) : base(info, context) { } + } +} \ No newline at end of file Index: Migration/Scripts/src/Migration.Scripts.Data/Migration.Scripts.Data.csproj =================================================================== diff -u -r4d5dca55a70d246ccfc093c982e9805d9c07301e -r5aa0269872b446cab9f68c55dead92b6c5f49a64 --- Migration/Scripts/src/Migration.Scripts.Data/Migration.Scripts.Data.csproj (.../Migration.Scripts.Data.csproj) (revision 4d5dca55a70d246ccfc093c982e9805d9c07301e) +++ Migration/Scripts/src/Migration.Scripts.Data/Migration.Scripts.Data.csproj (.../Migration.Scripts.Data.csproj) (revision 5aa0269872b446cab9f68c55dead92b6c5f49a64) @@ -34,6 +34,11 @@ + + + ..\..\..\..\packages\System.Data.SQLite.Core.1.0.104.0\lib\net40\System.Data.SQLite.dll + True + @@ -45,11 +50,17 @@ True Resources.resx + + + + + Copying.licenseheader + @@ -59,12 +70,36 @@ - + - + + + + {3BBFD65B-B277-4E50-AE6D-BD24C3434609} + Core.Common.Base + + + {E344867E-9AC9-44C8-88A5-8185681679A9} + Core.Common.IO + + + {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98} + Core.Common.Utils + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file