retag
[mcs.git] / nunit24 / ClientUtilities / util / Services.cs
blob99dd144610923365f7e6dfb9000382202277a1ea
1 // ****************************************************************
2 // Copyright 2007, Charlie Poole
3 // This is free software licensed under the NUnit license. You may
4 // obtain a copy of the license at http://nunit.org/?p=license&r=2.4
5 // ****************************************************************
7 using System;
8 using NUnit.Core;
9 using NUnit.Core.Extensibility;
11 namespace NUnit.Util
13 /// <summary>
14 /// Summary description for Services
15 /// </summary>
16 public class Services
18 #region AddinManager
19 private static AddinManager addinManager;
20 public static AddinManager AddinManager
22 get
24 if (addinManager == null )
25 addinManager = (AddinManager)ServiceManager.Services.GetService( typeof( AddinManager ) );
27 return addinManager;
30 #endregion
32 #region AddinRegistry
33 private static IAddinRegistry addinRegistry;
34 public static IAddinRegistry AddinRegistry
36 get
38 if (addinRegistry == null)
39 addinRegistry = (IAddinRegistry)ServiceManager.Services.GetService( typeof( IAddinRegistry ) );
41 return addinRegistry;
44 #endregion
46 #region DomainManager
47 private static DomainManager domainManager;
48 public static DomainManager DomainManager
50 get
52 if ( domainManager == null )
53 domainManager = (DomainManager)ServiceManager.Services.GetService( typeof( DomainManager ) );
55 return domainManager;
58 #endregion
60 #region UserSettings
61 private static SettingsService userSettings;
62 public static SettingsService UserSettings
64 get
66 if ( userSettings == null )
67 userSettings = (SettingsService)ServiceManager.Services.GetService( typeof( SettingsService ) );
69 // Temporary fix needed to run TestDomain tests in test AppDomain
70 // TODO: Figure out how to set up the test domain correctly
71 if ( userSettings == null )
72 userSettings = new SettingsService();
74 return userSettings;
78 #endregion
80 #region RecentFilesService
81 private static RecentFiles recentFiles;
82 public static RecentFiles RecentFiles
84 get
86 if ( recentFiles == null )
87 recentFiles = (RecentFiles)ServiceManager.Services.GetService( typeof( RecentFiles ) );
89 return recentFiles;
92 #endregion
94 #region TestLoader
95 private static TestLoader loader;
96 public static TestLoader TestLoader
98 get
100 if ( loader == null )
101 loader = (TestLoader)ServiceManager.Services.GetService( typeof( TestLoader ) );
103 return loader;
106 #endregion
108 #region TestAgency
109 private static TestAgency agency;
110 public static TestAgency TestAgency
114 if ( agency == null )
115 agency = (TestAgency)ServiceManager.Services.GetService( typeof( TestAgency ) );
117 // Temporary fix needed to run ProcessRunner tests in test AppDomain
118 // TODO: Figure out how to set up the test domain correctly
119 // if ( agency == null )
120 // {
121 // agency = new TestAgency();
122 // agency.Start();
123 // }
125 return agency;
128 #endregion