private static void SetupSettings(out ICoreShell shell, out IRMarkdownEditorSettings settings) { var testShell = TestCoreShell.CreateSubstitute(); settings = testShell.SetupSettingsSubstitute(); shell = testShell; }
public void RunBrowserTest(WebBrowserRole role, Guid guid, string title, IRSettings externalSettings, IRSettings internalSettings) { var shell = TestCoreShell.CreateSubstitute(); var vswbs = Substitute.For <IVsWebBrowsingService>(); shell.ServiceManager .AddService(vswbs, typeof(SVsWebBrowsingService)) .AddService(externalSettings); var ps = shell.GetService <IProcessServices>(); var wbs = new WebBrowserServices(shell); wbs.OpenBrowser(role, _url); ps.Received().Start(_url); ps.ClearReceivedCalls(); shell.ServiceManager.RemoveService <IRSettings>(); shell.ServiceManager.AddService(internalSettings); wbs = new WebBrowserServices(shell); wbs.OpenBrowser(role, _url); UIThreadHelper.Instance.DoEvents(); ps.DidNotReceive().Start(_url); vswbs.Received().CreateWebBrowser(Arg.Any <uint>(), guid, title, _url, null, out var vswb, out var frame); }
public static IRMarkdownEditorSettings SetupSettingsSubstitute(this TestCoreShell shell) { var settings = Substitute.For <IRMarkdownEditorSettings>(); shell.ServiceManager.AddService(settings); return(settings); }
public CommandTest() { _shell = TestCoreShell.CreateSubstitute(); _pss = Substitute.For <IProjectSystemServices>(); _servicesProvider = Substitute.For <IDacPackageServicesProvider>(); _storage = Substitute.For <ISettingsStorage>(); }
public RendererTest(MarkdownTestFilesFixture files) { _files = files; _shell = TestCoreShell.CreateSubstitute(); _shell.SetupSettingsSubstitute(); _shell.SetupSessionSubstitute(); }
public RCodeBlockTest() { _shell = TestCoreShell.CreateSubstitute(); _session = _shell.SetupSessionSubstitute(); _interaction = Substitute.For <IRSessionInteraction>(); _session.BeginInteractionAsync(Arg.Any <bool>(), Arg.Any <CancellationToken>()).Returns(Task.FromResult(_interaction)); }
public LanguagesEditorTestExportProvider(CompositionContainer compositionContainer, IServiceManager services) : base(compositionContainer) { services.AddService(new TestEditorSupport()); _coreShell = TestCoreShell.CreateFromCompositionContainer(compositionContainer, services); // TODO: HACK - remove after REditorSettings turn into service. REditorSettings.Initialize(new TestSettingsStorage()); }
protected override void AddValues(CompositionContainer container) { base.AddValues(container); var coreShell = new TestCoreShell(container); var batch = new CompositionBatch() .AddValue(FileSystemStubFactory.CreateDefault()) .AddValue<IRSettings>(RSettingsStubFactory.CreateForExistingRPath()) .AddValue<ICoreShell>(coreShell) .AddValue(coreShell); container.Compose(batch); }
protected override void AddValues(CompositionContainer container) { base.AddValues(container); var coreShell = new TestCoreShell(container); var batch = new CompositionBatch() .AddValue <IRSettings>(RSettingsStubFactory.CreateForExistingRPath()) .AddValue <ICoreShell>(coreShell) .AddValue(coreShell); container.Compose(batch); }
public override Task <Task <RunSummary> > InitializeAsync(ITestInput testInput, IMessageBus messageBus) { var coreShell = new TestCoreShell(CompositionContainer, _coreServices); var batch = new CompositionBatch() .AddValue <IRSettings>(RSettingsStubFactory.CreateForExistingRPath(testInput.FileSytemSafeName)) .AddValue <ICoreShell>(coreShell) .AddValue(coreShell); CompositionContainer.Compose(batch); return(base.InitializeAsync(testInput, messageBus)); }
public SProcPublisherTest(PackageTestFilesFixture files) { _files = files; _shell = TestCoreShell.CreateSubstitute(); _shell.ServiceManager.RemoveService(_shell.ServiceManager.GetService <IFileSystem>()); _shell.ServiceManager.AddService(new WindowsFileSystem()); _pss = Substitute.For <IProjectSystemServices>(); _dacServices = Substitute.For <IDacPackageServices>(); }
public BrowserViewTest() { var shell = TestCoreShell.CreateSubstitute(); shell.SetupSettingsSubstitute(); shell.SetupSessionSubstitute(); shell.ServiceManager.RemoveService(shell.ServiceManager.GetService <IFileSystem>()); shell.ServiceManager.AddService(new WindowsFileSystem()); _browser = new BrowserView("file", shell.Services); }
private static ICoreShell SetupServices(out IWpfTextViewHost host, out IWpfTextViewMargin container, out IRMarkdownEditorSettings settings) { var shell = TestCoreShell.CreateSubstitute(); settings = shell.SetupSettingsSubstitute(); shell.SetupSessionSubstitute(); host = Substitute.For <IWpfTextViewHost>(); var tb = new TextBufferMock("", MdContentTypeDefinition.ContentType); var tv = new WpfTextViewMock(tb); host.TextView.Returns(tv); container = Substitute.For <IWpfTextViewMargin>(); return(shell); }
public async Task Constructor() { var shell = TestCoreShell.CreateSubstitute(); var pss = Substitute.For <IProjectSystemServices>(); var pcsp = Substitute.For <IProjectConfigurationSettingsProvider>(); var s = Substitute.For <ISettingsStorage>(); var dlg = await SqlPublshOptionsDialog.CreateAsync(shell, pss, pcsp, s); dlg.Title.Should().Be(Resources.SqlPublishDialog_Title); dlg.DataContext.Should().BeOfType(typeof(SqlPublishOptionsDialogViewModel)); var model = dlg.DataContext as SqlPublishOptionsDialogViewModel; model.Settings.TargetType.Should().Be(PublishTargetType.Dacpac); model.TargetHasName.Should().BeFalse(); model.GenerateTable.Should().BeFalse(); model.Settings.Should().NotBeNull(); }
public static IRSession SetupSessionSubstitute(this TestCoreShell shell) { var wfp = Substitute.For <IRInteractiveWorkflowProvider>(); shell.ServiceManager.AddService(wfp); var workflow = Substitute.For <IRInteractiveWorkflow>(); wfp.GetOrCreate().Returns(workflow); var session = Substitute.For <IRSession>(); session.IsHostRunning.Returns(true); var sessionProvider = Substitute.For <IRSessionProvider>(); sessionProvider.GetOrCreate(Arg.Any <string>()).Returns(session); workflow.RSessions.Returns(sessionProvider); return(session); }
private async Task CheckSurveyNews(SurveyNewsFeed feed, SurveyNewsPolicy policy, DateTime lastChecked, bool forceCheck, string expectedNavigatedUrl, DateTime?expectedLastChecked) { string navigatedUrl = null; // Create the test objects var shell = TestCoreShell.CreateSubstitute(); var ps = shell.Process(); ps.When(x => x.Start(Arg.Any <string>())).Do(x => { navigatedUrl = (string)x.Args()[0]; }); var options = new MockSurveyNewsOptions(policy, lastChecked); var feedClient = new MockSurveyNewsFeedClient(feed); // Invoke the real survey/news service var service = new SurveyNewsService(feedClient, options, shell); await service.CheckSurveyNewsAsync(forceCheck); // Check that we navigated to the right url (or didn't navigate at all) navigatedUrl.Should().Be(expectedNavigatedUrl); // Check that the last checked date has been updated (or not updated at all) if (expectedLastChecked.HasValue) { var delta = options.SurveyNewsLastCheck - expectedLastChecked.Value; delta.Duration().Should().BeLessOrEqualTo(TimeSpan.FromSeconds(5)); } else { options.SurveyNewsLastCheck.Should().Be(lastChecked); } }
public IdleTaskQueueTest() { _shell = TestCoreShell.CreateBasic(); }