chr
2026-04-08 53e656200368a983e563550e2cc1acbc6d86b729
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//            Copyright Keysight Technologies 2012-2019
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at http://mozilla.org/MPL/2.0/.
using NUnit.Framework;
using System;
using System.Globalization;
using System.Reflection;
 
namespace OpenTap.Engine.UnitTests
{
  
    [SetUpFixture]
    public class TapTestInit
    {
        [OneTimeSetUp]
        public static void AssemblyInit()
        {
            
            CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
            CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
            EngineSettings.LoadWorkingDirectory(System.IO.Path.GetDirectoryName(typeof(TestStep).Assembly.Location));
            ThreadManager.IdleThreadCount = 0;
            SessionLogs.SkipStartupInfo = true;
            
            PluginManager.SearchAsync().Wait();
            SessionLogs.Initialize(string.Format("OpenTap.Engine.UnitTests {0}.TapLog", DateTime.Now.ToString("HH-mm-ss.fff")));
 
            Assembly engine = Assembly.GetAssembly(typeof(ITestStep));
             OpenTap.Log.CreateSource("UnitTest").Info("OpenTAP version '{0}' initialized {1}", PluginManager.GetOpenTapAssembly().SemanticVersion, DateTime.Now.ToString("MM/dd/yyyy"));
        }
 
        [OneTimeTearDown]
        public static void AssemblyCleanup()
        {
            SessionLogs.Flush();
            Log.Flush();
            Assert.IsTrue(Session.RootSession == Session.Current);
            if (TapThread.Current.AbortToken.IsCancellationRequested)
            {
                Assert.Fail("This should not occur.");
            }
            
            //Session.RootSession.Dispose();
            //Session.RootSession.DisposeSessionLocals();
        }
    }
}