Index: Application/Ringtoets/src/Application.Ringtoets.Migration/Application.Ringtoets.Migration.csproj =================================================================== diff -u -r0d01d77a85f997d3cbe2e3f83d6bf3438ec6806d -rf1cad32061f6bc6fcea1ac19cf7e5c20289c2e2e --- Application/Ringtoets/src/Application.Ringtoets.Migration/Application.Ringtoets.Migration.csproj (.../Application.Ringtoets.Migration.csproj) (revision 0d01d77a85f997d3cbe2e3f83d6bf3438ec6806d) +++ Application/Ringtoets/src/Application.Ringtoets.Migration/Application.Ringtoets.Migration.csproj (.../Application.Ringtoets.Migration.csproj) (revision f1cad32061f6bc6fcea1ac19cf7e5c20289c2e2e) @@ -2,8 +2,6 @@ - Debug - x86 {AC4F7F48-F674-4E32-AB35-9C726605F684} Library Properties Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsProjectMigratorTest.cs =================================================================== diff -u -r0d01d77a85f997d3cbe2e3f83d6bf3438ec6806d -rf1cad32061f6bc6fcea1ac19cf7e5c20289c2e2e --- Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsProjectMigratorTest.cs (.../RingtoetsProjectMigratorTest.cs) (revision 0d01d77a85f997d3cbe2e3f83d6bf3438ec6806d) +++ Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsProjectMigratorTest.cs (.../RingtoetsProjectMigratorTest.cs) (revision f1cad32061f6bc6fcea1ac19cf7e5c20289c2e2e) @@ -27,18 +27,31 @@ using Core.Common.Base.Storage; using Core.Common.Gui; using Core.Common.TestUtil; -using NUnit.Extensions.Forms; using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Utils; namespace Application.Ringtoets.Migration.Test { [TestFixture] - public class RingtoetsProjectMigratorTest : NUnitFormTest + public class RingtoetsProjectMigratorTest { private readonly string currentDatabaseVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); + private const string testDirectory = nameof(RingtoetsProjectMigratorTest); + private DirectoryDisposeHelper directoryDisposeHelper; + [SetUp] + public void Setup() + { + directoryDisposeHelper = new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), testDirectory); + } + + [TearDown] + public void TearDown() + { + directoryDisposeHelper.Dispose(); + } + [Test] public void Constructor_InquiryHelperNull_ThrowsArgumentNullException() { @@ -68,7 +81,7 @@ } [Test] - public void ShouldMigrate_SourcePathNull_ThrowsArgumentNullException() + public void ShouldMigrate_FilePathNull_ThrowsArgumentNullException() { // Setup var mocks = new MockRepository(); @@ -88,8 +101,7 @@ } [Test] - [TestCase("")] - [TestCase(" ")] + [TestCaseSource(typeof(InvalidPathHelper), nameof(InvalidPathHelper.InvalidPaths))] public void ShouldMigrate_InvalidFilePath_ThrowsArgumentException(string invalidFilePath) { // Setup @@ -203,7 +215,7 @@ } [Test] - public void DetermineMigrationLocation_FilePathNull_ThrownArgumentNullException() + public void DetermineMigrationLocation_OriginalFilePathNull_ThrownArgumentNullException() { // Setup var mocks = new MockRepository(); @@ -223,9 +235,8 @@ } [Test] - [TestCase("")] - [TestCase(" ")] - public void DetermineMigrationLocation_InvalidFilePath_ThrowsArgumentException(string invalidFilePath) + [TestCaseSource(typeof(InvalidPathHelper), nameof(InvalidPathHelper.InvalidPaths))] + public void DetermineMigrationLocation_InvalidOriginalFilePath_ThrowsArgumentException(string invalidFilePath) { // Setup var mocks = new MockRepository(); @@ -319,8 +330,7 @@ } [Test] - [TestCase("")] - [TestCase(" ")] + [TestCaseSource(typeof(InvalidPathHelper), nameof(InvalidPathHelper.InvalidPaths))] public void Migrate_InvalidSourceFilePath_ThrowsArgumentException(string invalidFilePath) { // Setup @@ -346,8 +356,7 @@ } [Test] - [TestCase("")] - [TestCase(" ")] + [TestCaseSource(typeof(InvalidPathHelper), nameof(InvalidPathHelper.InvalidPaths))] public void Migrate_InvalidTargetFilePath_ThrowsArgumentException(string invalidFilePath) { // Setup @@ -379,7 +388,7 @@ string targetFile = $"{nameof(RingtoetsProjectMigratorTest)}." + $"{nameof(GivenMigratorAndSupportedFile_WhenValidTargetLocationGiven_ThenFileSuccessFullyMigrates)}.rtd"; - string targetFilePath = Path.Combine(TestHelper.GetScratchPadPath(), targetFile); + string targetFilePath = Path.Combine(TestHelper.GetScratchPadPath(), testDirectory, targetFile); var mocks = new MockRepository(); var inquiryHelper = mocks.Stub(); @@ -396,7 +405,8 @@ // Then string expectedMessage = $"Het projectbestand '{sourceFilePath}' is succesvol gemigreerd naar '{targetFilePath}' (versie {currentDatabaseVersion})."; - TestHelper.AssertLogMessageIsGenerated(call, expectedMessage, 1); + Tuple expectedLogMessageAndLevel = Tuple.Create(expectedMessage, LogLevelConstant.Info); + TestHelper.AssertLogMessageWithLevelIsGenerated(call, expectedLogMessageAndLevel, 1); Assert.IsTrue(migrationSuccessful); @@ -412,8 +422,9 @@ { // Setup string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); - string targetFilePath = $"{nameof(RingtoetsProjectMigratorTest)}." + + string targetFile = $"{nameof(RingtoetsProjectMigratorTest)}." + $"{nameof(Migrate_UnableToSaveAtTargetFilePath_MigrationFailsAndLogsError)}.rtd"; + string targetFilePath = Path.Combine(TestHelper.GetScratchPadPath(), testDirectory, targetFile); var mocks = new MockRepository(); var inquiryHelper = mocks.Stub(); @@ -451,7 +462,7 @@ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "UnsupportedVersion8.rtd"); string targetFile = $"{nameof(RingtoetsProjectMigratorTest)}." + $"{nameof(Migrate_UnsupportedSourceFileVersion_MigrationFailsAndLogsError)}"; - string targetFilePath = Path.Combine(TestHelper.GetScratchPadPath(), targetFile); + string targetFilePath = Path.Combine(TestHelper.GetScratchPadPath(), testDirectory, targetFile); var mocks = new MockRepository(); var inquiryHelper = mocks.Stub(); Index: Core/Common/test/Core.Common.Gui.Test/Commands/StorageCommandHandlerTest.cs =================================================================== diff -u -r8502d1a9cd739b227208f2f6ae6ea00fab758023 -rf1cad32061f6bc6fcea1ac19cf7e5c20289c2e2e --- Core/Common/test/Core.Common.Gui.Test/Commands/StorageCommandHandlerTest.cs (.../StorageCommandHandlerTest.cs) (revision 8502d1a9cd739b227208f2f6ae6ea00fab758023) +++ Core/Common/test/Core.Common.Gui.Test/Commands/StorageCommandHandlerTest.cs (.../StorageCommandHandlerTest.cs) (revision f1cad32061f6bc6fcea1ac19cf7e5c20289c2e2e) @@ -79,10 +79,10 @@ // Assert var expectedMessages = new[] { - "Nieuw Ringtoetsproject aanmaken...", - "Nieuw Ringtoetsproject succesvol aangemaakt." + Tuple.Create("Nieuw Ringtoetsproject aanmaken...", LogLevelConstant.Info), + Tuple.Create("Nieuw Ringtoetsproject succesvol aangemaakt.", LogLevelConstant.Info) }; - TestHelper.AssertLogMessagesAreGenerated(call, expectedMessages, 2); + TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedMessages, 2); mocks.VerifyAll(); } @@ -127,10 +127,10 @@ // Assert var expectedMessages = new[] { - exceptionMessage, - "Het is niet gelukt om het Ringtoetsproject op te slaan." + Tuple.Create(exceptionMessage, LogLevelConstant.Error), + Tuple.Create("Het is niet gelukt om het Ringtoetsproject op te slaan.", LogLevelConstant.Error) }; - TestHelper.AssertLogMessagesAreGenerated(call, expectedMessages, 2); + TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedMessages, 2); Assert.IsFalse(result); } mocks.VerifyAll(); @@ -172,7 +172,8 @@ // Assert var expectedMessage = $"Het Ringtoetsproject '{projectStub.Name}' is succesvol opgeslagen."; - TestHelper.AssertLogMessageIsGenerated(call, expectedMessage, 1); + Tuple expectedLogMessageAndLevel = Tuple.Create(expectedMessage, LogLevelConstant.Info); + TestHelper.AssertLogMessageWithLevelIsGenerated(call, expectedLogMessageAndLevel, 1); Assert.IsTrue(result); } mocks.VerifyAll(); @@ -225,10 +226,10 @@ // Assert var expectedMessages = new[] { - "Openen van bestaand Ringtoetsproject...", - "Uitvoeren van 'Openen van bestaand project' is gelukt." + Tuple.Create("Openen van bestaand Ringtoetsproject...", LogLevelConstant.Info), + Tuple.Create("Uitvoeren van 'Openen van bestaand project' is gelukt.", LogLevelConstant.Info) }; - TestHelper.AssertLogMessagesAreGenerated(call, expectedMessages, 2); + TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedMessages, 2); Assert.IsTrue(result); mocks.VerifyAll(); @@ -273,10 +274,10 @@ // Assert var expectedMessages = new[] { - "Openen van bestaand Ringtoetsproject...", - "Openen van bestaand Ringtoetsproject geannuleerd." + Tuple.Create("Openen van bestaand Ringtoetsproject...", LogLevelConstant.Info), + Tuple.Create("Openen van bestaand Ringtoetsproject geannuleerd.", LogLevelConstant.Info) }; - TestHelper.AssertLogMessagesAreGenerated(call, expectedMessages, 2); + TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedMessages, 2); Assert.IsFalse(result); mocks.VerifyAll(); @@ -325,10 +326,10 @@ // Assert var expectedMessages = new[] { - "Openen van bestaand Ringtoetsproject...", - "Openen van bestaand Ringtoetsproject geannuleerd." + Tuple.Create("Openen van bestaand Ringtoetsproject...", LogLevelConstant.Info), + Tuple.Create("Openen van bestaand Ringtoetsproject geannuleerd.", LogLevelConstant.Info) }; - TestHelper.AssertLogMessagesAreGenerated(call, expectedMessages, 2); + TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedMessages, 2); Assert.IsFalse(result); mocks.VerifyAll(); @@ -372,11 +373,11 @@ // Assert var expectedMessages = new[] { - "Openen van bestaand Ringtoetsproject...", - errorMessage, - "Het is niet gelukt om het Ringtoetsproject te laden." + Tuple.Create("Openen van bestaand Ringtoetsproject...", LogLevelConstant.Info), + Tuple.Create(errorMessage, LogLevelConstant.Error), + Tuple.Create("Het is niet gelukt om het Ringtoetsproject te laden.", LogLevelConstant.Error) }; - TestHelper.AssertLogMessagesAreGenerated(call, expectedMessages, 3); + TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedMessages, 3); Assert.IsFalse(result); mocks.VerifyAll(); @@ -424,11 +425,11 @@ // Assert var expectedMessages = new[] { - "Openen van bestaand Ringtoetsproject...", - errorMessage, - "Het is niet gelukt om het Ringtoetsproject te laden." + Tuple.Create("Openen van bestaand Ringtoetsproject...", LogLevelConstant.Info), + Tuple.Create(errorMessage, LogLevelConstant.Error), + Tuple.Create("Het is niet gelukt om het Ringtoetsproject te laden.", LogLevelConstant.Error) }; - TestHelper.AssertLogMessagesAreGenerated(call, expectedMessages, 3); + TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedMessages, 3); Assert.IsFalse(result); mocks.VerifyAll(); @@ -484,11 +485,11 @@ // Assert var expectedMessages = new[] { - "Openen van bestaand Ringtoetsproject...", - errorMessage, - "Uitvoeren van 'Openen van bestaand project' is mislukt." + Tuple.Create("Openen van bestaand Ringtoetsproject...", LogLevelConstant.Info), + Tuple.Create(errorMessage, LogLevelConstant.Error), + Tuple.Create("Uitvoeren van 'Openen van bestaand project' is mislukt.", LogLevelConstant.Error) }; - TestHelper.AssertLogMessagesAreGenerated(call, expectedMessages, 3); + TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedMessages, 3); Assert.IsFalse(result); mocks.VerifyAll(); @@ -534,11 +535,11 @@ // Assert var expectedMessages = new[] { - "Openen van bestaand Ringtoetsproject...", - goodErrorMessageText, - "Uitvoeren van 'Openen van bestaand project' is mislukt." + Tuple.Create("Openen van bestaand Ringtoetsproject...", LogLevelConstant.Info), + Tuple.Create(goodErrorMessageText, LogLevelConstant.Error), + Tuple.Create("Uitvoeren van 'Openen van bestaand project' is mislukt.", LogLevelConstant.Error) }; - TestHelper.AssertLogMessagesAreGenerated(call, expectedMessages, 3); + TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedMessages, 3); Assert.IsFalse(result); mocks.VerifyAll(); @@ -585,10 +586,10 @@ // Assert var expectedMessages = new[] { - "Openen van bestaand Ringtoetsproject...", - "Uitvoeren van 'Openen van bestaand project' is mislukt." + Tuple.Create("Openen van bestaand Ringtoetsproject...", LogLevelConstant.Info), + Tuple.Create("Uitvoeren van 'Openen van bestaand project' is mislukt.", LogLevelConstant.Error) }; - TestHelper.AssertLogMessagesAreGenerated(call, expectedMessages, 2); + TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedMessages, 2); Assert.IsFalse(result); mocks.VerifyAll(); @@ -634,10 +635,10 @@ // Assert var expectedMessages = new[] { - "Openen van bestaand Ringtoetsproject...", - "Uitvoeren van 'Openen van bestaand project' is gelukt." + Tuple.Create("Openen van bestaand Ringtoetsproject...", LogLevelConstant.Info), + Tuple.Create("Uitvoeren van 'Openen van bestaand project' is gelukt.", LogLevelConstant.Info) }; - TestHelper.AssertLogMessagesAreGenerated(call, expectedMessages, 2); + TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedMessages, 2); Assert.IsTrue(result); mocks.VerifyAll(); @@ -691,10 +692,10 @@ // Assert var expectedMessages = new[] { - "Openen van bestaand Ringtoetsproject...", - "Uitvoeren van 'Openen van bestaand project' is gelukt." + Tuple.Create("Openen van bestaand Ringtoetsproject...", LogLevelConstant.Info), + Tuple.Create("Uitvoeren van 'Openen van bestaand project' is gelukt.", LogLevelConstant.Info) }; - TestHelper.AssertLogMessagesAreGenerated(call, expectedMessages, 2); + TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedMessages, 2); Assert.IsTrue(result); mocks.VerifyAll(); @@ -775,7 +776,9 @@ Action call = () => returnedPath = storageCommandHandler.GetExistingProjectFilePath(); // Assert - TestHelper.AssertLogMessageIsGenerated(call, "Openen van bestaand Ringtoetsproject geannuleerd."); + var expectedMessage = "Openen van bestaand Ringtoetsproject geannuleerd."; + Tuple expectedLogMessageAndLevel = Tuple.Create(expectedMessage, LogLevelConstant.Info); + TestHelper.AssertLogMessageWithLevelIsGenerated(call, expectedLogMessageAndLevel); Assert.IsNull(returnedPath); }