diff options
author | Lluis Sanchez <llsan@microsoft.com> | 2022-09-14 18:54:02 +0300 |
---|---|---|
committer | Lluis Sanchez <llsan@microsoft.com> | 2022-09-14 18:54:02 +0300 |
commit | fe500b5cf0366ab8b94709c26a01053a02af9161 (patch) | |
tree | 430cf7abd8c54bec4f646069c34378b46aa35aef /Test | |
parent | 8b166bdedb082f83e6dbdaf4da03e95ca6745860 (diff) |
Fix tests
Make sure the test repo dir is cleaned for every test run.
Diffstat (limited to 'Test')
-rw-r--r-- | Test/UnitTests/TestBase.cs | 22 |
1 files 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] |