Exemplo n.º 1
0
        private void initializeCommands()
        {
            _buildRunner = new VSBuildRunner(_applicationObject, () => { return !_engine.IsRunning; }, (s) => { _engine.SetCustomOutputPath(s); }, (o) => _control.Consume(o), (s) => _control.ClearBuilds(s));
            _dispatchers.RegisterHandler(new ShowFeedbackWindow(_applicationObject, _addInInstance, showFeedbackWindow));
            // RestartEngine
            _dispatchers.RegisterHandler(
                new GenericCommand(
                    "AutoTest.VSAddin.Connect.AutoTestNet_RestartEngine",
                    () => { return Directory.Exists(getWatchDirectory()); },
                    () =>
                    {
                        onSolutionClosingFinished();
                        System.Threading.Thread.Sleep(500);
                        onSolutionOpened();
                    }));

            // ResumeEngine
            _dispatchers.RegisterHandler(new GenericCommand(
                        "AutoTest.VSAddin.Connect.AutoTestNet_ResumeEngine",
                        () => { return !_engine.IsRunning; },
                        () => _engine.Resume()));

            // PauseEngine 
            _dispatchers.RegisterHandler(new GenericCommand(
                        "AutoTest.VSAddin.Connect.AutoTestNet_PauseEngine",
                        () => { return _engine.IsRunning; },
                        () => _engine.Pause()));

            // BuildAndTestAll    
            _dispatchers.RegisterHandler(new GenericCommand(
                        "AutoTest.VSAddin.Connect.AutoTestNet_BuildAndTestAll",
                        () => { return _engine.IsRunning; },
                        () => _engine.BuildAndTestAll()));

            _dispatchers.RegisterHandler(new OpenConfiguration("AutoTest.VSAddin.Connect.AutoTestNet_ConfigGlobal", () => { return getUsrLocalPath(); }, (s) => { return s; }));
            _dispatchers.RegisterHandler(new OpenConfiguration("AutoTest.VSAddin.Connect.AutoTestNet_ConfigLocal", () => { return getWatchDirectory(); }, (s) => { return new PathTranslator(_WatchToken).Translate(s); }));

            _dispatchers.RegisterHandler(new RunTestsUnderCursor("AutoTest.VSAddin.Connect.AutoTestNet_RunTestsUnderCursor",
                () => { return isEnabled(); }, () => { return buildManually(); }, (run) => { _engine.RunTests(run, _onCompletedOnDemandRun); }, _applicationObject, _buildRunner,
                (run) => _engine.SetLastTestRun(new[] { run })));
            _dispatchers.RegisterHandler(new RerunLastManualTestRun("AutoTest.VSAddin.Connect.AutoTestNet_RerunLastManualTestRun",
                () => { return isEnabled() && _engine.LastTestRun != null; }, () => { return buildManually(); }, () => { _engine.RerunLastTestRun(_onCompletedOnDemandRun); }, _applicationObject, _buildRunner,
                () => { return _engine.LastTestRun; }));
            _dispatchers.RegisterHandler(new DebugCurrentTest("AutoTest.VSAddin.Connect.AutoTestNet_DebugTestUnderCursor",
                () => { return true; }, () => { return buildManually(); }, (s) => { return _engine.GetAssemblyFromProject(s); }, (test) => _engine.DebugTest(test), _applicationObject, _buildRunner,
                (test) => _engine.SetLastDebugSession(test)));
            _dispatchers.RegisterHandler(new RerunLastDebugSession("AutoTest.VSAddin.Connect.AutoTestNet_RerunLastDebugSession",
                () => { return _engine.LastDebugSession != null; }, () => { return buildManually(); }, () => _engine.RerunLastDebugSession(), _applicationObject, _buildRunner));

            _dispatchers.RegisterHandler(new RunTestsForSolution("AutoTest.VSAddin.Connect.AutoTestNet_RunSolutionTests",
                () => { return isEnabled(); }, () => { return buildManually(); }, (runs) => { _engine.RunTests(runs, _onCompletedOnDemandRun); }, _applicationObject, _buildRunner,
                (runs) => _engine.SetLastTestRun(runs)));
            _dispatchers.RegisterHandler(new RunTestsForCodeModel("AutoTest.VSAddin.Connect.AutoTestNet_RunCodeModelTests",
                () => { return isEnabled(); }, () => { return buildManually(); }, (runs) => { _engine.RunTests(runs, _onCompletedOnDemandRun); }, _applicationObject, _buildRunner,
                (runs) => { return getBuildListGenerator().Generate(runs.Select(x => x.Project)); },
                (runs) => _engine.SetLastTestRun(runs)));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
            try
            {
                this.SetEngine();

                this.BindEvents();
                this.InitializeCommands();

                _buildRunner = new VSBuildRunner(_applicationObject, () => { return !_engine.IsRunning; }, (s) => _engine.SetCustomOutputPath(s), (o) => _control.Consume(o), (s) => _control.ClearBuilds(s));
            }
            catch (Exception exception)
            {
                Debug.WriteException(exception);
            }
        }
Exemplo n.º 3
0
       private void RegisterCommandHandlers()
       {
           _buildRunner = new VSBuildRunner(_applicationObject, () => { return !_client.IsRunning; }, (s) => Connect.SetCustomOutputpath(s), (o) => _control.IncomingMessage(o), (s) => _control.ClearBuilds(s));
           _dispatchers.RegisterHandler(new AutoTestVSConfigurationGlobal(_client));
           _dispatchers.RegisterHandler(new AutoTestVSConfigurationSolution(_client));
           _dispatchers.RegisterHandler(new AutoTestVSDetectRecursive(_client));
           _dispatchers.RegisterHandler(new AutoTestVSAbout(_client));
           _dispatchers.RegisterHandler(new AutoTestVSRunAll(_applicationObject, _client, _buildRunner));
           _dispatchers.RegisterHandler(new AutoTestVSClearTestCache(_client));
           _dispatchers.RegisterHandler(new AutoTestVSRunInformationToolbox(_applicationObject, _addInInstance));
           _dispatchers.RegisterHandler(new RunTestsUnderCursor("ContinuousTests.VS.Connect.ContinuousTests_RunUnderCursor", () => IsSolutionOpened, () => { return buildManually(); },
               run => _client.StartOnDemandRun(run), _applicationObject, _buildRunner, run => _client.SetLastRun(run)));
           _dispatchers.RegisterHandler(new AutoTestVSStart(_client));
           _dispatchers.RegisterHandler(new AutoTestVSStop(_client));
           _dispatchers.RegisterHandler(new GetAffectedCodeGraph(_client, _applicationObject));
           _dispatchers.RegisterHandler(new GetProfiledCodeGraph(_client, _applicationObject));
           _dispatchers.RegisterHandler(new AutoTestVSGetLastGraph(_client));
           _dispatchers.RegisterHandler(new GetSequenceDiagram(_client, _applicationObject));
           _dispatchers.RegisterHandler(new DebugCurrentTest("ContinuousTests.VS.Connect.ContinuousTests_DebugCurrentTest", () => IsSolutionOpened, () => { return buildManually(); },
               GetAssembly, test => Debug(_applicationObject, test), _applicationObject, _buildRunner,
               test => LastDebugRun = test));
           _dispatchers.RegisterHandler(new RerunLastManualTestRun("ContinuousTests.VS.Connect.ContinuousTests_RunLastOnDemandRun", () => { return Connect.IsSolutionOpened && _client.HasLastOnDemandRun; }, () => { return buildManually(); },
               () => _client.RunLastOnDemandRun(), _applicationObject, _buildRunner,
               () => _client.LastOnDemandRun));
           _dispatchers.RegisterHandler(new RerunLastDebugSession("ContinuousTests.VS.Connect.ContinuousTests_RunLastDebug",
               () => IsSolutionOpened && LastDebugRun != null, buildManually,
               () => Debug(_applicationObject, LastDebugRun), _applicationObject, _buildRunner));
           _dispatchers.RegisterHandler(new RunRelatedTests(_client, _applicationObject, _buildRunner));
           _dispatchers.RegisterHandler(new RealtimeToggler(_client));
           _dispatchers.RegisterHandler(new LastTestsRanHandler(_applicationObject, _addInInstance));

           _dispatchers.RegisterHandler(new RunTestsForSolution("ContinuousTests.VS.Connect.ContinuousTests_RunForSolution",
               () => IsSolutionOpened, buildManually, tests => _client.StartOnDemandRun(tests), _applicationObject, _buildRunner,
               runs => _client.SetLastRun(runs)));
           _dispatchers.RegisterHandler(new RunTestsForCodeModel("ContinuousTests.VS.Connect.ContinuousTests_RunCodeModelTests",
               () => IsSolutionOpened, buildManually, (tests) => _client.StartOnDemandRun(tests), _applicationObject, _buildRunner,
               projects => _client.GetProjectBuildList(projects.Select(x => x.Project)), runs => _client.SetLastRun(runs)));
           _dispatchers.RegisterHandler(new GenericCommand("ContinuousTests.VS.Connect.ContinuousTests_ReportIssue", () => true, () => Browse.To("http://moose.uservoice.com")));
       }