public void SetSite()
        {
            // Create the package
            IVsPackage package = new JavaScriptBrowserPackage() as IVsPackage;
            Assert.IsNotNull(package, "The object does not implement IVsPackage");

            // Create a basic service provider
            OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();

            // Site the package
            Assert.AreEqual(0, package.SetSite(serviceProvider), "SetSite did not return S_OK");

            // Unsite the package
            Assert.AreEqual(0, package.SetSite(null), "SetSite(null) did not return S_OK");
        }
        public void ValidateToolWindowShown()
        {
            IVsPackage package = new JavaScriptBrowserPackage() as IVsPackage;

            // Create a basic service provider
            OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();

            //Add uishell service that knows how to create a toolwindow
            BaseMock uiShellService = UIShellServiceMock.GetUiShellInstanceCreateToolWin();
            serviceProvider.AddService(typeof(SVsUIShell), uiShellService, false);

            // Site the package
            Assert.AreEqual(0, package.SetSite(serviceProvider), "SetSite did not return S_OK");

            MethodInfo method = typeof(JavaScriptBrowserPackage).GetMethod("ShowToolWindow", BindingFlags.NonPublic | BindingFlags.Instance);

            object result = method.Invoke(package, new object[] { null, null });
        }
        public void ShowToolwindowNegativeTest()
        {
            IVsPackage package = new JavaScriptBrowserPackage() as IVsPackage;

            // Create a basic service provider
            OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();

            //Add uishell service that knows how to create a toolwindow
            BaseMock uiShellService = UIShellServiceMock.GetUiShellInstanceCreateToolWinReturnsNull();
            serviceProvider.AddService(typeof(SVsUIShell), uiShellService, false);

            // Site the package
            Assert.AreEqual(0, package.SetSite(serviceProvider), "SetSite did not return S_OK");

            MethodInfo method = typeof(JavaScriptBrowserPackage).GetMethod("ShowToolWindow", BindingFlags.NonPublic | BindingFlags.Instance);

            //ShowToolWindow throw NotSupportException but the Exception is converted during the
            //call of invoke method
            object result = method.Invoke(package, new object[] { null, null });
        }
 public void IsIVsPackage()
 {
     JavaScriptBrowserPackage package = new JavaScriptBrowserPackage();
     Assert.IsNotNull(package as IVsPackage, "The object does not implement IVsPackage");
 }
 public void CreateInstance()
 {
     JavaScriptBrowserPackage package = new JavaScriptBrowserPackage();
 }