Beispiel #1
0
        public static IRInteractiveWorkflowProvider Create(string brokerConnectorName
                                                           , IRSessionProvider sessionProvider = null
                                                           , IConnectionManagerProvider connectionsProvider = null
                                                           , IRHistoryProvider historyProvider               = null
                                                           , IRPackageManagerProvider packagesProvider       = null
                                                           , IRPlotManagerProvider plotsProvider             = null
                                                           , IActiveWpfTextViewTracker activeTextViewTracker = null
                                                           , IDebuggerModeTracker debuggerModeTracker        = null
                                                           , IRHostBrokerConnector brokerConnector           = null
                                                           , ICoreShell shell       = null
                                                           , IRSettings settings    = null
                                                           , IWorkspaceServices wss = null)
        {
            sessionProvider     = sessionProvider ?? new RSessionProviderMock();
            connectionsProvider = connectionsProvider ?? ConnectionManagerProviderStubFactory.CreateDefault();
            historyProvider     = historyProvider ?? RHistoryProviderStubFactory.CreateDefault();
            packagesProvider    = packagesProvider ?? RPackageManagerProviderStubFactory.CreateDefault();
            plotsProvider       = plotsProvider ?? RPlotManagerProviderStubFactory.CreateDefault();

            activeTextViewTracker = activeTextViewTracker ?? new ActiveTextViewTrackerMock(string.Empty, RContentTypeDefinition.ContentType);
            debuggerModeTracker   = debuggerModeTracker ?? new VsDebuggerModeTracker();
            brokerConnector       = brokerConnector ?? new RHostBrokerConnectorMock();
            shell    = shell ?? VsAppShell.Current;
            settings = settings ?? RToolsSettings.Current;

            return(new TestRInteractiveWorkflowProvider(
                       sessionProvider, connectionsProvider, historyProvider, packagesProvider,
                       plotsProvider, activeTextViewTracker, debuggerModeTracker, brokerConnector,
                       shell, settings, wss)
            {
                BrokerName = brokerConnectorName
            });
        }
Beispiel #2
0
        public static IRInteractiveWorkflowProvider Create(IRSessionProvider sessionProvider   = null
                                                           , IRHistoryProvider historyProvider = null
                                                           , IActiveWpfTextViewTracker activeTextViewTracker = null
                                                           , IDebuggerModeTracker debuggerModeTracker        = null
                                                           , ICoreShell shell    = null
                                                           , IRSettings settings = null)
        {
            sessionProvider = sessionProvider ?? new RSessionProviderMock();
            historyProvider = historyProvider ?? RHistoryProviderStubFactory.CreateDefault();

            activeTextViewTracker = activeTextViewTracker ?? new ActiveTextViewTrackerMock(string.Empty, RContentTypeDefinition.ContentType);
            debuggerModeTracker   = debuggerModeTracker ?? new VsDebuggerModeTracker();

            return(new TestRInteractiveWorkflowProvider(sessionProvider, historyProvider, activeTextViewTracker, debuggerModeTracker, shell ?? VsAppShell.Current, settings ?? RToolsSettings.Current));
        }
Beispiel #3
0
        public void HelpTest()
        {
            var clientApp       = new RHostClientHelpTestApp();
            var historyProvider = RHistoryProviderStubFactory.CreateDefault();

            using (var hostScript = new VsRHostScript(clientApp)) {
                using (var script = new ControlTestScript(typeof(HelpWindowVisualComponent))) {
                    DoIdle(100);

                    var activeViewTrackerMock       = new ActiveTextViewTrackerMock("  plot", RContentTypeDefinition.ContentType);
                    var activeReplTrackerMock       = new ActiveRInteractiveWindowTrackerMock();
                    var sessionProvider             = VsAppShell.Current.ExportProvider.GetExportedValue <IRSessionProvider>();
                    var interactiveWorkflowProvider = TestRInteractiveWorkflowProviderFactory.Create(sessionProvider, activeTextViewTracker: activeViewTrackerMock);
                    var interactiveWorkflow         = interactiveWorkflowProvider.GetOrCreate();

                    var component = ControlWindow.Component as IHelpWindowVisualComponent;
                    component.Should().NotBeNull();

                    component.VisualTheme = "Light.css";
                    clientApp.Component   = component;

                    var view = activeViewTrackerMock.GetLastActiveTextView(RContentTypeDefinition.ContentType);

                    var cmd = new ShowHelpOnCurrentCommand(interactiveWorkflow, activeViewTrackerMock, activeReplTrackerMock);

                    cmd.Should().BeVisibleAndDisabled();
                    view.Caret.MoveTo(new SnapshotPoint(view.TextBuffer.CurrentSnapshot, 3));

                    cmd.Should().BeVisibleAndEnabled();
                    cmd.Text.Should().EndWith("plot");

                    cmd.Invoke();
                    WaitForAppReady(clientApp);

                    clientApp.Uri.IsLoopback.Should().Be(true);
                    clientApp.Uri.PathAndQuery.Should().Be("/library/graphics/html/plot.html");

                    DoIdle(500);
                }
            }
        }
        public static TestRInteractiveWorkflowProvider Create(IConnectionManagerProvider connectionsProvider    = null
                                                              , IRHistoryProvider historyProvider               = null
                                                              , IRPackageManagerProvider packagesProvider       = null
                                                              , IRPlotManagerProvider plotsProvider             = null
                                                              , IActiveWpfTextViewTracker activeTextViewTracker = null
                                                              , IDebuggerModeTracker debuggerModeTracker        = null
                                                              , ICoreShell shell    = null
                                                              , IRSettings settings = null)
        {
            connectionsProvider = connectionsProvider ?? ConnectionManagerProviderStubFactory.CreateDefault();
            historyProvider     = historyProvider ?? RHistoryProviderStubFactory.CreateDefault();
            packagesProvider    = packagesProvider ?? RPackageManagerProviderStubFactory.CreateDefault();
            plotsProvider       = plotsProvider ?? RPlotManagerProviderStubFactory.CreateDefault();

            activeTextViewTracker = activeTextViewTracker ?? new ActiveTextViewTrackerMock(string.Empty, RContentTypeDefinition.ContentType);
            debuggerModeTracker   = debuggerModeTracker ?? new VsDebuggerModeTracker(shell ?? Substitute.For <ICoreShell>());
            shell = shell ?? VsAppShell.Current;

            return(new TestRInteractiveWorkflowProvider(
                       connectionsProvider, historyProvider, packagesProvider, plotsProvider,
                       activeTextViewTracker, debuggerModeTracker, shell));
        }