Index: Ringtoets/Migration/test/Ringtoets.Migration.Core.TestUtil.Test/MigratedDatabaseReaderTest.cs
===================================================================
diff -u
--- Ringtoets/Migration/test/Ringtoets.Migration.Core.TestUtil.Test/MigratedDatabaseReaderTest.cs (revision 0)
+++ Ringtoets/Migration/test/Ringtoets.Migration.Core.TestUtil.Test/MigratedDatabaseReaderTest.cs (revision 44f025f200c1277acdad97cede05d4e62c5717c7)
@@ -0,0 +1,47 @@
+// Copyright (C) Stichting Deltares 2017. 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 Ringtoets.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/Ringtoets.Migration.Core.TestUtil.Test/Ringtoets.Migration.Core.TestUtil.Test.csproj
===================================================================
diff -u -r9999a33582eb7e1d3b07b76e4fcce9e972adccc0 -r44f025f200c1277acdad97cede05d4e62c5717c7
--- Ringtoets/Migration/test/Ringtoets.Migration.Core.TestUtil.Test/Ringtoets.Migration.Core.TestUtil.Test.csproj (.../Ringtoets.Migration.Core.TestUtil.Test.csproj) (revision 9999a33582eb7e1d3b07b76e4fcce9e972adccc0)
+++ Ringtoets/Migration/test/Ringtoets.Migration.Core.TestUtil.Test/Ringtoets.Migration.Core.TestUtil.Test.csproj (.../Ringtoets.Migration.Core.TestUtil.Test.csproj) (revision 44f025f200c1277acdad97cede05d4e62c5717c7)
@@ -14,12 +14,52 @@
+
+
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}
+ Ringtoets.Storage.Core
+
+
+ {FAC55B92-E259-43D6-B9A1-5BDA6C834359}
+ Ringtoets.Migration.Core
+
+
+ {C98D99C5-2ADD-4693-916C-71BF78750412}
+ Ringtoets.Migration.Core.TestUtil
+
+
\ No newline at end of file
Index: Ringtoets/Migration/test/Ringtoets.Migration.Core.TestUtil.Test/RingtoetsProjectMigrationTestHelperTest.cs
===================================================================
diff -u
--- Ringtoets/Migration/test/Ringtoets.Migration.Core.TestUtil.Test/RingtoetsProjectMigrationTestHelperTest.cs (revision 0)
+++ Ringtoets/Migration/test/Ringtoets.Migration.Core.TestUtil.Test/RingtoetsProjectMigrationTestHelperTest.cs (revision 44f025f200c1277acdad97cede05d4e62c5717c7)
@@ -0,0 +1,156 @@
+// Copyright (C) Stichting Deltares 2017. 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 Ringtoets.Storage.Core;
+
+namespace Ringtoets.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.Application.Ringtoets.Migration.Core,
+ $"MigrationTestProject{v}.rtd")).GetVersion()).ToList();
+
+ // Assert
+ IEnumerable expectedProjectVersions = new[]
+ {
+ "5",
+ "17.1",
+ "17.2",
+ "17.3"
+ };
+ 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, "Application", "Ringtoets", "src", "Application.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((bool) IOUtils.IsValidFilePath(filePath));
+ Assert.IsTrue(File.Exists(filePath));
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 44f025f200c1277acdad97cede05d4e62c5717c7 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/MigratedDatabaseReaderTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/Ringtoets.Storage.Core.TestUtil.Test.csproj
===================================================================
diff -u -r045072235b0878d2ed7407d4d5d9674250df1a6d -r44f025f200c1277acdad97cede05d4e62c5717c7
--- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/Ringtoets.Storage.Core.TestUtil.Test.csproj (.../Ringtoets.Storage.Core.TestUtil.Test.csproj) (revision 045072235b0878d2ed7407d4d5d9674250df1a6d)
+++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/Ringtoets.Storage.Core.TestUtil.Test.csproj (.../Ringtoets.Storage.Core.TestUtil.Test.csproj) (revision 44f025f200c1277acdad97cede05d4e62c5717c7)
@@ -28,10 +28,8 @@
-
-
Fisheye: Tag 44f025f200c1277acdad97cede05d4e62c5717c7 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/RingtoetsProjectMigrationTestHelperTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?