Index: Migration/Core/src/Migration.Core.Storage/Migration.Core.Storage.csproj =================================================================== diff -u -rf312ebb819e2bae83d5e3b55aa92773b79712bfa -r1a90e7c188f16e5e075c39bee9c715bfddbc00f3 --- Migration/Core/src/Migration.Core.Storage/Migration.Core.Storage.csproj (.../Migration.Core.Storage.csproj) (revision f312ebb819e2bae83d5e3b55aa92773b79712bfa) +++ Migration/Core/src/Migration.Core.Storage/Migration.Core.Storage.csproj (.../Migration.Core.Storage.csproj) (revision 1a90e7c188f16e5e075c39bee9c715bfddbc00f3) @@ -71,11 +71,6 @@ - - DbContext\DatabaseStructure - - - {3BBFD65B-B277-4E50-AE6D-BD24C3434609} Core.Common.Base Index: Migration/Core/test/Migration.Core.Storage.Test/VersionedFileMigratorTest.cs =================================================================== diff -u -rf312ebb819e2bae83d5e3b55aa92773b79712bfa -r1a90e7c188f16e5e075c39bee9c715bfddbc00f3 --- Migration/Core/test/Migration.Core.Storage.Test/VersionedFileMigratorTest.cs (.../VersionedFileMigratorTest.cs) (revision f312ebb819e2bae83d5e3b55aa92773b79712bfa) +++ Migration/Core/test/Migration.Core.Storage.Test/VersionedFileMigratorTest.cs (.../VersionedFileMigratorTest.cs) (revision 1a90e7c188f16e5e075c39bee9c715bfddbc00f3) @@ -77,7 +77,6 @@ // Setup string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Migration.Core.Storage, "Demo164.rtd"); VersionedFile versionedFile = new VersionedFile(sourceFilePath); - var migrator = new VersionedFileMigrator(); // Call bool needsMigrade = VersionedFileMigrator.NeedsMigrade(versionedFile, "17.1"); @@ -92,7 +91,6 @@ // Setup string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Migration.Core.Storage, "Demo164.rtd"); VersionedFile versionedFile = new VersionedFile(sourceFilePath); - var migrator = new VersionedFileMigrator(); // Call bool needsMigrade = VersionedFileMigrator.NeedsMigrade(versionedFile, "4"); Index: Migration/Scripts/src/Migration.Scripts.Data/Exceptions/CriticalDatabaseMigrationException.cs =================================================================== diff -u -r922df88501b79d938a774941d4a9eb60c91cd734 -r1a90e7c188f16e5e075c39bee9c715bfddbc00f3 --- Migration/Scripts/src/Migration.Scripts.Data/Exceptions/CriticalDatabaseMigrationException.cs (.../CriticalDatabaseMigrationException.cs) (revision 922df88501b79d938a774941d4a9eb60c91cd734) +++ Migration/Scripts/src/Migration.Scripts.Data/Exceptions/CriticalDatabaseMigrationException.cs (.../CriticalDatabaseMigrationException.cs) (revision 1a90e7c188f16e5e075c39bee9c715bfddbc00f3) @@ -24,13 +24,33 @@ namespace Migration.Scripts.Data.Exceptions { + /// + /// The exception that is thrown when a database migration class encounters a critical error + /// during the migration. + /// [Serializable] public class CriticalDatabaseMigrationException : Exception { + /// + /// Initializes a new instance of the class. + /// public CriticalDatabaseMigrationException() { } + /// + /// Initializes a new instance of the class + /// with a specified error message. + /// + /// The error message that explains the reason for the exception. public CriticalDatabaseMigrationException(string message) : base(message) { } + /// + /// Initializes a new instance of the class + /// with a specified error message and a reference to the inner exception that is + /// the cause of this exception. + /// + /// The error message that explains the reason for the exception. + /// The exception that is the cause of the current exception, + /// or a null reference if no inner exception is specified. public CriticalDatabaseMigrationException(string message, Exception inner) : base(message, inner) { } protected CriticalDatabaseMigrationException(SerializationInfo info, StreamingContext context) : base(info, context) { } Index: Migration/Scripts/test/Migration.Scripts.Data.Test/Exceptions/CriticalDatabaseMigrationExceptionTest.cs =================================================================== diff -u --- Migration/Scripts/test/Migration.Scripts.Data.Test/Exceptions/CriticalDatabaseMigrationExceptionTest.cs (revision 0) +++ Migration/Scripts/test/Migration.Scripts.Data.Test/Exceptions/CriticalDatabaseMigrationExceptionTest.cs (revision 1a90e7c188f16e5e075c39bee9c715bfddbc00f3) @@ -0,0 +1,114 @@ +// 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 Core.Common.TestUtil; +using Migration.Scripts.Data.Exceptions; +using NUnit.Framework; + +namespace Migration.Scripts.Data.Test.Exceptions +{ + [TestFixture] + public class CriticalDatabaseMigrationExceptionTest + { + [Test] + [SetCulture("en-US")] + public void DefaultConstructor_ExpectedValues() + { + // Call + var exception = new CriticalDatabaseMigrationException(); + + // Assert + Assert.IsInstanceOf(exception); + var expectedMessage = $"Exception of type '{exception.GetType()}' was thrown."; + Assert.AreEqual(expectedMessage, exception.Message); + CollectionAssert.IsEmpty(exception.Data); + Assert.IsNull(exception.HelpLink); + Assert.IsNull(exception.InnerException); + Assert.IsNull(exception.Source); + Assert.IsNull(exception.StackTrace); + Assert.IsNull(exception.TargetSite); + } + + [Test] + public void MessageConstructor_ExpectedValues() + { + // Setup + const string messageText = ""; + + // Call + var exception = new CriticalDatabaseMigrationException(messageText); + + // Assert + Assert.IsInstanceOf(exception); + Assert.AreEqual(messageText, exception.Message); + CollectionAssert.IsEmpty(exception.Data); + Assert.IsNull(exception.HelpLink); + Assert.IsNull(exception.InnerException); + Assert.IsNull(exception.Source); + Assert.IsNull(exception.StackTrace); + Assert.IsNull(exception.TargetSite); + } + + [Test] + public void MessageAndInnerExceptionConstructor_ExpectedValues() + { + // Setup + var innerException = new Exception(); + const string messageText = ""; + + // Call + var exception = new CriticalDatabaseMigrationException(messageText, innerException); + + // Assert + Assert.IsInstanceOf(exception); + Assert.AreEqual(messageText, exception.Message); + CollectionAssert.IsEmpty(exception.Data); + Assert.IsNull(exception.HelpLink); + Assert.AreSame(innerException, exception.InnerException); + Assert.IsNull(exception.Source); + Assert.IsNull(exception.StackTrace); + Assert.IsNull(exception.TargetSite); + } + + [Test] + public void Constructor_SerializationRoundTrip_ExceptionProperlyInitialized() + { + // Setup + var originalInnerException = new Exception("inner"); + var originalException = new CriticalDatabaseMigrationException("outer", originalInnerException); + + // Precondition + Assert.IsNotNull(originalException.InnerException); + Assert.IsNull(originalException.InnerException.InnerException); + + // Call + CriticalDatabaseMigrationException persistedException = SerializationTestHelper.SerializeAndDeserializeException(originalException); + + // Assert + Assert.AreEqual(originalException.Message, persistedException.Message); + Assert.IsNotNull(persistedException.InnerException); + Assert.AreEqual(originalException.InnerException.GetType(), persistedException.InnerException.GetType()); + Assert.AreEqual(originalException.InnerException.Message, persistedException.InnerException.Message); + Assert.IsNull(persistedException.InnerException.InnerException); + } + } +} \ No newline at end of file Index: Migration/Scripts/test/Migration.Scripts.Data.Test/Migration.Scripts.Data.Test.csproj =================================================================== diff -u -r83fbfb9ccbeaef0916d3485f89d48fdae9b8eb1d -r1a90e7c188f16e5e075c39bee9c715bfddbc00f3 --- Migration/Scripts/test/Migration.Scripts.Data.Test/Migration.Scripts.Data.Test.csproj (.../Migration.Scripts.Data.Test.csproj) (revision 83fbfb9ccbeaef0916d3485f89d48fdae9b8eb1d) +++ Migration/Scripts/test/Migration.Scripts.Data.Test/Migration.Scripts.Data.Test.csproj (.../Migration.Scripts.Data.Test.csproj) (revision 1a90e7c188f16e5e075c39bee9c715bfddbc00f3) @@ -56,6 +56,7 @@ Properties\GlobalAssembly.cs + @@ -81,6 +82,7 @@ Migration.Scripts.Data +