Fisheye: Tag 1e1fcda7f0c114dfb7420b565808dcff1fb8202a refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Integration.Test/App.config'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1e1fcda7f0c114dfb7420b565808dcff1fb8202a refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Integration.Test/Application.Riskeer.Integration.Test.csproj'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1e1fcda7f0c114dfb7420b565808dcff1fb8202a refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Integration.Test/Properties/AssemblyInfo.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1e1fcda7f0c114dfb7420b565808dcff1fb8202a refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Integration.Test/ResourcesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1e1fcda7f0c114dfb7420b565808dcff1fb8202a refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Integration.Test/StorageMigrationIntegrationTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Integration.Test/UnusedResourceSearcher/UnusedResourceSearcher.exe =================================================================== diff -u -rf64dceaa32788bad28dcf09f4a1c3150595f1327 -r1e1fcda7f0c114dfb7420b565808dcff1fb8202a Binary files differ Fisheye: Tag 1e1fcda7f0c114dfb7420b565808dcff1fb8202a refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Integration.Test/packages.config'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Riskeer.Integration.Test/App.config =================================================================== diff -u --- Application/Ringtoets/test/Application.Riskeer.Integration.Test/App.config (revision 0) +++ Application/Ringtoets/test/Application.Riskeer.Integration.Test/App.config (revision 1e1fcda7f0c114dfb7420b565808dcff1fb8202a) @@ -0,0 +1,46 @@ + + + + + +
+ + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: Application/Ringtoets/test/Application.Riskeer.Integration.Test/Application.Riskeer.Integration.Test.csproj =================================================================== diff -u --- Application/Ringtoets/test/Application.Riskeer.Integration.Test/Application.Riskeer.Integration.Test.csproj (revision 0) +++ Application/Ringtoets/test/Application.Riskeer.Integration.Test/Application.Riskeer.Integration.Test.csproj (revision 1e1fcda7f0c114dfb7420b565808dcff1fb8202a) @@ -0,0 +1,117 @@ + + + + {F3695FB7-4C1F-499D-B283-2CF159500117} + Application.Riskeer.Integration.Test + Application.Riskeer.Integration.Test + + + + + ..\..\..\..\packages\EntityFramework.6.0.0\lib\net40\EntityFramework.dll + + + ..\..\..\..\packages\EntityFramework.6.0.0\lib\net40\EntityFramework.SqlServer.dll + + + ..\..\..\..\packages\Fluent.Ribbon.3.4.0\lib\net40\Fluent.dll + + + ..\..\..\..\packages\Fluent.Ribbon.3.4.0\lib\net40\Microsoft.Windows.Shell.dll + + + ..\..\..\..\packages\NUnit.3.8.1\lib\net40\nunit.framework.dll + True + + + + + ..\..\..\..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.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 + + + + ..\..\..\..\packages\Fluent.Ribbon.3.4.0\lib\net40\System.Windows.Interactivity.dll + + + + + + + + + + + + Copying.licenseheader + + + + + + + Always + + + + + {3bbfd65b-b277-4e50-ae6d-bd24c3434609} + Core.Common.Base + + + {30E4C2AE-719E-4D70-9FA9-668A9767FBFA} + Core.Common.Gui + + + {d749ee4c-ce50-4c17-bf01-9a953028c126} + Core.Common.TestUtil + + + {efd7e662-5b69-4b71-a448-565b64e9c033} + Migration.Core.Storage + + + {d08db9e2-6861-44c8-a725-71a70274cc77} + Migration.Scripts.Data + + + {6A074D65-A81C-4C1C-8E24-F36C916E4ED7} + Ringtoets.Common.Util + + + {11F1F874-45AF-43E4-8AE5-15A5C9593E28} + Ringtoets.Integration.Data + + + {FAC55B92-E259-43D6-B9A1-5BDA6C834359} + Riskeer.Migration.Core + + + {AC4F7F48-F674-4E32-AB35-9C726605F684} + Riskeer.Migration + + + {C98D99C5-2ADD-4693-916C-71BF78750412} + Riskeer.Migration.Core.TestUtil + + + {50963F12-448C-41BA-A62C-CDB0AB8D21E0} + Riskeer.Storage.Core + + + + + + 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: Application/Ringtoets/test/Application.Riskeer.Integration.Test/Properties/AssemblyInfo.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Riskeer.Integration.Test/Properties/AssemblyInfo.cs (revision 0) +++ Application/Ringtoets/test/Application.Riskeer.Integration.Test/Properties/AssemblyInfo.cs (revision 1e1fcda7f0c114dfb7420b565808dcff1fb8202a) @@ -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("Application.Riskeer.Integration.Test")] +[assembly: AssemblyProduct("Application.Riskeer.Integration.Test")] \ No newline at end of file Index: Application/Ringtoets/test/Application.Riskeer.Integration.Test/ResourcesTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Riskeer.Integration.Test/ResourcesTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Riskeer.Integration.Test/ResourcesTest.cs (revision 1e1fcda7f0c114dfb7420b565808dcff1fb8202a) @@ -0,0 +1,98 @@ +// 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; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text.RegularExpressions; +using Core.Common.TestUtil; +using NUnit.Framework; + +namespace Application.Riskeer.Integration.Test +{ + [TestFixture] + [Explicit("Ignored because the test is too expensive to run on every commit.")] + public class ResourcesTest + { + private string outputFilePath; + + [TearDown] + public void TearDown() + { + if (File.Exists(outputFilePath)) + { + File.Delete(outputFilePath); + } + } + + /// + /// This test will determine if a resource defined in Resources.resx is used in the source code. + /// + [Test] + public void UnusedResourceSearcher_Always_WritesFileWithEmbeddedResources() + { + // Setup + string solution = TestHelper.SolutionRoot; + string outputPath = TestHelper.GetScratchPadPath(); + const string resource = "Resources.resx"; + const string sourceCode = "*.cs;*.xaml"; + const string filters = "Resources.designer.cs;test"; + string searchPatterns = Regex.Replace("\\[.*\\(typeof\\(.*Resources\\).*\"-f-\".*\\)\\];" + + "\"-f-\"\\);Resources.-f-;Resources\\\\-f-", @"(\\*)" + + "\"", @"$1$1\" + "\""); + + string directory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "UnusedResourceSearcher"); + string executable = Path.Combine(directory, "UnusedResourceSearcher.exe"); + + var process = new Process + { + StartInfo = new ProcessStartInfo(executable) + { + UseShellExecute = false, + CreateNoWindow = true, + Arguments = string.Join(" ", solution, outputPath, resource, sourceCode, filters, searchPatterns) + } + }; + + // Call + process.Start(); + process.WaitForExit(); + + // Assert + outputFilePath = Path.Combine(outputPath, "UnusedResources.txt"); + var lines = new List(); + using (var reader = new StreamReader(outputFilePath)) + { + string line; + while ((line = reader.ReadLine()) != null) + { + lines.Add(line); + } + } + + string message = $"The following resources are marked as unused:{Environment.NewLine}{string.Join(Environment.NewLine, lines.OrderBy(s => s).ToList())}"; + Assert.AreEqual(0, lines.Count, message); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Riskeer.Integration.Test/StorageMigrationIntegrationTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Riskeer.Integration.Test/StorageMigrationIntegrationTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Riskeer.Integration.Test/StorageMigrationIntegrationTest.cs (revision 1e1fcda7f0c114dfb7420b565808dcff1fb8202a) @@ -0,0 +1,177 @@ +// 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; +using System.IO; +using System.Threading; +using Core.Common.Gui; +using Core.Common.Gui.Forms.MainWindow; +using Core.Common.Gui.Settings; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Util; +using Ringtoets.Integration.Data; +using Riskeer.Migration; +using Riskeer.Migration.Core; +using Riskeer.Migration.Core.TestUtil; +using Riskeer.Storage.Core; + +namespace Application.Riskeer.Integration.Test +{ + [TestFixture] + public class StorageMigrationIntegrationTest + { + private readonly string workingDirectory = TestHelper.GetScratchPadPath(nameof(StorageMigrationIntegrationTest)); + private DirectoryDisposeHelper directoryDisposeHelper; + + [Test] + [TestCaseSource(typeof(RingtoetsProjectMigrationTestHelper), nameof(RingtoetsProjectMigrationTestHelper.GetAllOutdatedSupportedProjectFileVersions))] + [Apartment(ApartmentState.STA)] + public void GivenRingtoetsGuiWithStorageSql_WhenRunWithMigratedFile_MigratedProjectSet(string version) + { + string sourceFilePath = GetTestProjectFilePath(version); + string targetFilePath = Path.Combine(workingDirectory, nameof(GivenRingtoetsGuiWithStorageSql_WhenRunWithMigratedFile_MigratedProjectSet)); + MigrateFile(sourceFilePath, targetFilePath); + + // Given + var projectStore = new StorageSqLite(); + var mocks = new MockRepository(); + var inquiryHelper = mocks.StrictMock(); + mocks.ReplayAll(); + + var projectMigrator = new RingtoetsProjectMigrator(inquiryHelper); + + using (var gui = new GuiCore(new MainWindow(), projectStore, projectMigrator, new RingtoetsProjectFactory(), new GuiCoreSettings())) + { + // When + gui.Run(targetFilePath); + + // Then + Assert.AreEqual(targetFilePath, gui.ProjectFilePath); + Assert.NotNull(gui.Project); + string expectedProjectName = Path.GetFileNameWithoutExtension(targetFilePath); + Assert.AreEqual(expectedProjectName, gui.Project.Name); + Assert.AreEqual("description", gui.Project.Description); + Assert.IsInstanceOf(gui.Project); + } + + mocks.VerifyAll(); + } + + [Test] + [TestCaseSource(typeof(RingtoetsProjectMigrationTestHelper), nameof(RingtoetsProjectMigrationTestHelper.GetAllOutdatedSupportedProjectFileVersions))] + [Apartment(ApartmentState.STA)] + public void GivenRingtoetsGui_WhenRunWithUnmigratedFileAndInquireContinuation_MigratedProjectSet(string version) + { + // Given + string sourceFilePath = GetTestProjectFilePath(version); + string targetFilePath = Path.Combine(workingDirectory, nameof(GivenRingtoetsGui_WhenRunWithUnmigratedFileAndInquireContinuation_MigratedProjectSet)); + + var projectStore = new StorageSqLite(); + var mocks = new MockRepository(); + var inquiryHelper = mocks.Stub(); + inquiryHelper.Expect(helper => helper.InquireContinuation(null)) + .IgnoreArguments() + .Return(true); + inquiryHelper.Expect(helper => helper.GetTargetFileLocation(null, null)) + .IgnoreArguments() + .Return(targetFilePath); + mocks.ReplayAll(); + + var projectMigrator = new RingtoetsProjectMigrator(inquiryHelper); + + using (var gui = new GuiCore(new MainWindow(), projectStore, projectMigrator, new RingtoetsProjectFactory(), new GuiCoreSettings())) + { + // When + gui.Run(sourceFilePath); + + // Then + Assert.AreEqual(targetFilePath, gui.ProjectFilePath); + string expectedProjectName = Path.GetFileNameWithoutExtension(targetFilePath); + Assert.AreEqual(expectedProjectName, gui.Project.Name); + Assert.AreEqual("description", gui.Project.Description); + Assert.IsInstanceOf(gui.Project); + } + + mocks.VerifyAll(); + } + + [Test] + [TestCaseSource(typeof(RingtoetsProjectMigrationTestHelper), nameof(RingtoetsProjectMigrationTestHelper.GetAllOutdatedSupportedProjectFileVersions))] + [Apartment(ApartmentState.STA)] + public void GivenRingtoetsGui_WhenRunWithUnmigratedFileAndNoInquireContinuation_MigratedProjectNotSet(string version) + { + // Given + string sourceFilePath = GetTestProjectFilePath(version); + var projectStore = new StorageSqLite(); + var mocks = new MockRepository(); + var inquiryHelper = mocks.Stub(); + inquiryHelper.Expect(helper => helper.InquireContinuation(null)) + .IgnoreArguments() + .Return(false); + mocks.ReplayAll(); + + var projectMigrator = new RingtoetsProjectMigrator(inquiryHelper); + + using (var gui = new GuiCore(new MainWindow(), projectStore, projectMigrator, new RingtoetsProjectFactory(), new GuiCoreSettings())) + { + // When + gui.Run(sourceFilePath); + + // Then + Assert.IsNull(gui.ProjectFilePath); + Assert.AreEqual("Project", gui.Project.Name); + Assert.IsEmpty(gui.Project.Description); + } + + mocks.VerifyAll(); + } + + [OneTimeSetUp] + public void SetUp() + { + directoryDisposeHelper = new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), nameof(StorageMigrationIntegrationTest)); + } + + [OneTimeTearDown] + public void TearDown() + { + GC.Collect(); + GC.WaitForPendingFinalizers(); + directoryDisposeHelper.Dispose(); + } + + private static void MigrateFile(string sourceFilePath, string targetFilePath) + { + string newVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); + var fromVersionedFile = new RingtoetsVersionedFile(sourceFilePath); + var migrator = new RingtoetsSqLiteDatabaseFileMigrator(); + + migrator.Migrate(fromVersionedFile, newVersion, targetFilePath); + } + + private static string GetTestProjectFilePath(string versionNumber) + { + return TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Migration.Core, $"MigrationTestProject{versionNumber}.rtd"); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Riskeer.Integration.Test/UnusedResourceSearcher/UnusedResourceSearcher.exe =================================================================== diff -u Binary files differ Index: Application/Ringtoets/test/Application.Riskeer.Integration.Test/packages.config =================================================================== diff -u --- Application/Ringtoets/test/Application.Riskeer.Integration.Test/packages.config (revision 0) +++ Application/Ringtoets/test/Application.Riskeer.Integration.Test/packages.config (revision 1e1fcda7f0c114dfb7420b565808dcff1fb8202a) @@ -0,0 +1,31 @@ + + + + + + + + + + \ No newline at end of file Index: Ringtoets.sln =================================================================== diff -u -r04cd4b9f3b2e335d74428c1f17375d1f9afb27d8 -r1e1fcda7f0c114dfb7420b565808dcff1fb8202a --- Ringtoets.sln (.../Ringtoets.sln) (revision 04cd4b9f3b2e335d74428c1f17375d1f9afb27d8) +++ Ringtoets.sln (.../Ringtoets.sln) (revision 1e1fcda7f0c114dfb7420b565808dcff1fb8202a) @@ -741,7 +741,7 @@ {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Application.Riskeer.Integration.Test", "Application\Ringtoets\test\Application.Ringtoets.Integration.Test\Application.Riskeer.Integration.Test.csproj", "{F3695FB7-4C1F-499D-B283-2CF159500117}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Application.Riskeer.Integration.Test", "Application\Ringtoets\test\Application.Riskeer.Integration.Test\Application.Riskeer.Integration.Test.csproj", "{F3695FB7-4C1F-499D-B283-2CF159500117}" ProjectSection(ProjectDependencies) = postProject {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection