Index: Ringtoets.sln
===================================================================
diff -u -r677c55880e063eaf9da63c8bc6a91dd29c3a9ab3 -rb746c8870b5941e0d01a25c202a0fd22c72c9711
--- Ringtoets.sln (.../Ringtoets.sln) (revision 677c55880e063eaf9da63c8bc6a91dd29c3a9ab3)
+++ Ringtoets.sln (.../Ringtoets.sln) (revision b746c8870b5941e0d01a25c202a0fd22c72c9711)
@@ -1967,7 +1967,7 @@
{C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC}
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riskeer.Migration.Core.TestUtil.Test", "Ringtoets\Migration\test\Ringtoets.Migration.Core.TestUtil.Test\Riskeer.Migration.Core.TestUtil.Test.csproj", "{F7E70C59-3747-4871-B741-BE3619B77C92}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riskeer.Migration.Core.TestUtil.Test", "Ringtoets\Migration\test\Riskeer.Migration.Core.TestUtil.Test\Riskeer.Migration.Core.TestUtil.Test.csproj", "{F7E70C59-3747-4871-B741-BE3619B77C92}"
ProjectSection(ProjectDependencies) = postProject
{C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC}
EndProjectSection
Fisheye: Tag b746c8870b5941e0d01a25c202a0fd22c72c9711 refers to a dead (removed) revision in file `Ringtoets/Migration/test/Ringtoets.Migration.Core.TestUtil.Test/App.config'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag b746c8870b5941e0d01a25c202a0fd22c72c9711 refers to a dead (removed) revision in file `Ringtoets/Migration/test/Ringtoets.Migration.Core.TestUtil.Test/MigratedDatabaseReaderTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag b746c8870b5941e0d01a25c202a0fd22c72c9711 refers to a dead (removed) revision in file `Ringtoets/Migration/test/Ringtoets.Migration.Core.TestUtil.Test/Properties/AssemblyInfo.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag b746c8870b5941e0d01a25c202a0fd22c72c9711 refers to a dead (removed) revision in file `Ringtoets/Migration/test/Ringtoets.Migration.Core.TestUtil.Test/RingtoetsProjectMigrationTestHelperTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag b746c8870b5941e0d01a25c202a0fd22c72c9711 refers to a dead (removed) revision in file `Ringtoets/Migration/test/Ringtoets.Migration.Core.TestUtil.Test/Riskeer.Migration.Core.TestUtil.Test.csproj'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag b746c8870b5941e0d01a25c202a0fd22c72c9711 refers to a dead (removed) revision in file `Ringtoets/Migration/test/Ringtoets.Migration.Core.TestUtil.Test/packages.config'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/App.config
===================================================================
diff -u
--- Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/App.config (revision 0)
+++ Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/App.config (revision b746c8870b5941e0d01a25c202a0fd22c72c9711)
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/MigratedDatabaseReaderTest.cs
===================================================================
diff -u
--- Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/MigratedDatabaseReaderTest.cs (revision 0)
+++ Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/MigratedDatabaseReaderTest.cs (revision b746c8870b5941e0d01a25c202a0fd22c72c9711)
@@ -0,0 +1,47 @@
+// Copyright (C) Stichting Deltares 2018. 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.IO;
+using Core.Common.IO.Readers;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+
+namespace Riskeer.Migration.Core.TestUtil.Test
+{
+ [TestFixture]
+ public class MigratedDatabaseReaderTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ string path = Path.Combine(TestHelper.GetTestDataPath(TestDataPath.Core.Common.IO, "SqLiteDatabaseReaderBase"),
+ "empty.sqlite");
+
+ // Call
+ using (var reader = new MigratedDatabaseReader(path))
+ {
+ // Assert
+ Assert.IsInstanceOf(reader);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/Properties/AssemblyInfo.cs
===================================================================
diff -u
--- Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/Properties/AssemblyInfo.cs (revision 0)
+++ Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/Properties/AssemblyInfo.cs (revision b746c8870b5941e0d01a25c202a0fd22c72c9711)
@@ -0,0 +1,25 @@
+// Copyright (C) Stichting Deltares 2018. 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.Reflection;
+
+[assembly: AssemblyTitle("Riskeer.Migration.Core.TestUtil.Test")]
+[assembly: AssemblyProduct("Riskeer.Migration.Core.TestUtil.Test")]
\ No newline at end of file
Index: Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/RingtoetsProjectMigrationTestHelperTest.cs
===================================================================
diff -u
--- Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/RingtoetsProjectMigrationTestHelperTest.cs (revision 0)
+++ Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/RingtoetsProjectMigrationTestHelperTest.cs (revision b746c8870b5941e0d01a25c202a0fd22c72c9711)
@@ -0,0 +1,157 @@
+// Copyright (C) Stichting Deltares 2018. 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.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Core.Common.Base.Data;
+using Core.Common.TestUtil;
+using Core.Common.Util;
+using NUnit.Framework;
+using Ringtoets.Common.Util;
+using Riskeer.Storage.Core;
+
+namespace Riskeer.Migration.Core.TestUtil.Test
+{
+ [TestFixture]
+ public class RingtoetsProjectMigrationTestHelperTest
+ {
+ private readonly string currentDatabaseVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+
+ [Test]
+ public void GetLatestProjectFilePath_Always_ReturnsProjectFilePathToLatestProjectVersion()
+ {
+ // Call
+ string latestProjectFilePath = RingtoetsProjectMigrationTestHelper.GetLatestProjectFilePath();
+
+ // Assert
+ AssertFilePath(latestProjectFilePath);
+
+ var versionedFile = new RingtoetsVersionedFile(latestProjectFilePath);
+ string actualTestProjectVersion = versionedFile.GetVersion();
+ string assertionMessage = $"Database version {actualTestProjectVersion} of the testproject must match with the current database version {currentDatabaseVersion}.";
+ Assert.AreEqual(currentDatabaseVersion, actualTestProjectVersion, assertionMessage);
+ }
+
+ [Test]
+ public void GetLatestProjectFilePath_Always_ReturnsProjectThatCanBeLoaded()
+ {
+ // Setup
+ string latestProjectFilePath = RingtoetsProjectMigrationTestHelper.GetLatestProjectFilePath();
+
+ // Call
+ IProject project = new StorageSqLite().LoadProject(latestProjectFilePath);
+
+ // Assert
+ Assert.IsNotNull(project);
+ }
+
+ [Test]
+ public void GetOutdatedSupportedProjectFilePath_Always_ReturnsProjectFilePathToSupportedProjectVersion()
+ {
+ // Call
+ string projectFilePath = RingtoetsProjectMigrationTestHelper.GetOutdatedSupportedProjectFilePath();
+
+ // Assert
+ AssertFilePath(projectFilePath);
+
+ var versionedFile = new RingtoetsVersionedFile(projectFilePath);
+ string actualTestProjectVersion = versionedFile.GetVersion();
+ var migrator = new RingtoetsSqLiteDatabaseFileMigrator();
+ Assert.IsTrue(migrator.IsVersionSupported(actualTestProjectVersion));
+ }
+
+ [Test]
+ public void GetAllOutdatedSupportedProjectFileVersions_Always_ReturnsAllProjectFilePathsToSupportedProjectVersions()
+ {
+ // Setup
+ string[] versions = RingtoetsProjectMigrationTestHelper.GetAllOutdatedSupportedProjectFileVersions().ToArray();
+
+ // Call
+ List returnedProjectVersions = versions.Select(v => new RingtoetsVersionedFile(TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Migration.Core,
+ $"MigrationTestProject{v}.rtd")).GetVersion()).ToList();
+
+ // Assert
+ IEnumerable expectedProjectVersions = new[]
+ {
+ "5",
+ "17.1",
+ "17.2",
+ "17.3",
+ "18.1"
+ };
+ CollectionAssert.AreEqual(expectedProjectVersions, returnedProjectVersions);
+ }
+
+ [Test]
+ public void GetOutdatedUnsupportedProjectFilePath_Always_ReturnsProjectFilePathToUnsupportedProjectVersion()
+ {
+ // Call
+ string projectFilePath = RingtoetsProjectMigrationTestHelper.GetOutdatedUnSupportedProjectFilePath();
+
+ // Assert
+ AssertFilePath(projectFilePath);
+
+ var versionedFile = new RingtoetsVersionedFile(projectFilePath);
+ string actualTestProjectVersion = versionedFile.GetVersion();
+ var migrator = new RingtoetsSqLiteDatabaseFileMigrator();
+ Assert.IsFalse(migrator.IsVersionSupported(actualTestProjectVersion));
+ }
+
+ [Test]
+ public void AssertMigrationScript_IsEqualToStorageScript()
+ {
+ // Setup
+ string solutionRoot = TestHelper.SolutionRoot;
+ const string baseFileName = "DatabaseStructure";
+ string migrationFileName = $"{baseFileName}{currentDatabaseVersion}";
+
+ string applicationScriptFilePath = Path.Combine(solutionRoot, "build", $"{baseFileName}.sql");
+ string migrationScriptFilePath = Path.Combine(solutionRoot, "Ringtoets", "Migration", "src", "Ringtoets.Migration.Core", "EmbeddedResources", $"{migrationFileName}.sql");
+
+ // Precondition
+ AssertFilePath(applicationScriptFilePath);
+ AssertFilePath(migrationScriptFilePath);
+
+ // Call
+ string[] applicationScriptContents = File.ReadAllLines(applicationScriptFilePath);
+ string[] migrationScriptContents = File.ReadAllLines(migrationScriptFilePath);
+
+ // Assert
+ int expectedAmountOfLines = applicationScriptContents.Length;
+ const string assertionMessage = "Application and migration SQL scripts do not have the same length.";
+ Assert.AreEqual(expectedAmountOfLines, migrationScriptContents.Length, assertionMessage);
+
+ for (var i = 0; i < expectedAmountOfLines; i++)
+ {
+ Assert.AreEqual(applicationScriptContents[i],
+ migrationScriptContents[i],
+ $"Mismatch between application and migration SQL scripts detected at line: {i + 1}.");
+ }
+ }
+
+ private static void AssertFilePath(string filePath)
+ {
+ Assert.IsTrue(IOUtils.IsValidFilePath(filePath));
+ Assert.IsTrue(File.Exists(filePath));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/Riskeer.Migration.Core.TestUtil.Test.csproj
===================================================================
diff -u
--- Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/Riskeer.Migration.Core.TestUtil.Test.csproj (revision 0)
+++ Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/Riskeer.Migration.Core.TestUtil.Test.csproj (revision b746c8870b5941e0d01a25c202a0fd22c72c9711)
@@ -0,0 +1,86 @@
+
+
+
+ {F7E70C59-3747-4871-B741-BE3619B77C92}
+ Riskeer.Migration.Core.TestUtil.Test
+ Riskeer.Migration.Core.TestUtil.Test
+
+
+
+
+ ..\..\..\..\packages\EntityFramework.6.0.0\lib\net40\EntityFramework.dll
+
+
+ ..\..\..\..\packages\EntityFramework.6.0.0\lib\net40\EntityFramework.SqlServer.dll
+
+
+ ..\..\..\..\packages\NUnit.3.8.1\lib\net40\nunit.framework.dll
+
+
+
+
+ ..\..\..\..\packages\System.Data.SQLite.Core.1.0.106.0\lib\net40\System.Data.SQLite.dll
+
+
+ ..\..\..\..\packages\System.Data.SQLite.EF6.1.0.106.0\lib\net40\System.Data.SQLite.EF6.dll
+ True
+
+
+
+
+
+
+
+
+
+ Copying.licenseheader
+
+
+
+
+
+
+ {3BBFD65B-B277-4E50-AE6D-BD24C3434609}
+ Core.Common.Base
+
+
+ {E344867E-9AC9-44C8-88A5-8185681679A9}
+ Core.Common.IO
+
+
+ {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98}
+ Core.Common.Util
+
+
+ {D749EE4C-CE50-4C17-BF01-9A953028C126}
+ Core.Common.TestUtil
+
+
+ {efd7e662-5b69-4b71-a448-565b64e9c033}
+ Migration.Core.Storage
+
+
+ {6A074D65-A81C-4C1C-8E24-F36C916E4ED7}
+ Ringtoets.Common.Util
+
+
+ {50963F12-448C-41BA-A62C-CDB0AB8D21E0}
+ Riskeer.Storage.Core
+
+
+ {fac55b92-e259-43d6-b9a1-5bda6c834359}
+ Riskeer.Migration.Core
+
+
+ {C98D99C5-2ADD-4693-916C-71BF78750412}
+ Riskeer.Migration.Core.TestUtil
+
+
+
+
+
+ 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: Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/packages.config
===================================================================
diff -u
--- Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/packages.config (revision 0)
+++ Ringtoets/Migration/test/Riskeer.Migration.Core.TestUtil.Test/packages.config (revision b746c8870b5941e0d01a25c202a0fd22c72c9711)
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
\ No newline at end of file