Example #1
0
        public int ExecMarkerCommand(IVsTextMarker pMarker, int iItem)
        {
            var      tester   = new GTestRunner();
            TestList testList = TestPackage.GetTestList();

            tester.OnTestsUpdated += testList.UpdateTestResult;
            switch (iItem)
            {
            case (int)MarkerCommandValues2.mcvRightClickCommand:
                IVsUIShell uiShell = (IVsUIShell)TestPackage.GetGlobalService(typeof(SVsUIShell));
                Guid       context = GuidList.GUIDTestMarkerCmdSet;
                POINTS[]   menuPos = new POINTS[1];
                menuPos[0].x = (short)Cursor.Position.X;
                menuPos[0].y = (short)Cursor.Position.Y;
                var hr = uiShell.ShowContextMenu(0, ref context, (int)PkgCmdIDList.ContextMenu, menuPos, this as IOleCommandTarget);
                if (hr != VSConstants.S_OK)
                {
                    return(VSConstants.S_FALSE);
                }
                break;

            case (int)PkgCmdIDList.cmdRunTest:
                tester.RunTests(_projectMarkerBelongsTo, _testName, false);
                break;

            case (int)PkgCmdIDList.cmdDebugTest:
                tester.RunTests(_projectMarkerBelongsTo, _testName, true);
                break;

            default:

                return(VSConstants.S_FALSE);
            }
            return(VSConstants.S_OK);
        }
Example #2
0
        public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            var      tester   = new GTestRunner();
            TestList testList = TestPackage.GetTestList();

            tester.OnTestsUpdated += testList.UpdateTestResult;
            try
            {
                switch (nCmdID)
                {
                case PkgCmdIDList.cmdRunTest:
                    tester.RunTests(_projectMarkerBelongsTo, _testName, false);
                    break;

                case PkgCmdIDList.cmdDebugTest:
                    tester.RunTests(_projectMarkerBelongsTo, _testName, true);
                    break;
                }
            }
            catch (TestRunnerException ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK);
            }
            return(VSConstants.S_OK);
        }