예제 #1
0
        public void ShowToolwindowNegativeTest()
        {
            IVsPackage package = new MetaCommanderPackage() 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(MetaCommanderPackage).GetMethod("ShowToolWindow", BindingFlags.NonPublic | BindingFlags.Instance);

            //Invoke thows TargetInvocationException, but we want it's inner Exception thrown by ShowToolWindow, InvalidOperationException.
            try
            {
                object result = method.Invoke(package, new object[] { null, null });
            }
            catch (Exception e)
            {
                throw e.InnerException;
            }
        }
예제 #2
0
파일: PackageTest.cs 프로젝트: DzmitrySo/mc
        public void SetSite()
        {
            // Create the package
            IVsPackage package = new MetaCommanderPackage() 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");
        }
예제 #3
0
        public void ValidateToolWindowShown()
        {
            IVsPackage package = new MetaCommanderPackage() 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(MetaCommanderPackage).GetMethod("ShowToolWindow", BindingFlags.NonPublic | BindingFlags.Instance);

            object result = method.Invoke(package, new object[] { null, null });
        }
예제 #4
0
파일: PackageTest.cs 프로젝트: DzmitrySo/mc
 public void IsIVsPackage()
 {
     MetaCommanderPackage package = new MetaCommanderPackage();
     Assert.IsNotNull(package as IVsPackage, "The object does not implement IVsPackage");
 }
예제 #5
0
파일: PackageTest.cs 프로젝트: DzmitrySo/mc
 public void CreateInstance()
 {
     MetaCommanderPackage package = new MetaCommanderPackage();
 }