Inheritance: IActiveWpfTextViewTracker
 public CurrentDirectoryTest() {
     var sessionProvider = VsAppShell.Current.ExportProvider.GetExportedValue<IRSessionProvider>();
     var historyProvider = VsAppShell.Current.ExportProvider.GetExportedValue<IRHistoryProvider>();
     var activeTextViewTracker = new ActiveTextViewTrackerMock(string.Empty, string.Empty);
     var debuggerModeTracker = new TestDebuggerModeTracker();
     _interactiveWorkflow = new RInteractiveWorkflow(sessionProvider, historyProvider, activeTextViewTracker, debuggerModeTracker, null, VsAppShell.Current, RToolsSettings.Current, () => {});
 }
Esempio n. 2
0
        public CurrentDirectoryTest() {
            var connectionsProvider = VsAppShell.Current.ExportProvider.GetExportedValue<IConnectionManagerProvider>();
            var historyProvider = VsAppShell.Current.ExportProvider.GetExportedValue<IRHistoryProvider>();
            var packagesProvider = VsAppShell.Current.ExportProvider.GetExportedValue<IRPackageManagerProvider>();
            var plotsProvider = VsAppShell.Current.ExportProvider.GetExportedValue<IRPlotManagerProvider>();
            var activeTextViewTracker = new ActiveTextViewTrackerMock(string.Empty, string.Empty);
            var debuggerModeTracker = new TestDebuggerModeTracker();
            _interactiveWorkflow = UIThreadHelper.Instance.Invoke(() => new RInteractiveWorkflow(
                connectionsProvider, historyProvider, packagesProvider, plotsProvider, activeTextViewTracker,
                debuggerModeTracker, VsAppShell.Current, RToolsSettings.Current));

            _sessionProvider = _interactiveWorkflow.RSessions;
        }
Esempio n. 3
0
        public async Task HelpTest() {
            var clientApp = new RHostClientHelpTestApp();
            await HostScript.InitializeAsync(clientApp);
            using (new ControlTestScript(typeof(HelpVisualComponent))) {
                DoIdle(100);

                var activeViewTrackerMock = new ActiveTextViewTrackerMock("  plot", RContentTypeDefinition.ContentType);
                var activeReplTrackerMock = new ActiveRInteractiveWindowTrackerMock();

                var interactiveWorkflow = Substitute.For<IRInteractiveWorkflow>();
                interactiveWorkflow.RSession.Returns(HostScript.Session);

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

                component.VisualTheme = "Light.css";
                await UIThreadHelper.Instance.InvokeAsync(() => {
                    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");

                    clientApp.Ready.Reset();
                    cmd.Invoke();
                });

                await WaitForReadyAndRenderedAsync(clientApp);

                clientApp.Uri.IsLoopback.Should().Be(true);
                clientApp.Uri.PathAndQuery.Should().Be("/library/graphics/html/plot.html");
            }
        }
        public void HelpTest() {
            var clientApp = new RHostClientHelpTestApp();
            var sessionProvider = VsAppShell.Current.ExportProvider.GetExportedValue<IRSessionProvider>();
            var historyProvider = RHistoryProviderStubFactory.CreateDefault();
            using (var hostScript = new RHostScript(sessionProvider, clientApp)) {
                using (var script = new ControlTestScript(typeof(HelpWindowVisualComponent))) {
                    DoIdle(100);

                    var activeViewTrackerMock = new ActiveTextViewTrackerMock("  plot", RContentTypeDefinition.ContentType);
                    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);

                    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);
                }
            }
        }