public void TearDown() { if (loader.IsTestLoaded) { loader.UnloadTest(); } if (loader.IsProjectLoaded) { loader.UnloadProject(); } }
public void TearDown() { if (loader.IsTestLoaded) { loader.UnloadTest(); } if (loader.IsProjectLoaded) { loader.UnloadProject(); } FileInfo file = new FileInfo(badFile); if (file.Exists) { file.Delete(); } NUnitRegistry.TestMode = true; }
/// <summary> /// Overrides <see cref="TestExtractor.Extractor.Extractor.Extractor.Extract()" /> /// </summary> protected override void Extract() { var assemblies = AppDomain.CurrentDomain.GetData(AppDataDomainExtractionAssemblyName) as IList <string>; if (assemblies == null || !assemblies.Any()) { return; } TestSuites = new List <ISuiteNode>(); TestMethods = new List <IStubNode>(); ServiceManager.Services.AddService(new SettingsService()); ServiceManager.Services.AddService(new DomainManager()); ServiceManager.Services.AddService(new ProjectService()); ServiceManager.Services.AddService(new AddinRegistry()); ServiceManager.Services.AddService(new AddinManager()); ServiceManager.Services.AddService(new TestAgency()); ServiceManager.Services.InitializeServices(); foreach (var assembly in assemblies.Distinct().Where(File.Exists)) { _assembly = assembly; var loader = new TestLoader(); loader.Events.TestLoaded += NodeLoadEvent; loader.LoadProject(assembly); loader.LoadTest(); loader.UnloadTest(); loader.UnloadProject(); loader.Events.TestLoaded -= NodeLoadEvent; _assembly = string.Empty; } var tests = TestMethods.ToList(); var testSuites = TestSuites.ToList(); AppDomain.CurrentDomain.SetData(AppDataDomainExtractionStubName, tests); AppDomain.CurrentDomain.SetData(AppDataDomainExtractionSuiteName, testSuites); ServiceManager.Services.StopAllServices(); ServiceManager.Services.ClearServices(); }