Index: Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsProjectMigrator.cs =================================================================== diff -u -r5af1b7c1e22ec02a2a7395e2de7482cc91681a4e -rac9f1f110b53f4bf66b4f2fe04d34178273ac4fd --- Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsProjectMigrator.cs (.../RingtoetsProjectMigrator.cs) (revision 5af1b7c1e22ec02a2a7395e2de7482cc91681a4e) +++ Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsProjectMigrator.cs (.../RingtoetsProjectMigrator.cs) (revision ac9f1f110b53f4bf66b4f2fe04d34178273ac4fd) @@ -62,7 +62,7 @@ Resources.RingtoetsProject_TypeDescription); } - public bool ShouldMigrate(string filePath) + public MigrationNeeded ShouldMigrate(string filePath) { if (filePath == null) { @@ -76,17 +76,28 @@ if (version.Equals(currentDatabaseVersion)) { - return false; + return MigrationNeeded.No; } - bool isVersionSupported = fileMigrator.IsVersionSupported(version); - if (!isVersionSupported) + if (!fileMigrator.IsVersionSupported(version)) { string errorMessage = string.Format(MigrationCoreStorageResources.Migrate_From_Version_0_To_Version_1_Not_Supported, version, currentDatabaseVersion); log.Error(errorMessage); + return MigrationNeeded.Aborted; } - return isVersionSupported; + + string query = string.Format(Resources.RingtoetsProjectMigrator_Migrate_Outdated_project_file_update_to_current_version_0_inquire, + currentDatabaseVersion); + if (inquiryHelper.InquireContinuation(query)) + { + return MigrationNeeded.Yes; + } + else + { + GenerateMigrationCancelledLogMessage(filePath); + return MigrationNeeded.Aborted; + } } public string Migrate(string filePath) @@ -98,21 +109,14 @@ ValidateProjectPath(filePath); - string query = string.Format( - Resources.RingtoetsProjectMigrator_Migrate_Outdated_project_file_update_to_current_version_0_inquire, - currentDatabaseVersion); - if (inquiryHelper.InquireContinuation(query)) + string suggestedFileName = GetSuggestedFileName(filePath); + string targetLocation = inquiryHelper.GetTargetFileLocation(fileFilter, suggestedFileName); + if (!string.IsNullOrEmpty(targetLocation)) { - string suggestedFileName = GetSuggestedFileName(filePath); - string targetLocation = inquiryHelper.GetTargetFileLocation(fileFilter, suggestedFileName); - if (!string.IsNullOrEmpty(targetLocation)) - { - return MigrateToTargetLocation(filePath, targetLocation); - } + return MigrateToTargetLocation(filePath, targetLocation); } GenerateMigrationCancelledLogMessage(filePath); - return null; } Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsProjectMigratorTest.cs =================================================================== diff -u -r5af1b7c1e22ec02a2a7395e2de7482cc91681a4e -rac9f1f110b53f4bf66b4f2fe04d34178273ac4fd --- Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsProjectMigratorTest.cs (.../RingtoetsProjectMigratorTest.cs) (revision 5af1b7c1e22ec02a2a7395e2de7482cc91681a4e) +++ Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsProjectMigratorTest.cs (.../RingtoetsProjectMigratorTest.cs) (revision ac9f1f110b53f4bf66b4f2fe04d34178273ac4fd) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Collections.Generic; using System.IO; using System.Linq; using Application.Ringtoets.Migration.Core; @@ -110,7 +111,7 @@ } [Test] - public void ShouldMigrate_OutdatedProjectUnsupported_ReturnsFalseAndGeneratesLogMessages() + public void ShouldMigrate_OutdatedProjectUnsupported_ReturnsAbortedAndGeneratesLogMessages() { // Setup var mocks = new MockRepository(); @@ -122,25 +123,30 @@ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, file); var migrator = new RingtoetsProjectMigrator(inquiryHelper); - bool shouldMigrate = true; + var shouldMigrate = MigrationNeeded.Yes; // Call Action call = () => shouldMigrate = migrator.ShouldMigrate(sourceFilePath); // Assert string expectedMessage = $"Het migreren van een projectbestand met versie '{fileVersion}' naar versie '{currentDatabaseVersion}' is niet ondersteund."; TestHelper.AssertLogMessageIsGenerated(call, expectedMessage); - Assert.IsFalse(shouldMigrate); + Assert.AreEqual(MigrationNeeded.Aborted, shouldMigrate); mocks.VerifyAll(); } [Test] - public void ShouldMigrate_OutdatedProjectSupported_ReturnsTrue() + [TestCase(true)] + [TestCase(false)] + public void ShouldMigrate_OutdatedProjectSupported_AskMigrationConfirmationAndReturnBasedOnConfirmation(bool confirmContinuation) { // Setup + string question = "Het project dat u wilt openen is opgeslagen in het formaat van een eerdere versie van Ringtoets." + + $" Weet u zeker dat u het bestand wilt migreren naar het formaat van uw huidige Ringtoetsversie ({currentDatabaseVersion})?"; var mocks = new MockRepository(); - var inquiryHelper = mocks.Stub(); + var inquiryHelper = mocks.StrictMock(); + inquiryHelper.Expect(h => h.InquireContinuation(question)).Return(confirmContinuation); mocks.ReplayAll(); const string file = "FullTestProject164.rtd"; @@ -149,11 +155,22 @@ var migrator = new RingtoetsProjectMigrator(inquiryHelper); // Call - bool shouldMigrate = migrator.ShouldMigrate(sourceFilePath); + MigrationNeeded shouldMigrate = MigrationNeeded.No; + Action call = () => shouldMigrate = migrator.ShouldMigrate(sourceFilePath); // Assert - Assert.IsTrue(shouldMigrate); + var expectedLogMessages = new List(); + if (!confirmContinuation) + { + expectedLogMessages.Add($"Het migreren van het projectbestand '{sourceFilePath}' is geannuleerd."); + } + TestHelper.AssertLogMessagesAreGenerated(call, expectedLogMessages, expectedLogMessages.Count); + var expectedResult = confirmContinuation ? + MigrationNeeded.Yes : + MigrationNeeded.Aborted; + Assert.AreEqual(expectedResult, shouldMigrate); + mocks.VerifyAll(); } @@ -178,10 +195,10 @@ Assert.AreEqual(currentDatabaseVersion, testProjectVersion, assertionMessage); // Call - bool shouldMigrate = migrator.ShouldMigrate(sourceFilePath); + MigrationNeeded shouldMigrate = migrator.ShouldMigrate(sourceFilePath); // Assert - Assert.IsFalse(shouldMigrate); + Assert.AreEqual(MigrationNeeded.No, shouldMigrate); mocks.VerifyAll(); } @@ -227,50 +244,17 @@ } [Test] - [TestCase(true)] - [TestCase(false)] - public void Migrate_Always_DisplaysInquiryMessage(bool confirmMigration) - { - // Setup - string sourceFilePath = "Arbitrary/RingtoetsFile"; - - var mocks = new MockRepository(); - var inquiryHelper = mocks.StrictMock(); - - string message = "Het project dat u wilt openen is opgeslagen in het formaat van een eerdere " + - "versie van Ringtoets. Weet u zeker dat u het bestand wilt migreren naar het formaat van" + - $" uw huidige Ringtoetsversie ({currentDatabaseVersion})?"; - inquiryHelper.Expect(helper => helper.InquireContinuation(message)).Return(confirmMigration); - inquiryHelper.Stub(helper => helper.GetTargetFileLocation(null, null)) - .IgnoreArguments() - .Return(null); - mocks.ReplayAll(); - - var migrator = new RingtoetsProjectMigrator(inquiryHelper); - - // Call - migrator.Migrate(sourceFilePath); - - // Assert - mocks.VerifyAll(); - } - - [Test] public void Migrate_Always_ReturnsSuggestedFileNameAndFileFilter() { // Setup const string projectName = "FullTestProject164"; string sourceFilePath = $"Some/Path/{projectName}.rtd"; - var mocks = new MockRepository(); - var inquiryHelper = mocks.StrictMock(); - - inquiryHelper.Expect(helper => helper.InquireContinuation(null)) - .IgnoreArguments() - .Return(true); - string versionSuffix = currentDatabaseVersion.Replace(".", "-"); string expectedSuggestedFileName = $"{projectName}_{versionSuffix}"; + + var mocks = new MockRepository(); + var inquiryHelper = mocks.StrictMock(); inquiryHelper.Expect(helper => helper.GetTargetFileLocation(new FileFilterGenerator("rtd", "Ringtoets project"), expectedSuggestedFileName)) .Return(null); @@ -286,21 +270,18 @@ } [Test] - public void GivenMigratorAndSupportedFile_WhenContinuedAfterInquiryAndValidTargetLocationGiven_ThenFileSuccessFullyMigrates() + public void GivenMigratorAndSupportedFile_WhenValidTargetLocationGiven_ThenFileSuccessFullyMigrates() { // Given string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); string targetFile = $"{nameof(RingtoetsProjectMigratorTest)}." + - $"{nameof(GivenMigratorAndSupportedFile_WhenContinuedAfterInquiryAndValidTargetLocationGiven_ThenFileSuccessFullyMigrates)}.rtd"; + $"{nameof(GivenMigratorAndSupportedFile_WhenValidTargetLocationGiven_ThenFileSuccessFullyMigrates)}.rtd"; string targetFilePath = Path.Combine(TestHelper.GetScratchPadPath(), targetFile); var mocks = new MockRepository(); var inquiryHelper = mocks.StrictMock(); - inquiryHelper.Expect(helper => helper.InquireContinuation(null)) - .IgnoreArguments() - .Return(true); inquiryHelper.Expect(helper => helper.GetTargetFileLocation(null, null)) .IgnoreArguments() .Return(targetFilePath); @@ -328,45 +309,14 @@ } [Test] - public void GivenMigratorAndSupportedFile_WhenDiscontinuedAfterInquiry_ThenFileMigrationCancelledAndLogsMessage() + public void GivenMigratorAndSupportedFile_WhenCancelledSaveFileDialog_ThenFileMigrationCancelledAndLogsMessage() { // Given string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); var mocks = new MockRepository(); var inquiryHelper = mocks.StrictMock(); - inquiryHelper.Expect(helper => helper.InquireContinuation(null)) - .IgnoreArguments() - .Return(false); - mocks.ReplayAll(); - - var migrator = new RingtoetsProjectMigrator(inquiryHelper); - string actualTargetFilePath = string.Empty; - - // When - Action call = () => actualTargetFilePath = migrator.Migrate(sourceFilePath); - - // Then - string expectedMessage = $"Het migreren van het projectbestand '{sourceFilePath}' is geannuleerd."; - TestHelper.AssertLogMessageIsGenerated(call, expectedMessage, 1); - Assert.IsNull(actualTargetFilePath); - - mocks.VerifyAll(); - } - - [Test] - public void GivenMigratorAndSupportedFile_WhenContinuedAfterInquiryButCancelledSaveFileDialog_ThenFileMigrationCancelledAndLogsMessage() - { - // Given - string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); - - var mocks = new MockRepository(); - var inquiryHelper = mocks.StrictMock(); - - inquiryHelper.Expect(helper => helper.InquireContinuation(null)) - .IgnoreArguments() - .Return(true); inquiryHelper.Expect(helper => helper.GetTargetFileLocation(null, null)) .IgnoreArguments() .Return(null); @@ -397,9 +347,6 @@ var mocks = new MockRepository(); var inquiryHelper = mocks.StrictMock(); - inquiryHelper.Expect(helper => helper.InquireContinuation(null)) - .IgnoreArguments() - .Return(true); inquiryHelper.Expect(helper => helper.GetTargetFileLocation(null, null)) .IgnoreArguments() .Return(sourceFilePath); @@ -422,7 +369,7 @@ { string[] msgs = messages.ToArray(); Assert.AreEqual(1, msgs.Length); - StringAssert.StartsWith(string.Format("Het migreren van het projectbestand '{0}' is mislukt: ", sourceFilePath), msgs[0]); + StringAssert.StartsWith($"Het migreren van het projectbestand '{sourceFilePath}' is mislukt: ", msgs[0]); }); Assert.IsNull(actualTargetFilePath); } @@ -442,9 +389,6 @@ var mocks = new MockRepository(); var inquiryHelper = mocks.StrictMock(); - inquiryHelper.Expect(helper => helper.InquireContinuation(null)) - .IgnoreArguments() - .Return(true); inquiryHelper.Expect(helper => helper.GetTargetFileLocation(null, null)) .IgnoreArguments() .Return(targetFilePath); @@ -464,7 +408,7 @@ { string[] msgs = messages.ToArray(); Assert.AreEqual(1, msgs.Length); - StringAssert.StartsWith(string.Format("Het migreren van het projectbestand '{0}' is mislukt: ", sourceFilePath), msgs[0]); + StringAssert.StartsWith($"Het migreren van het projectbestand '{sourceFilePath}' is mislukt: ", msgs[0]); }); Assert.IsNull(actualTargetFilePath); } @@ -481,9 +425,6 @@ var mocks = new MockRepository(); var inquiryHelper = mocks.StrictMock(); - inquiryHelper.Expect(helper => helper.InquireContinuation(null)) - .IgnoreArguments() - .Return(true); inquiryHelper.Expect(helper => helper.GetTargetFileLocation(null, null)) .IgnoreArguments() .Return(sourceFilePath); @@ -501,7 +442,7 @@ { string[] msgs = messages.ToArray(); Assert.AreEqual(1, msgs.Length); - StringAssert.StartsWith(string.Format("Het migreren van het projectbestand '{0}' is mislukt: ", sourceFilePath), msgs[0]); + StringAssert.StartsWith($"Het migreren van het projectbestand '{sourceFilePath}' is mislukt: ", msgs[0]); }); Assert.IsNull(actualTargetFilePath); Index: Core/Common/src/Core.Common.Base/Core.Common.Base.csproj =================================================================== diff -u -r5ec759496df2662a183c1c5ed74e3724bd834ae2 -rac9f1f110b53f4bf66b4f2fe04d34178273ac4fd --- Core/Common/src/Core.Common.Base/Core.Common.Base.csproj (.../Core.Common.Base.csproj) (revision 5ec759496df2662a183c1c5ed74e3724bd834ae2) +++ Core/Common/src/Core.Common.Base/Core.Common.Base.csproj (.../Core.Common.Base.csproj) (revision ac9f1f110b53f4bf66b4f2fe04d34178273ac4fd) @@ -107,6 +107,7 @@ + Index: Core/Common/src/Core.Common.Base/Storage/IMigrateProject.cs =================================================================== diff -u -r5af1b7c1e22ec02a2a7395e2de7482cc91681a4e -rac9f1f110b53f4bf66b4f2fe04d34178273ac4fd --- Core/Common/src/Core.Common.Base/Storage/IMigrateProject.cs (.../IMigrateProject.cs) (revision 5af1b7c1e22ec02a2a7395e2de7482cc91681a4e) +++ Core/Common/src/Core.Common.Base/Storage/IMigrateProject.cs (.../IMigrateProject.cs) (revision ac9f1f110b53f4bf66b4f2fe04d34178273ac4fd) @@ -33,14 +33,10 @@ /// updated to the newest version. /// /// The filepath of the project which needs to be checked. - /// true if the file needs to be migrated, false if: - /// - /// The file does not need to be migrated. - /// The file is not supported for the migration. - /// + /// The indicator if migration is required or not. /// Thrown when is null. /// Thrown when is an invalid file path. - bool ShouldMigrate(string filePath); + MigrationNeeded ShouldMigrate(string filePath); /// /// Migrates an outdated project file from Index: Core/Common/src/Core.Common.Base/Storage/MigrationNeeded.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Base/Storage/MigrationNeeded.cs (revision 0) +++ Core/Common/src/Core.Common.Base/Storage/MigrationNeeded.cs (revision ac9f1f110b53f4bf66b4f2fe04d34178273ac4fd) @@ -0,0 +1,44 @@ +// 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 Lesser 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser 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. + +namespace Core.Common.Base.Storage +{ + /// + /// Enum to indicate if migration of a Ringtoets project file is required or not. + /// + public enum MigrationNeeded + { + /// + /// Migration is required. + /// + Yes, + + /// + /// Migration is not needed. + /// + No, + + /// + /// Migration workflow aborted. + /// + Aborted + } +} \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/Commands/StorageCommandHandler.cs =================================================================== diff -u -r7963bd77ea5540754906c7e994f2687e33a89dde -rac9f1f110b53f4bf66b4f2fe04d34178273ac4fd --- Core/Common/src/Core.Common.Gui/Commands/StorageCommandHandler.cs (.../StorageCommandHandler.cs) (revision 7963bd77ea5540754906c7e994f2687e33a89dde) +++ Core/Common/src/Core.Common.Gui/Commands/StorageCommandHandler.cs (.../StorageCommandHandler.cs) (revision ac9f1f110b53f4bf66b4f2fe04d34178273ac4fd) @@ -130,8 +130,26 @@ { log.Info(Resources.StorageCommandHandler_OpenExistingProject_Opening_existing_project); - string migratedProjectFilePath = TryMigrateProject(filePath); + string migratedProjectFilePath = filePath; + try + { + MigrationNeeded migrationNeeded = projectMigrator.ShouldMigrate(filePath); + if (migrationNeeded == MigrationNeeded.Yes) + { + migratedProjectFilePath = projectMigrator.Migrate(filePath); + } + else if (migrationNeeded == MigrationNeeded.Aborted) + { + migratedProjectFilePath = null; + } + } + catch (ArgumentException e) + { + migratedProjectFilePath = null; + log.Error(e.Message, e); + } + var isOpenProjectSuccessful = false; IProject newProject = null; if (!string.IsNullOrEmpty(migratedProjectFilePath)) @@ -301,25 +319,5 @@ return false; } } - - private string TryMigrateProject(string filePath) - { - string migratedProjectFilePath = filePath; - - try - { - if (projectMigrator.ShouldMigrate(filePath)) - { - migratedProjectFilePath = projectMigrator.Migrate(filePath); - } - } - catch (ArgumentException e) - { - migratedProjectFilePath = null; - log.Error(e.Message, e); - } - - return migratedProjectFilePath; - } } } \ No newline at end of file Index: Core/Common/test/Core.Common.Gui.Test/Commands/StorageCommandHandlerTest.cs =================================================================== diff -u -rb9f76ee42529d5cba29ae9a1cf955af2fb2fb29d -rac9f1f110b53f4bf66b4f2fe04d34178273ac4fd --- Core/Common/test/Core.Common.Gui.Test/Commands/StorageCommandHandlerTest.cs (.../StorageCommandHandlerTest.cs) (revision b9f76ee42529d5cba29ae9a1cf955af2fb2fb29d) +++ Core/Common/test/Core.Common.Gui.Test/Commands/StorageCommandHandlerTest.cs (.../StorageCommandHandlerTest.cs) (revision ac9f1f110b53f4bf66b4f2fe04d34178273ac4fd) @@ -193,7 +193,7 @@ .Return(loadedProject); var projectMigrator = mocks.StrictMock(); - projectMigrator.Expect(pm => pm.ShouldMigrate(pathToSomeValidFile)).Return(true); + projectMigrator.Expect(pm => pm.ShouldMigrate(pathToSomeValidFile)).Return(MigrationNeeded.Yes); projectMigrator.Expect(pm => pm.Migrate(pathToSomeValidFile)).Return(pathToMigratedFile); var mainWindowController = mocks.Stub(); @@ -235,7 +235,7 @@ var projectStorage = mocks.StrictMock(); var projectMigrator = mocks.StrictMock(); - projectMigrator.Expect(pm => pm.ShouldMigrate(pathToSomeValidFile)).Return(true); + projectMigrator.Expect(pm => pm.ShouldMigrate(pathToSomeValidFile)).Return(MigrationNeeded.Yes); projectMigrator.Expect(pm => pm.Migrate(pathToSomeValidFile)).Return(null); var project = mocks.Stub(); @@ -330,7 +330,7 @@ var projectStorage = mocks.StrictMock(); var projectMigrator = mocks.StrictMock(); - projectMigrator.Expect(pm => pm.ShouldMigrate(pathToSomeValidFile)).Return(true); + projectMigrator.Expect(pm => pm.ShouldMigrate(pathToSomeValidFile)).Return(MigrationNeeded.Yes); projectMigrator.Expect(pm => pm.Migrate(pathToSomeValidFile)) .Throw(new ArgumentException(errorMessage)); @@ -381,6 +381,7 @@ projectStorage.Stub(ps => ps.LoadProject(pathToSomeInvalidFile)) .Throw(new StorageException(goodErrorMessageText, new Exception("H@X!"))); var projectMigrator = mocks.Stub(); + projectMigrator.Stub(m => m.ShouldMigrate(pathToSomeInvalidFile)).Return(MigrationNeeded.No); var projectFactory = mocks.Stub(); projectFactory.Stub(pf => pf.CreateNewProject()).Return(project); var mainWindowController = mocks.Stub(); @@ -469,6 +470,7 @@ .Return(loadedProject); var projectMigrator = mocks.Stub(); + projectMigrator.Stub(m => m.ShouldMigrate(pathToSomeValidFile)).Return(MigrationNeeded.No); var mainWindowController = mocks.Stub(); var projectOwner = mocks.Stub(); @@ -513,6 +515,7 @@ .Return(loadedProject); var projectMigrator = mocks.Stub(); + projectMigrator.Stub(m => m.ShouldMigrate(pathToSomeValidFile)).Return(MigrationNeeded.No); var applicationSelection = mocks.Stub(); applicationSelection.Selection = originalProject; Index: Core/Common/test/Core.Common.Gui.Test/GuiCoreTest.cs =================================================================== diff -u -rb9f76ee42529d5cba29ae9a1cf955af2fb2fb29d -rac9f1f110b53f4bf66b4f2fe04d34178273ac4fd --- Core/Common/test/Core.Common.Gui.Test/GuiCoreTest.cs (.../GuiCoreTest.cs) (revision b9f76ee42529d5cba29ae9a1cf955af2fb2fb29d) +++ Core/Common/test/Core.Common.Gui.Test/GuiCoreTest.cs (.../GuiCoreTest.cs) (revision ac9f1f110b53f4bf66b4f2fe04d34178273ac4fd) @@ -515,6 +515,7 @@ var mocks = new MockRepository(); var projectStore = mocks.Stub(); var projectMigrator = mocks.Stub(); + projectMigrator.Stub(m => m.ShouldMigrate(testFile)).Return(MigrationNeeded.No); var deserializedProject = mocks.Stub(); projectStore.Expect(ps => ps.LoadProject(testFile)).Return(deserializedProject); var projectFactory = CreateProjectFactory(mocks); @@ -561,7 +562,7 @@ var projectStore = mocks.Stub(); var projectMigrator = mocks.Stub(); - projectMigrator.Stub(pm => pm.ShouldMigrate(testFile)).Return(true); + projectMigrator.Stub(pm => pm.ShouldMigrate(testFile)).Return(MigrationNeeded.Yes); projectMigrator.Stub(pm => pm.Migrate(testFile)).Return(null); const string expectedProjectName = "Project"; @@ -664,7 +665,7 @@ var projectStore = mocks.Stub(); var projectMigrator = mocks.Stub(); - projectMigrator.Stub(pm => pm.ShouldMigrate(testFile)).Return(true); + projectMigrator.Stub(pm => pm.ShouldMigrate(testFile)).Return(MigrationNeeded.Yes); projectMigrator.Stub(pm => pm.Migrate(testFile)) .Throw(new ArgumentException(expectedErrorMessage)); @@ -716,6 +717,7 @@ var mocks = new MockRepository(); var projectStore = mocks.Stub(); var projectMigrator = mocks.Stub(); + projectMigrator.Stub(m => m.ShouldMigrate(testFile)).Return(MigrationNeeded.No); projectStore.Expect(ps => ps.LoadProject(testFile)).Throw(new StorageException(storageExceptionText)); const string expectedProjectName = "Project"; var project = mocks.Stub();