コード例 #1
0
        public TestExplorerViewModel(IEditorContext editorContext, ITestProvider testProvider, ITestRunner testRunner, IResultProvider resultProvider, ICoverageProvider coverageProvider, IOptions options, SelectTestCommand selectTestCommand, JumpToTestCommand jumpToTestCommand, DebugTestCommand debugTestCommand)
        {
            SearchViewModel = new CodeItemSearchViewModel <TestItemViewModel, TestItem>();
            StateGroups     = new ObservableCollection <TestStateGroupViewModel>();

            _editorContext  = editorContext;
            _testProvider   = testProvider;
            _testRunner     = testRunner;
            _resultProvider = resultProvider;
            _options        = options;

            _editorContext.SolutionOpened  += OnSolutionOpened;
            _editorContext.SolutionClosing += OnSolutionClosing;
            _editorContext.BuildStarted    += OnBuildStarted;
            _editorContext.BuildFinished   += OnBuildFinished;

            _testProvider.ScanningStarted  += OnScanningStarted;
            _testProvider.ScanningFinished += OnScanningFinished;

            _testRunner.DebuggingStarted += OnDebuggingStarted;
            _testRunner.TestsStarted     += OnTestsStarted;
            _testRunner.TestStarted      += OnTestStarted;
            _testRunner.TestExecuted     += OnTestExecuted;
            _testRunner.TestLogAdded     += OnTestLogAdded;
            _testRunner.TestsFinished    += OnTestsFinished;
            _testRunner.TestsFailed      += OnTestsFailed;
            _testRunner.TestsAborted     += OnTestsAborted;

            _options.PropertyChanged += OnOptionChanged;

            selectTestCommand.CommandCalled += OnSelectTest;
            jumpToTestCommand.CommandCalled += OnJumpToTest;
            debugTestCommand.CommandCalled  += OnDebugTest;
        }
コード例 #2
0
        public SettingsViewModel(IEditorContext editorContext, IStorageController storageController, ITestRunner testRunner, ITelemetryManager telemetryManager, IOptions options, IIoProvider ioProvider)
        {
            _editorContext     = editorContext;
            _storageController = storageController;
            _testRunner        = testRunner;
            _options           = options;
            _ioProvider        = ioProvider;

            _outputDirectories = new ObservableEnumeration <OutputDirectoryViewModel>(() =>
                                                                                      storageController.GetOutputDirectories().Select(p => new OutputDirectoryViewModel(p)), (a, b) => StringComparer.OrdinalIgnoreCase.Compare(a.Name, b.Name));
            _testSettingsFiles = new ObservableEnumeration <string>(() =>
                                                                    (_editorContext?.Solution.FindFiles(new Regex("^.*\\.runSettings$", RegexOptions.Compiled | RegexOptions.IgnoreCase)) ?? new string[0])
                                                                    .Select(p => _ioProvider.GetRelativePath(p)),
                                                                    StringComparer.OrdinalIgnoreCase.Compare);

            editorContext.BuildFinished  += (o, e) => Refresh();
            editorContext.SolutionOpened += (o, e) => Refresh();

            //Fix unsupported state
            if (_options.IsExcludingTestAssemblies && _options.IsCoveringByTest)
            {
                _options.IsExcludingTestAssemblies = false;
                _options.IsCoveringByTest          = false;
            }
        }
コード例 #3
0
        public TestExplorerViewModel(
            IEditorContext editorContext,
            ITestProvider testProvider,
            ITestRunner testRunner,
            IResultProvider resultProvider,
            ICoverageProvider coverageProvider,
            IOptions options,
            SelectTestCommand selectTestCommand,
            JumpToTestCommand jumpToTestCommand,
            RunTestCommand runTestCommand,
            CoverTestCommand coverTestCommand,
            DebugTestCommand debugTestCommand)
        {
            PassedStateGroup       = new TestStateGroupViewModel(TestState.Passed);
            InconclusiveStateGroup = new TestStateGroupViewModel(TestState.Inconclusive);
            FailedStateGroup       = new TestStateGroupViewModel(TestState.Failed);
            _stateGroups           = new Dictionary <TestState, TestStateGroupViewModel>()
            {
                { TestState.Passed, PassedStateGroup },
                { TestState.Inconclusive, InconclusiveStateGroup },
                { TestState.Failed, FailedStateGroup }
            };
            SearchViewModel = new CodeItemSearchViewModel <TestItemViewModel, TestItem>();

            _editorContext  = editorContext;
            _testProvider   = testProvider;
            _testRunner     = testRunner;
            _resultProvider = resultProvider;
            _options        = options;

            _editorContext.SolutionOpened  += OnSolutionOpened;
            _editorContext.SolutionClosing += OnSolutionClosing;
            _editorContext.BuildStarted    += OnBuildStarted;
            _editorContext.BuildFinished   += OnBuildFinished;

            _testProvider.ScanningStarted  += OnScanningStarted;
            _testProvider.ScanningFinished += OnScanningFinished;

            _testRunner.DebuggingStarted += OnDebuggingStarted;
            _testRunner.TestsStarted     += OnTestsStarted;
            _testRunner.TestStarted      += OnTestStarted;
            _testRunner.TestExecuted     += OnTestExecuted;
            _testRunner.TestLogAdded     += OnTestLogAdded;
            _testRunner.TestsFinished    += OnTestsFinished;
            _testRunner.TestsFailed      += OnTestsFailed;
            _testRunner.TestsAborted     += OnTestsAborted;

            _options.PropertyChanged += OnOptionChanged;

            selectTestCommand.CommandCalled += OnSelectTest;
            jumpToTestCommand.CommandCalled += OnJumpToTest;
            runTestCommand.CommandCalled    += OnRunTest;
            coverTestCommand.CommandCalled  += OnCoverTest;
            debugTestCommand.CommandCalled  += OnDebugTest;

            if (_editorContext.Solution.IsOpen)
            {
                LoadSolution();
            }
        }
コード例 #4
0
ファイル: TestProvider.cs プロジェクト: maosierra/AxoTools
 public TestProvider(IEditorContext editorContext, ITestAdapterRepository testAdapterRepository, IOptions options, ITelemetryManager telemetryManager)
 {
     _editorContext         = editorContext;
     _testAdapterRepository = testAdapterRepository;
     _options          = options;
     _telemetryManager = telemetryManager;
 }
コード例 #5
0
        public ReleaseManagerViewModel(IReleaseManager releaseManager, IEditorContext editorContext)
        {
            _releaseManager = releaseManager;
            _editorContext  = editorContext;
            Settings.Default.PropertyChanged += (o, e) => NotifyPropertyChanged(e.PropertyName);

            Refresh(checkForUpdates: true);
        }
コード例 #6
0
        public Options(IEditorContext editorContext, IStorageController storageController)
        {
            Settings.Default.SettingChanging += OnSettingChanging;
            _editorContext     = editorContext;
            _storageController = storageController;

            editorContext.SolutionOpened += OnSolutionOpened;
        }
コード例 #7
0
        public TelemetryManager(IEditorContext editorContext, IOptions options)
        {
            _editorContext = editorContext;
            _options       = options;

            Application.Current.DispatcherUnhandledException += OnDispatcherUnhandledException;
            AppDomain.CurrentDomain.UnhandledException       += OnUnhandledException;
        }
コード例 #8
0
ファイル: Options.cs プロジェクト: maosierra/AxoTools
        public Options(IEditorContext editorContext, IStorageController storageController)
        {
            Settings.Default.SettingChanging += (o, e) => Application.Current.Dispatcher.BeginInvoke(() => OnSettingChanged(e.SettingName));
            _editorContext     = editorContext;
            _storageController = storageController;

            editorContext.SolutionOpened += OnSolutionOpened;
        }
コード例 #9
0
 public AxoTestRunner(IEditorContext editorContext, IStorageController storageController, IOptions options, ITelemetryManager telemetryManager, ITestAdapterRepository testAdapterRepository)
 {
     _editorContext         = editorContext;
     _storageController     = storageController;
     _options               = options;
     _telemetryManager      = telemetryManager;
     _testAdapterRepository = testAdapterRepository;
 }
コード例 #10
0
        public CoverageProvider(ITestProvider testProvider, ITestRunner testRunner, ITelemetryManager telemetryManager, IEditorContext editorContext)
        {
            _testRunner                = testRunner;
            _telemetryManager          = telemetryManager;
            _testRunner.TestsFinished += OnTestsFinished;
            _editorContext             = editorContext;

            _editorContext.SolutionClosing += OnSolutionClosing;
        }
コード例 #11
0
        public CoverageExplorerViewModel(ICoverageProvider coverageProvider, IEditorContext editorContext, ITestRunner testRunner)
        {
            _coverageProvider = coverageProvider;
            _editorContext    = editorContext;
            _testRunner       = testRunner;

            SearchViewModel = new CodeItemSearchViewModel <CoverageItemViewModel, CoverageItem>();

            _coverageProvider.CoverageUpdated += OnCoverageUpdated;
            _editorContext.SolutionClosing    += OnSolutionClosing;
            _testRunner.TestsFinished         += OnTestsFinished;
        }
コード例 #12
0
        static public void GetStrategyFromName2(this TextEditor editor, IEditorContext control)
        {
            FoldingManager.Uninstall(control.FoldingManager);
            AbstractFoldingStrategy NewFoldingStrategy     = null;
            IIndentationStrategy    NewIndentationStrategy = null;

            if (editor.SyntaxHighlighting == null)
            {
            }                                                    //control.FoldingStrategy = null;
            else
            {
                switch (editor.SyntaxHighlighting.Name)
                {
                case "XML":
                    NewFoldingStrategy     = new XmlFoldingStrategy();
                    NewIndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy();
                    break;

                case "C#":
                case "C++":
                case "PHP":
                case "Java":
                    NewFoldingStrategy     = new CSharpPragmaRegionFoldingStrategy();
                    NewIndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.CSharp.CSharpIndentationStrategy();
                    break;

                default:
                    NewFoldingStrategy     = new CSharpPragmaRegionFoldingStrategy();
                    NewIndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy();
                    break;
                }
            }
            //control.FoldingStrategy is not assigned
            //control.FoldingStrategy,editor.TextArea.IndentationStrategy
            if (NewFoldingStrategy != null)
            {
                control.FoldingStrategy = NewFoldingStrategy;
                if (control.FoldingManager == null)
                {
                    control.FoldingManager = FoldingManager.Install(editor.TextArea);
                }

                control.FoldingStrategy.UpdateFoldings(control.FoldingManager, editor.Document);
            }
            else
            {
                if (control.FoldingManager != null)
                {
                    FoldingManager.Uninstall(control.FoldingManager);
                    control.FoldingManager = null;
                }
            }
        }
コード例 #13
0
        public HockeyClient(IEditorContext editorContext, IOptions options)
            : base(editorContext, options)
        {
            var installationId = options.InstallationId;

            if (installationId == Guid.Empty)
            {
                installationId         = Guid.NewGuid();
                options.InstallationId = installationId;
            }

            AppId          = options.TelemetryKey;
            PackageName    = AxoCoverPackage.Manifest.Name;
            Version        = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            InstallationId = installationId;
            Model          = editorContext.Version;

            _httpClient = new HttpClient();
            _httpClient.DefaultRequestHeaders.Add("User-Agent", "Hockey/WinWPF");

            _uriPrefix = $"https://rink.hockeyapp.net/api/2/apps/{AppId}/";
            _httpClient.BaseAddress = new Uri(_uriPrefix);
        }
コード例 #14
0
 public TestDetailsViewModel(IEditorContext editorContext, DebugTestCommand debugTestCommand)
 {
     _editorContext    = editorContext;
     _debugTestCommand = debugTestCommand;
 }
コード例 #15
0
 public CoverageDetailsViewModel(IEditorContext editorContext)
 {
     _editorContext = editorContext;
 }
コード例 #16
0
 public ReleaseManager(IEditorContext editorContext, ITelemetryManager telemetryManager)
 {
     _editorContext    = editorContext;
     _telemetryManager = telemetryManager;
     Task.Run(Initialize);
 }
コード例 #17
0
 public StorageController(IEditorContext editorContext)
 {
     _editorContext = editorContext;
 }
コード例 #18
0
 public MsTest2Adapter(IEditorContext editorContext)
 {
     _assemblyPath         = Path.Combine(AxoCoverPackage.PackageRoot, @"MSTestAdapter\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll");
     _redirectedAssemblies = Directory.GetFiles(Path.GetDirectoryName(_assemblyPath), "*.dll");
 }
コード例 #19
0
 public xUnitAdapter(IEditorContext editorContext)
 {
     _assemblyPath         = Path.Combine(AxoCoverPackage.PackageRoot, @"xUnitAdapter\xunit.runner.visualstudio.testadapter.dll");
     _redirectedAssemblies = Directory.GetFiles(Path.GetDirectoryName(_assemblyPath), "*.dll");
 }
コード例 #20
0
ファイル: MsTest1Adapter.cs プロジェクト: maosierra/AxoTools
 public MsTest1Adapter(IEditorContext editorContext)
 {
     _assemblyPath = Path.Combine(editorContext.RootPath, @"CommonExtensions\Microsoft\TestWindow\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll");
 }
コード例 #21
0
        public LineCoverageAdornment(
            IWpfTextView textView,
            ITextDocumentFactoryService documentFactory,
            ICoverageProvider coverageProvider,
            IResultProvider resultProvider,
            IEditorContext editorContext,
            IOptions options,
            SelectTestCommand selectTestCommand,
            JumpToTestCommand jumpToTestCommand,
            RunTestCommand runTestCommand,
            CoverTestCommand coverTestCommand,
            DebugTestCommand debugTestCommand)
        {
            if (textView == null)
            {
                throw new ArgumentNullException(nameof(textView));
            }

            _editorContext              = editorContext;
            _options                    = options;
            _selectedBrushAndPen        = new BrushAndPenContainer(_options.SelectedColor, _branchCoverageSpotBorderThickness);
            _coveredBrushAndPen         = new BrushAndPenContainer(_options.CoveredColor, _branchCoverageSpotBorderThickness);
            _mixedBrushAndPen           = new BrushAndPenContainer(_options.MixedColor, _branchCoverageSpotBorderThickness);
            _uncoveredBrushAndPen       = new BrushAndPenContainer(_options.UncoveredColor, _branchCoverageSpotBorderThickness);
            _exceptionOriginBrushAndPen = new BrushAndPenContainer(_options.ExceptionOriginColor, _branchCoverageSpotBorderThickness);
            _exceptionTraceBrushAndPen  = new BrushAndPenContainer(_options.ExceptionTraceColor, _branchCoverageSpotBorderThickness);

            _brushesAndPens = new Dictionary <CoverageState, BrushAndPenContainer>()
            {
                { CoverageState.Unknown, new BrushAndPenContainer(Colors.Transparent, _branchCoverageSpotBorderThickness) },
                { CoverageState.Uncovered, _uncoveredBrushAndPen },
                { CoverageState.Mixed, _mixedBrushAndPen },
                { CoverageState.Covered, _coveredBrushAndPen }
            };

            _documentFactory              = documentFactory;
            _textView                     = textView;
            _textView.TextBuffer.Changed += OnTextBufferChanged;
            _editorContext.BuildFinished += OnBuildFinished;

            _coverageProvider = coverageProvider;
            _resultProvider   = resultProvider;

            _selectTestCommand = selectTestCommand;
            _jumpToTestCommand = jumpToTestCommand;

            _runTestCommand   = runTestCommand;
            _coverTestCommand = coverTestCommand;
            _debugTestCommand = debugTestCommand;

            _adornmentLayer = _textView.GetAdornmentLayer(TextViewCreationListener.CoverageAdornmentLayerName);
            TryInitilaizeDocument();

            _textView.LayoutChanged += OnLayoutChanged;

            _coverageProvider.CoverageUpdated += OnCoverageUpdated;
            _resultProvider.ResultsUpdated    += OnResultsUpdated;
            UpdateAnchors();
            UpdateCoverage();
            UpdateResults();

            _options.PropertyChanged += OnOptionsPropertyChanged;
            _isHighlightingChanged   += UpdateAllLines;
            _testSolutionChanged     += UpdateAnchors;

            _textView.Closed += OnClosed;
        }