Index: Core/Common/test/Core.Common.Assembly.Test/AssemblyResolverTest.cs
===================================================================
diff -u
--- Core/Common/test/Core.Common.Assembly.Test/AssemblyResolverTest.cs (revision 0)
+++ Core/Common/test/Core.Common.Assembly.Test/AssemblyResolverTest.cs (revision 5e9bdc240bbe3ce6aab0620b08503654b08e3e69)
@@ -0,0 +1,107 @@
+// 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 NUnit.Framework;
+
+namespace Core.Common.Assembly.Test
+{
+ [TestFixture]
+ public class AssemblyResolverTest
+ {
+ private string validAssemblyDirectory;
+
+ [OneTimeSetUp]
+ public void OneTimeSetUp()
+ {
+ AssemblyResolver.Reset(); // Reset any initialization by other test projects
+
+ validAssemblyDirectory = Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location).FullName;
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ AssemblyResolver.Reset();
+ }
+
+ [Test]
+ public void RequiresInitialization_AssemblyResolverNotInitialized_ReturnsTrue()
+ {
+ // Call
+ bool requiresInitialization = AssemblyResolver.RequiresInitialization;
+
+ // Assert
+ Assert.IsTrue(requiresInitialization);
+ }
+
+ [Test]
+ public void RequiresInitialization_AssemblyResolverInitialized_ReturnsFalse()
+ {
+ // Setup
+ AssemblyResolver.Initialize(validAssemblyDirectory);
+
+ // Call
+ bool requiresInitialization = AssemblyResolver.RequiresInitialization;
+
+ // Assert
+ Assert.IsFalse(requiresInitialization);
+ }
+
+ [Test]
+ public void Initialize_AssemblyResolverAlreadyInitialized_ThrowsInvalidOperationExceptionAndLeavesAssemblyResolverInitialized()
+ {
+ // Setup
+ AssemblyResolver.Initialize(validAssemblyDirectory);
+
+ // Call
+ void Call() => AssemblyResolver.Initialize(validAssemblyDirectory);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("Cannot initialize the assembly resolver more than once.", exception.Message);
+ Assert.IsFalse(AssemblyResolver.RequiresInitialization);
+ }
+
+ [Test]
+ public void Initialize_InvalidAssemblyDirectory_ThrowsDirectoryNotFoundExceptionAndLeavesAssemblyResolverStillRequiringInitialization()
+ {
+ // Call
+ void Call() => AssemblyResolver.Initialize("Invalid");
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("Cannot find the directory 'Invalid'.", exception.Message);
+ Assert.IsTrue(AssemblyResolver.RequiresInitialization);
+ }
+
+ [Test]
+ public void GetApplicationDirectory_Always_ReturnsApplicationDirectory()
+ {
+ // Call
+ string applicationDirectory = AssemblyResolver.GetApplicationDirectory();
+
+ // Assert
+ StringAssert.EndsWith("Application", applicationDirectory);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Common/test/Core.Common.Assembly.Test/Core.Common.Assembly.Test.csproj
===================================================================
diff -u
--- Core/Common/test/Core.Common.Assembly.Test/Core.Common.Assembly.Test.csproj (revision 0)
+++ Core/Common/test/Core.Common.Assembly.Test/Core.Common.Assembly.Test.csproj (revision 5e9bdc240bbe3ce6aab0620b08503654b08e3e69)
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+ Copying.Lesser.licenseheader
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: Core/Common/test/Core.Common.Assembly.Test/Properties/AssemblyInfo.cs
===================================================================
diff -u
--- Core/Common/test/Core.Common.Assembly.Test/Properties/AssemblyInfo.cs (revision 0)
+++ Core/Common/test/Core.Common.Assembly.Test/Properties/AssemblyInfo.cs (revision 5e9bdc240bbe3ce6aab0620b08503654b08e3e69)
@@ -0,0 +1,25 @@
+// 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.Reflection;
+
+[assembly: AssemblyTitle("Core.Common.Assembly.Test")]
+[assembly: AssemblyProduct("Core.Common.Assembly.Test")]
Index: Riskeer.sln
===================================================================
diff -u -r96a0087d2992ad92405210f0c6a32931344efe3f -r5e9bdc240bbe3ce6aab0620b08503654b08e3e69
--- Riskeer.sln (.../Riskeer.sln) (revision 96a0087d2992ad92405210f0c6a32931344efe3f)
+++ Riskeer.sln (.../Riskeer.sln) (revision 5e9bdc240bbe3ce6aab0620b08503654b08e3e69)
@@ -2015,6 +2015,11 @@
{C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC}
EndProjectSection
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core.Common.Assembly.Test", "Core\Common\test\Core.Common.Assembly.Test\Core.Common.Assembly.Test.csproj", "{52E6730E-6277-42DE-AFFB-49B3D8CCAF14}"
+ ProjectSection(ProjectDependencies) = postProject
+ {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
CreateInstaller|x86 = CreateInstaller|x86
@@ -5083,6 +5088,14 @@
{A337C602-662A-43C6-BC57-D5C870344553}.Release|x86.Build.0 = Release|x86
{A337C602-662A-43C6-BC57-D5C870344553}.ReleaseForCodeCoverage|x86.ActiveCfg = ReleaseForCodeCoverage|x86
{A337C602-662A-43C6-BC57-D5C870344553}.ReleaseForCodeCoverage|x86.Build.0 = ReleaseForCodeCoverage|x86
+ {52E6730E-6277-42DE-AFFB-49B3D8CCAF14}.CreateInstaller|x86.ActiveCfg = CreateInstaller|x86
+ {52E6730E-6277-42DE-AFFB-49B3D8CCAF14}.CreateInstallerWithDemoPlugin|x86.ActiveCfg = CreateInstallerWithDemoPlugin|x86
+ {52E6730E-6277-42DE-AFFB-49B3D8CCAF14}.Debug|x86.ActiveCfg = Debug|x86
+ {52E6730E-6277-42DE-AFFB-49B3D8CCAF14}.Debug|x86.Build.0 = Debug|x86
+ {52E6730E-6277-42DE-AFFB-49B3D8CCAF14}.Release|x86.ActiveCfg = Release|x86
+ {52E6730E-6277-42DE-AFFB-49B3D8CCAF14}.Release|x86.Build.0 = Release|x86
+ {52E6730E-6277-42DE-AFFB-49B3D8CCAF14}.ReleaseForCodeCoverage|x86.ActiveCfg = ReleaseForCodeCoverage|x86
+ {52E6730E-6277-42DE-AFFB-49B3D8CCAF14}.ReleaseForCodeCoverage|x86.Build.0 = ReleaseForCodeCoverage|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -5515,6 +5528,7 @@
{12B27394-C1AC-4B59-BD49-1662525B91C7} = {435F0AB1-1180-47D3-9BCB-3B5FF365236C}
{02266309-9A78-4843-AE3A-E563B744AF95} = {41023317-95BB-4147-8154-87B45837E752}
{A337C602-662A-43C6-BC57-D5C870344553} = {8261CCE1-98D7-465B-BC94-4ED239DE7F2E}
+ {52E6730E-6277-42DE-AFFB-49B3D8CCAF14} = {0D9858E1-CF2D-4DE5-AC0E-64401900D531}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {039D31AA-B517-4354-B8CD-0B2B826D0B1F}