Index: Application/Riskeer/test/Application.Riskeer.Integration.Test/Assembly/RuntimeProbingPrivatePathGenerator.cs =================================================================== diff -u --- Application/Riskeer/test/Application.Riskeer.Integration.Test/Assembly/RuntimeProbingPrivatePathGenerator.cs (revision 0) +++ Application/Riskeer/test/Application.Riskeer.Integration.Test/Assembly/RuntimeProbingPrivatePathGenerator.cs (revision 835e36509b0e9dec6974c7cbad53dbb0096ea759) @@ -0,0 +1,88 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer 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. + +using System; +using System.IO; +using System.Linq; +using NUnit.Framework; + +namespace Application.Riskeer.Integration.Test.Assembly +{ + /// + /// Class containing a method for generating a 'privatePath" value. + /// + /// This 'privatePath' value should go into all of our app.config files like this: + /// + /// + /// + /// + /// + /// + /// + /// Note: be sure to perform a full cleanup and rebuild before running this test! + /// + [TestFixture] + [Explicit("Test that should only be run manually")] + public class RuntimeProbingPrivatePathGenerator + { + private const string assemblyDirectoryName = "Application"; + + [Test] + public void WritePrivatePathStringToConsole() + { + var privatePath = string.Empty; + string rootDirectory = GetRootDirectory(); + string assemblyDirectory = Path.Combine(rootDirectory, assemblyDirectoryName); + + AddAssemblyPathsRecursively(assemblyDirectory, ref privatePath); + MakeAssemblyPathsRelativeToRootDirectory(rootDirectory, ref privatePath); + + Console.WriteLine(privatePath); + } + + private static string GetRootDirectory() + { + DirectoryInfo rootDirectoryInfo = Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location); + + while (rootDirectoryInfo.GetDirectories().All(di => di.Name != assemblyDirectoryName)) + { + rootDirectoryInfo = Directory.GetParent(rootDirectoryInfo.FullName); + } + + return rootDirectoryInfo.FullName; + } + + private static void AddAssemblyPathsRecursively(string assemblyDirectory, ref string privatePath) + { + privatePath += assemblyDirectory + ";"; + + foreach (string directory in Directory.GetDirectories(assemblyDirectory)) + { + AddAssemblyPathsRecursively(directory, ref privatePath); + } + } + + private static void MakeAssemblyPathsRelativeToRootDirectory(string rootDirectory, ref string assemblyPaths) + { + assemblyPaths = assemblyPaths.Replace(rootDirectory, string.Empty); + } + } +} \ No newline at end of file Index: Application/Riskeer/test/Application.Riskeer.Integration.Test/ResourcesTest.cs =================================================================== diff -u -rcb6d0d0e0260d373f0ade513d28e6ffcfc28a138 -r835e36509b0e9dec6974c7cbad53dbb0096ea759 --- Application/Riskeer/test/Application.Riskeer.Integration.Test/ResourcesTest.cs (.../ResourcesTest.cs) (revision cb6d0d0e0260d373f0ade513d28e6ffcfc28a138) +++ Application/Riskeer/test/Application.Riskeer.Integration.Test/ResourcesTest.cs (.../ResourcesTest.cs) (revision 835e36509b0e9dec6974c7cbad53dbb0096ea759) @@ -24,7 +24,6 @@ using System.Diagnostics; using System.IO; using System.Linq; -using System.Reflection; using System.Text.RegularExpressions; using Core.Common.TestUtil; using NUnit.Framework; @@ -62,7 +61,7 @@ "\"-f-\"\\);Resources.-f-;Resources\\\\-f-", @"(\\*)" + "\"", @"$1$1\" + "\""); - string directory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "UnusedResourceSearcher"); + string directory = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "UnusedResourceSearcher"); string executable = Path.Combine(directory, "UnusedResourceSearcher.exe"); var process = new Process