This class is responsible to close dialog boxes that pop up during different VS Calls
Наследование: IDisposable
Пример #1
0
        public void WhenShowingMessage_ThenSucceeds()
        {
            var components = (IComponentModel)Package.GetGlobalService(typeof(SComponentModel));
            var service = (IServiceProvider)components.GetService<SVsServiceProvider>();
            var ui = (IVsUIShell)service.GetService(typeof(SVsUIShell));

            Assert.NotNull(service);
            Assert.NotNull(ui);

            using (var purger = new DialogBoxPurger(0))
            {
                UIThreadInvoker.Invoke((Action)(() =>
                {
                    PackageUtility.ShowError(service, "Foo", string.Empty);
                }));
            }
        }
Пример #2
0
        public void ConnectToLab_SolutionIsOpen_DialogIsOpen()
        {
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
            {
                DialogBoxPurger purger = new DialogBoxPurger(NativeMethods.IDOK, @"Open solution first.");

                try
                {
                    purger.Start();

                    VsIdeTestHostContext.Dte.ExecuteCommand("Tools.ConnectToLab");
                }
                finally
                {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
Пример #3
0
        public void LaunchCommand() {
            UIThreadInvoker.Invoke((ThreadInvoker) delegate() {
                var menuItemCmd = new CommandID(GuidList.guidShowMyGitBranchCmdSet, (int) PkgCmdIDList.cmdidFirstCommand);

                // Create the DialogBoxListener Thread.
                var expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "ShowMyGitBranch", "ThiagoSa.ShowMyGitBranch.ShowMyGitBranchPackage");
                var purger = new DialogBoxPurger(NativeMethods.IDOK, expectedDialogBoxText);

                try {
                    purger.Start();

                    var testUtils = new TestUtils();
                    testUtils.ExecuteCommand(menuItemCmd);
                }
                finally {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
        public void LaunchCommand()
        {
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
            {
                var menuItemCmd = new CommandID(FSharpVSPowerTools.Constants.guidStandardCmdSet,
                                                (int)FSharpVSPowerTools.Constants.cmdidStandardRenameCommand);
                // Create the DialogBoxListener Thread.
                var expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "PowerToolsCommandsPackage", "FSharpVSPowerTools.PowerToolsCommandsPackage");
                var purger = new DialogBoxPurger(NativeMethods.IDOK, expectedDialogBoxText);

                try
                {
                    purger.Start();
                    TestUtils.ExecuteCommand(menuItemCmd);
                }
                finally
                {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
Пример #5
0
        public void LaunchCommand()
        {
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
            {
                CommandID menuItemCmd = new CommandID(UploadExtension.GuidList.GuidUploadExtensionCmdSet, (int)UploadExtension.PkgCmdIDList.ConnectToTarget);

                // Create the DialogBoxListener Thread.
                string expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "Upload-Extension", "TRIK.Upload_Extension.Upload_ExtensionPackage");
                DialogBoxPurger purger = new DialogBoxPurger(NativeMethods.IDOK, expectedDialogBoxText);

                try
                {
                    purger.Start();

                    TestUtils testUtils = new TestUtils();
                    testUtils.ExecuteCommand(menuItemCmd);
                }
                finally
                {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
Пример #6
0
        public void LaunchCommand()
        {
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
            {
                CommandID menuItemCmd = new CommandID(MarkRendle.CoffeeScriptLanguageService.GuidList.guidCoffeeScriptLanguageServiceCmdSet, (int)MarkRendle.CoffeeScriptLanguageService.PkgCmdIDList.cmdInsertSnippet);

                // Create the DialogBoxListener Thread.
                string expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "CoffeeScriptLanguageService", "MarkRendle.CoffeeScriptLanguageService.CoffeeScriptLanguageServicePackage");
                DialogBoxPurger purger = new DialogBoxPurger(NativeMethods.IDOK, expectedDialogBoxText);

                try
                {
                    purger.Start();

                    TestUtils testUtils = new TestUtils();
                    testUtils.ExecuteCommand(menuItemCmd);
                }
                finally
                {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
Пример #7
0
        public void LaunchCommand()
        {
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
            {
                CommandID menuItemCmd = new CommandID(MicrosoftCorporation.SlowCheetah.GuidList.guidSlowCheetahCmdSet, (int)MicrosoftCorporation.SlowCheetah.PkgCmdIDList.cmdidAddTransform);

                // Create the DialogBoxListener Thread.
                string expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "SlowCheetah", "MicrosoftCorporation.SlowCheetah.SlowCheetahPackage");
                DialogBoxPurger purger = new DialogBoxPurger(NativeMethods.IDOK, expectedDialogBoxText);

                try
                {
                    purger.Start();

                    TestUtils testUtils = new TestUtils();
                    testUtils.ExecuteCommand(menuItemCmd);
                }
                finally
                {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
Пример #8
0
        public void LaunchCommand()
        {
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
            {
                CommandID menuItemCmd = new CommandID(Savant.GuidList.guidSavantPackageCmdSet, (int)Savant.PkgCmdIDList.generateDataAdaptersCommand);

                // Create the DialogBoxListener Thread.
                string expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "Savant", "ZeitgeistMediaLLC.SavantPackage.SavantPackage");
                DialogBoxPurger purger = new DialogBoxPurger(NativeMethods.IDOK, expectedDialogBoxText);

                try
                {
                    purger.Start();

                    TestUtils testUtils = new TestUtils();
                    testUtils.ExecuteCommand(menuItemCmd);
                }
                finally
                {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
        public void LaunchCommand()
        {
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
            {
                CommandID menuItemCmd = new CommandID(Archana.Personified_Sassify.GuidList.guidPersonified_SassifyCmdSet, (int)Archana.Personified_Sassify.PkgCmdIDList.cmdidSassify);

                // Create the DialogBoxListener Thread.
                string expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "Personified Sassify", "Archana.Personified_Sassify.Personified_SassifyPackage");
                DialogBoxPurger purger = new DialogBoxPurger(NativeMethods.IDOK, expectedDialogBoxText);

                try
                {
                    purger.Start();

                    TestUtils testUtils = new TestUtils();
                    testUtils.ExecuteCommand(menuItemCmd);
                }
                finally
                {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
Пример #10
0
        public void LaunchCommand()
        {
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
            {
                CommandID menuItemCmd = new CommandID(Hill30.BooProject.Constants.GuidBooProjectCmdSet, (int)PkgCmdIDList.cmdidBooISh);

                // Create the DialogBoxListener Thread.
                string expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "BooProject", "Hill30.BooProject.BooProjectPackage");
                DialogBoxPurger purger = new DialogBoxPurger(NativeMethods.IDOK, expectedDialogBoxText);

                try
                {
                    purger.Start();

                    TestUtils testUtils = new TestUtils();
                    testUtils.ExecuteCommand(menuItemCmd);
                }
                finally
                {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
Пример #11
0
        public void LaunchCommand()
        {
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
            {
                CommandID menuItemCmd = new CommandID(ServiceStackVS.GuidList.guidVSServiceStackCmdSet, (int)ServiceStackVS.PkgCmdIDList.cmdidCSharpAddServiceStackReference);

                // Create the DialogBoxListener Thread.
                string expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "ServiceStackVS", "ServiceStack.ServiceStackVS.ServiceStackVSPackage");
                DialogBoxPurger purger = new DialogBoxPurger(NativeMethods.IDOK, expectedDialogBoxText);

                try
                {
                    purger.Start();

                    TestUtils testUtils = new TestUtils();
                    testUtils.ExecuteCommand(menuItemCmd);
                }
                finally
                {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
        public void LaunchCommand()
        {
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
            {
                CommandID menuItemCmd = new CommandID(ITEONplLeszekSzpunar.Iteon_CreateRealFolderVSPackage.GuidList.guidIteon_CreateRealFolderVSPackageCmdSet, (int)ITEONplLeszekSzpunar.Iteon_CreateRealFolderVSPackage.PkgCmdIDList.CreateRealFolderCmd);

                // Create the DialogBoxListener Thread.
                string expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "Iteon.CreateRealFolderVSPackage", "ITEONplLeszekSzpunar.Iteon_CreateRealFolderVSPackage.Iteon_CreateRealFolderVSPackagePackage");
                DialogBoxPurger purger = new DialogBoxPurger(NativeMethods.IDOK, expectedDialogBoxText);

                try
                {
                    purger.Start();

                    TestUtils testUtils = new TestUtils();
                    testUtils.ExecuteCommand(menuItemCmd);
                }
                finally
                {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
Пример #13
0
        public void LaunchCommand()
        {
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
            {
                CommandID menuItemCmd = new CommandID(PeterWibeck.ScrumyVSPlugin.GuidList.guidScrumyVSPluginCmdSet, (int)PeterWibeck.ScrumyVSPlugin.PkgCmdIDList.cmdScrumySettings);

                // Create the DialogBoxListener Thread.
                string expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "ScrumyVSPlugin", "PeterWibeck.ScrumyVSPlugin.ScrumyVSPluginPackage");
                DialogBoxPurger purger = new DialogBoxPurger(NativeMethods.IDOK, expectedDialogBoxText);

                try
                {
                    purger.Start();

                    TestUtils testUtils = new TestUtils();
                    testUtils.ExecuteCommand(menuItemCmd);
                }
                finally
                {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
Пример #14
0
        public void LaunchCommand()
        {
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
            {
                CommandID menuItemCmd = new CommandID(DivyaSinghal.StrutViewer.GuidList.guidStrutViewerCmdSet, (int)DivyaSinghal.StrutViewer.PkgCmdIDList.StrutViewerToolCommand);

                // Create the DialogBoxListener Thread.
                string expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "StrutViewer", "DivyaSinghal.StrutViewer.StrutViewerPackage");
                DialogBoxPurger purger = new DialogBoxPurger(NativeMethods.IDOK, expectedDialogBoxText);

                try
                {
                    purger.Start();

                    TestUtils testUtils = new TestUtils();
                    testUtils.ExecuteCommand(menuItemCmd);
                }
                finally
                {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
Пример #15
0
        public void LaunchCommand()
        {
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
            {
                CommandID menuItemCmd = new CommandID(JosePedroSilva.TFSScrumExtensions.GuidList.guidTFSScrumExtensionsCmdSet, (int)JosePedroSilva.TFSScrumExtensions.PkgCmdIDList.cmdPlanWorkItem);

                // Create the DialogBoxListener Thread.
                string expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "TFSScrumExtensions", "JosePedroSilva.TFSScrumExtensions.TFSScrumExtensionsPackage");
                DialogBoxPurger purger = new DialogBoxPurger(NativeMethods.IDOK, expectedDialogBoxText);

                try
                {
                    purger.Start();

                    TestUtils testUtils = new TestUtils();
                    testUtils.ExecuteCommand(menuItemCmd);
                }
                finally
                {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
        public void VSExtension_LaunchCommand()
        {
            UIThreadInvoker.Invoke((ThreadInvoker)delegate
            {
                CommandID menuItemCmd = new CommandID(Microsoft.ALMRangers.BranchTool.VSExtension.GuidList.GuidTfsBranchToolVSExtensionCmdSet, (int)Microsoft.ALMRangers.BranchTool.VSExtension.PkgCmdIDList.CmdidAlmRangersBranchingTooling);

                // Create the DialogBoxListener Thread.
                string expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "TfsBranchToolVSExtension", "Microsoft.ALMRangers.BranchTool.VSExtension.TfsBranchToolVSExtensionPackage");
                DialogBoxPurger purger = new DialogBoxPurger(NativeMethods.IDOK, expectedDialogBoxText);

                try
                {
                    purger.Start();

                    TestUtils testUtils = new TestUtils();
                    testUtils.ExecuteCommand(menuItemCmd);
                }
                finally
                {
                    // Assert.IsTrue(true, "The command executed");
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }
Пример #17
0
        public void LaunchCommand()
        {
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
            {
                CommandID menuItemCmd = new CommandID(AnkhId.CommandSetGuid, (int)AnkhCommand.Checkout);

                // Create the DialogBoxListener Thread.
                string expectedDialogBoxText = string.Format(CultureInfo.CurrentCulture, "{0}\n\nInside {1}.MenuItemCallback()", "AnkhSvn", "AnkhSvn.AnkhSvn.AnkhSvnPackage");
                DialogBoxPurger purger = new DialogBoxPurger(NativeMethods.IDCANCEL, expectedDialogBoxText);

                try
                {
                    purger.Start();

                    TestUtils testUtils = new TestUtils();
                    testUtils.ExecuteCommand(menuItemCmd);
                }
                finally
                {
                    Assert.IsTrue(purger.WaitForDialogThreadToTerminate(), "The dialog box has not shown");
                }
            });
        }