From fe500b5cf0366ab8b94709c26a01053a02af9161 Mon Sep 17 00:00:00 2001 From: Lluis Sanchez Date: Wed, 14 Sep 2022 17:54:02 +0200 Subject: Fix tests Make sure the test repo dir is cleaned for every test run. --- Test/UnitTests/TestBase.cs | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/Test/UnitTests/TestBase.cs b/Test/UnitTests/TestBase.cs index 0742fec..e015b23 100644 --- a/Test/UnitTests/TestBase.cs +++ b/Test/UnitTests/TestBase.cs @@ -9,8 +9,6 @@ namespace UnitTests { public class TestBase { - static bool firstRun = true; - public static string TempDir { get { string dir = new Uri (typeof(TestBase).Assembly.CodeBase).LocalPath; @@ -25,23 +23,19 @@ namespace UnitTests AddinManager.AddinLoaded += OnLoad; AddinManager.AddinUnloaded += OnUnload; - if (firstRun) { - if (Directory.Exists (TempDir)) - Directory.Delete (TempDir, true); - Directory.CreateDirectory (TempDir); - } + if (Directory.Exists (TempDir)) + Directory.Delete (TempDir, true); + Directory.CreateDirectory (TempDir); + + var configDir = Path.Combine(TempDir, "config"); + Directory.CreateDirectory(configDir); // Provide the current assembly as startup assembly, otherwise it will pick the // unit test runner as startup assembly - AddinManager.AddinEngine.Initialize (GetType().Assembly, null, TempDir, null, null); - - if (firstRun) - AddinManager.Registry.Update (new ConsoleProgressStatus (true)); - else - AddinManager.Registry.ResetConfiguration (); + AddinManager.AddinEngine.Initialize (GetType().Assembly, null, configDir, null, null); - firstRun = false; + AddinManager.Registry.Update (new ConsoleProgressStatus (true)); } [OneTimeTearDown] -- cgit v1.2.3