Esempio n. 1
0
        public TestContainerDiscoverer
        (
            [Import(typeof(IOperationState))]
            IOperationState operationState,

            IFCCEngine fccEngine,
            IInitializer initializer,
            ITestOperationFactory testOperationFactory,
            ILogger logger,
            IAppOptionsProvider appOptionsProvider

        )
        {
            appOptionsProvider.OptionsChanged += AppOptionsEvents_OptionsChanged;
            this.appOptionsProvider            = appOptionsProvider;
            this.fccEngine            = fccEngine;
            this.testOperationFactory = testOperationFactory;
            this.logger = logger;

            initializeThread = new Thread(() =>
            {
                operationState.StateChanged += OperationState_StateChanged;
                initializer.Initialize();
            });
            initializeThread.Start();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="OutputToolWindowControl"/> class.
        /// </summary>
        public OutputToolWindowControl(ScriptManager scriptManager, IFCCEngine fccEngine)
        {
            InitializeComponent();

            ThreadHelper.JoinableTaskFactory.Run(async() =>
            {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
                Dte = (DTE)await OutputToolWindowCommand.Instance.ServiceProvider.GetServiceAsync(typeof(DTE));
                Assumes.Present(Dte);
                Events                       = Dte.Events;
                SolutionEvents               = Events.SolutionEvents;
                SolutionEvents.Opened       += () => Clear();
                SolutionEvents.AfterClosing += () => Clear();
            });

            FCCOutputBrowser.ObjectForScripting = scriptManager;

            fccEngine.UpdateOutputWindow += (args) =>
            {
                ThreadHelper.JoinableTaskFactory.Run(async() =>
                {
                    await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                    if (string.IsNullOrWhiteSpace(args?.HtmlContent))
                    {
                        Clear();
                        return;
                    }

                    FCCOutputBrowser.NavigateToString(args.HtmlContent);
                    FCCOutputBrowser.Visibility = Visibility.Visible;
                });
            };
        }
Esempio n. 3
0
        public void Initialize(string appDataFolder, IFCCEngine fccEngine, CancellationToken cancellationToken)
        {
            this.fccEngine = fccEngine;
            var zipDestination = toolFolder.EnsureUnzipped(appDataFolder, zipDirectoryName, toolZipProvider.ProvideZip(zipPrefix), cancellationToken);

            fccMsTestAdapterPath = Path.Combine(zipDestination, "build", "netstandard1.0");
            shimPath             = Path.Combine(zipDestination, "build", "netstandard1.0", "CodeCoverage", "coreclr", "Microsoft.VisualStudio.CodeCoverage.Shim.dll");
        }
Esempio n. 4
0
 public PackageInitializer(
     IFCCEngine fccEngine,
     [Import(typeof(SVsServiceProvider))]
     IServiceProvider serviceProvider)
 {
     this.fccEngine       = fccEngine;
     this.serviceProvider = serviceProvider;
 }
        /// <summary>
        /// Initializes the singleton instance of the command.
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        public static async Task InitializeAsync(AsyncPackage package, IFCCEngine fccEngine)
        {
            // Switch to the main thread - the call to AddCommand in ClearUICommand's constructor requires
            // the UI thread.
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);

            OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;

            Instance = new ClearUICommand(commandService, fccEngine);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ClearUICommand"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        /// <param name="commandService">Command service to add command to, not null.</param>
        private ClearUICommand(OleMenuCommandService commandService, IFCCEngine fccEngine)
        {
            this.fccEngine = fccEngine;
            commandService = commandService ?? throw new ArgumentNullException(nameof(commandService));

            var menuCommandID = new CommandID(CommandSet, CommandId);
            var menuItem      = new MenuCommand(this.Execute, menuCommandID);

            commandService.AddCommand(menuItem);
        }
Esempio n. 7
0
 public Initializer(
     IFCCEngine fccEngine,
     ILogger logger,
     ICoverageProjectFactory coverageProjectFactory,
     IPackageInitializer packageInitializer
     )
 {
     this.fccEngine = fccEngine;
     this.logger    = logger;
     this.coverageProjectFactory = coverageProjectFactory;
     this.packageInitializer     = packageInitializer;
 }
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        /// <param name="cancellationToken">A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.</param>
        /// <param name="progress">A provider for progress updates.</param>
        /// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns>
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            // When initialized asynchronously, the current thread may be a background thread at this point.
            // Do any initialization that requires the UI thread after switching to the UI thread.
            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            var _dte2 = (DTE2)GetGlobalService(typeof(SDTE));
            var sp    = new ServiceProvider(_dte2 as Microsoft.VisualStudio.OLE.Interop.IServiceProvider);

            componentModel = sp.GetService(typeof(Microsoft.VisualStudio.ComponentModelHost.SComponentModel)) as Microsoft.VisualStudio.ComponentModelHost.IComponentModel;
            Assumes.Present(componentModel);
            fccEngine = componentModel.GetService <IFCCEngine>();

            await OutputToolWindowCommand.InitializeAsync(this, componentModel.GetService <ILogger>());

            await ClearUICommand.InitializeAsync(this, fccEngine);
        }
        public TestContainerDiscoverer
        (
            [Import(typeof(IOperationState))]
            IOperationState operationState,

            IFCCEngine fccEngine,
            IInitializer initializer,
            ITestOperationFactory testOperationFactory,
            ILogger logger,
            IAppOptionsProvider appOptionsProvider,
            IReportGeneratorUtil reportGeneratorUtil,
            IDisposeAwareTaskRunner disposeAwareTaskRunner,
            IMsCodeCoverageRunSettingsService msCodeCoverageRunSettingsService

        )
        {
            this.appOptionsProvider  = appOptionsProvider;
            this.reportGeneratorUtil = reportGeneratorUtil;
            this.msCodeCoverageRunSettingsService = msCodeCoverageRunSettingsService;
            this.fccEngine            = fccEngine;
            this.testOperationFactory = testOperationFactory;
            this.logger = logger;
            testOperationStateChangeHandlers = new Dictionary <TestOperationStates, Func <IOperation, Task> >
            {
                { TestOperationStates.TestExecutionCanceling, TestExecutionCancellingAsync },
                { TestOperationStates.TestExecutionStarting, TestExecutionStartingAsync },
                { TestOperationStates.TestExecutionFinished, TestExecutionFinishedAsync },
                { TestOperationStates.TestExecutionCancelAndFinished, TestExecutionCancelAndFinishedAsync },
            };

            disposeAwareTaskRunner.RunAsync(() =>
            {
                initializeTask = Task.Run(async() =>
                {
                    operationState.StateChanged += OperationState_StateChanged;
                    await initializer.InitializeAsync(disposeAwareTaskRunner.DisposalToken);
                });
                return(initializeTask);
            });
        }
Esempio n. 10
0
 public Tagger(ITextBuffer textBuffer, IFCCEngine fccEngine)
 {
     _textBuffer                 = textBuffer;
     this.fccEngine              = fccEngine;
     fccEngine.UpdateMarginTags += FCCEngine_UpdateMarginTags;
 }
Esempio n. 11
0
 public TaggerProvider(IFCCEngine fccEngine)
 {
     this.fccEngine = fccEngine;
 }