public void RunBrowserTest(WebBrowserRole role, Guid guid, string title, IRToolsSettings externalSettings, IRToolsSettings internalSettings)
        {
            var shell = Substitute.For <ICoreShell>();
            var ps    = Substitute.For <IProcessServices>();
            var vswbs = Substitute.For <IVsWebBrowsingService>();

            shell.Process().Returns(ps);
            shell.GetService <IVsWebBrowsingService>(typeof(SVsWebBrowsingService)).Returns(vswbs);

            var wbs = new WebBrowserServices(shell);

            wbs.OpenBrowser(role, _url);
            shell.Process().Received().Start(_url);

            ps.ClearReceivedCalls();
            wbs = new WebBrowserServices(shell);
            wbs.OpenBrowser(role, _url);

            UIThreadHelper.Instance.DoEvents();
            shell.Process().DidNotReceive().Start(_url);

            IVsWebBrowser  vswb;
            IVsWindowFrame frame;

            vswbs.Received().CreateWebBrowser(Arg.Any <uint>(), guid, title, _url, null, out vswb, out frame);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        public void ExternaBrowser()
        {
            var vswbs    = Substitute.For <IVsWebBrowsingService>();
            var ps       = Substitute.For <IProcessServices>();
            var settings = Substitute.For <IRToolsSettings>();

            var wbs = new WebBrowserServices(vswbs, ps, settings);

            wbs.OpenBrowser(WebBrowserRole.External, _url);
            ps.Received().Start(_url);
        }
        public void ExternaBrowser()
        {
            var shell = Substitute.For <ICoreShell>();
            var ps    = Substitute.For <IProcessServices>();

            shell.Process().Returns(ps);

            var wbs = new WebBrowserServices(shell);

            wbs.OpenBrowser(WebBrowserRole.External, _url);
            ps.Received().Start(_url);
        }
Beispiel #5
0
        public void RunBrowserTest(WebBrowserRole role, Guid guid, string title, IRToolsSettings externalSettings, IRToolsSettings internalSettings)
        {
            var vswbs = Substitute.For <IVsWebBrowsingService>();
            var ps    = Substitute.For <IProcessServices>();

            var wbs = new WebBrowserServices(vswbs, ps, externalSettings);

            wbs.OpenBrowser(role, _url);
            ps.Received().Start(_url);

            ps.ClearReceivedCalls();
            wbs = new WebBrowserServices(vswbs, ps, internalSettings);
            wbs.OpenBrowser(role, _url);
            ps.DidNotReceive().Start(_url);

            IVsWebBrowser  vswb;
            IVsWindowFrame frame;

            vswbs.Received().CreateWebBrowser(Arg.Any <uint>(), guid, title, _url, null, out vswb, out frame);
        }