Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsProjectMigratorTest.cs =================================================================== diff -u -rf1cad32061f6bc6fcea1ac19cf7e5c20289c2e2e -r0ec3500b27a04d8b0d942662301e03d10c277a02 --- Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsProjectMigratorTest.cs (.../RingtoetsProjectMigratorTest.cs) (revision f1cad32061f6bc6fcea1ac19cf7e5c20289c2e2e) +++ Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsProjectMigratorTest.cs (.../RingtoetsProjectMigratorTest.cs) (revision 0ec3500b27a04d8b0d942662301e03d10c277a02) @@ -24,6 +24,7 @@ using System.IO; using System.Linq; using Application.Ringtoets.Migration.Core; +using Application.Ringtoets.Storage.TestUtil; using Core.Common.Base.Storage; using Core.Common.Gui; using Core.Common.TestUtil; @@ -130,9 +131,9 @@ var inquiryHelper = mocks.Stub(); mocks.ReplayAll(); - const string file = "UnsupportedVersion8.rtd"; - const string fileVersion = "8"; - string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, file); + string sourceFilePath = RingtoetsProjectMigrationTestHelper.GetOutdatedUnSupportedProjectFilePath(); + var versionedFile = new RingtoetsVersionedFile(sourceFilePath); + string fileVersion = versionedFile.GetVersion(); var migrator = new RingtoetsProjectMigrator(inquiryHelper); var shouldMigrate = MigrationNeeded.Yes; @@ -161,8 +162,7 @@ inquiryHelper.Expect(h => h.InquireContinuation(question)).Return(confirmContinuation); mocks.ReplayAll(); - const string file = "FullTestProject164.rtd"; - string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, file); + string sourceFilePath = RingtoetsProjectMigrationTestHelper.GetOutdatedSupportedProjectFilePath(); var migrator = new RingtoetsProjectMigrator(inquiryHelper); @@ -194,18 +194,10 @@ var inquiryHelper = mocks.Stub(); mocks.ReplayAll(); - const string currentProjectVersionFile = "FullTestProject171.rtd"; - string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, currentProjectVersionFile); + string sourceFilePath = RingtoetsProjectMigrationTestHelper.GetLatestProjectFilePath(); - var versionedFile = new RingtoetsVersionedFile(sourceFilePath); - string testProjectVersion = versionedFile.GetVersion(); - var migrator = new RingtoetsProjectMigrator(inquiryHelper); - // Pre-condition - string assertionMessage = $"Database version {testProjectVersion} of the testproject must match with the current database version {currentDatabaseVersion}."; - Assert.AreEqual(currentDatabaseVersion, testProjectVersion, assertionMessage); - // Call MigrationNeeded shouldMigrate = migrator.ShouldMigrate(sourceFilePath); @@ -319,7 +311,7 @@ var migrator = new RingtoetsProjectMigrator(inquiryHelper); - string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); + string sourceFilePath = RingtoetsProjectMigrationTestHelper.GetOutdatedSupportedProjectFilePath(); // Call TestDelegate call = () => migrator.Migrate(sourceFilePath, null); @@ -366,8 +358,7 @@ var migrator = new RingtoetsProjectMigrator(inquiryHelper); - string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, - "FullTestProject164.rtd"); + string sourceFilePath = RingtoetsProjectMigrationTestHelper.GetOutdatedSupportedProjectFilePath(); // Call TestDelegate call = () => migrator.Migrate(sourceFilePath, invalidFilePath); @@ -384,7 +375,7 @@ public void GivenMigratorAndSupportedFile_WhenValidTargetLocationGiven_ThenFileSuccessFullyMigrates() { // Given - string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); + string sourceFilePath = RingtoetsProjectMigrationTestHelper.GetOutdatedSupportedProjectFilePath(); string targetFile = $"{nameof(RingtoetsProjectMigratorTest)}." + $"{nameof(GivenMigratorAndSupportedFile_WhenValidTargetLocationGiven_ThenFileSuccessFullyMigrates)}.rtd"; @@ -421,9 +412,9 @@ public void Migrate_UnableToSaveAtTargetFilePath_MigrationFailsAndLogsError() { // Setup - string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); + string sourceFilePath = RingtoetsProjectMigrationTestHelper.GetOutdatedSupportedProjectFilePath(); string targetFile = $"{nameof(RingtoetsProjectMigratorTest)}." + - $"{nameof(Migrate_UnableToSaveAtTargetFilePath_MigrationFailsAndLogsError)}.rtd"; + $"{nameof(Migrate_UnableToSaveAtTargetFilePath_MigrationFailsAndLogsError)}.rtd"; string targetFilePath = Path.Combine(TestHelper.GetScratchPadPath(), testDirectory, targetFile); var mocks = new MockRepository(); @@ -459,7 +450,7 @@ public void Migrate_UnsupportedSourceFileVersion_MigrationFailsAndLogsError() { // Setup - string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "UnsupportedVersion8.rtd"); + string sourceFilePath = RingtoetsProjectMigrationTestHelper.GetOutdatedUnSupportedProjectFilePath(); string targetFile = $"{nameof(RingtoetsProjectMigratorTest)}." + $"{nameof(Migrate_UnsupportedSourceFileVersion_MigrationFailsAndLogsError)}"; string targetFilePath = Path.Combine(TestHelper.GetScratchPadPath(), testDirectory, targetFile); @@ -494,7 +485,7 @@ public void Migrate_TargetFileSameAsSourceFile_MigrationFailsAndLogsError() { // Setup - string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); + string sourceFilePath = RingtoetsProjectMigrationTestHelper.GetOutdatedSupportedProjectFilePath(); var mocks = new MockRepository(); var inquiryHelper = mocks.Stub();