public void Initialize() { this.manager = new Mock<ISettingsManager>(); this.monitor = new TracingSettingsMonitor(this.manager.Object); this.source = Tracer.Manager.GetSource("Foo"); this.source.Switch.Level = SourceLevels.Off; }
public void Initialize() { this.source = Tracer.Manager.GetSource("Foo"); this.source.Switch.Level = SourceLevels.Off; this.manager = new Mock<ISettingsManager>(); var setting = new RuntimeSettings(); setting.Tracing.TraceSources.Add(new TraceSourceSetting("Foo", SourceLevels.Warning)); this.manager.Setup(x => x.Read()).Returns(setting); this.monitor = new TracingSettingsMonitor(this.manager.Object); }
#pragma warning restore 0649 /// <summary> /// Called when the VSPackage is loaded by Visual Studio. /// </summary> protected override void Initialize() { base.Initialize(); //Import all services var componentModel = this.GetService<SComponentModel, IComponentModel>(); try { componentModel.DefaultCompositionService.SatisfyImportsOnce(this); var container = (CompositionContainer)componentModel.DefaultCompositionService; container.ComposeExportedValue<Func<ISolutionPicker>>( () => new SolutionPicker()); container.ComposeExportedValue<Func<ISolutionSelector>>( () => new SolutionSelector()); container.ComposeExportedValue<Func<IProductPicker>>( () => new ProductPicker()); } catch (CompositionContractMismatchException) { DumpMefLog(componentModel); throw; } catch (ImportCardinalityMismatchException) { DumpMefLog(componentModel); throw; } catch (CompositionException) { DumpMefLog(componentModel); throw; } // Add services to VS this.AddServices(); // Monitors settings changes and applies them to underlying trace sources. this.tracingMonitor = new TracingSettingsMonitor(this.SettingsManager); var sourceNames = GetConfiguredSourceNames(this.SettingsManager.Read()); this.TraceOutputWindowManager.CreateTracePane(new Guid(Constants.VsOutputWindowPaneId), Constants.OutputWindowTitle, sourceNames.ToArray()); // Monitor setting changes to refresh output window. this.SettingsManager.SettingsChanged += this.OnSettingsChanged; this.InitializeCommands(); this.RegisterEditorFactory(new ProductStateEditorFactory(this.PatternManager)); this.RegisterEditorFactory(new ShortcutEditorFactory(this)); this.productStateValidator = new ProductStateValidator(this); this.ShellEvents.ShellInitialized += OnShellInitialized; this.SolutionEvents.SolutionOpened += OnSolutionOpened; this.SolutionEvents.SolutionClosed += OnSolutionClosed; // If initializing other packages launchpoints worked, // they wouldn't need to do this themselves. this.RegisterRefreshGuidanceStates(); this.GuidanceManager.InstantiatedExtensionsChanged += this.OnInstantiatedGuidanceExtensionChanged; this.GuidanceManager.ActiveExtensionChanged += this.OnActiveGuidanceExtensionChanged; this.InitializeVsLaunchPoints(); }