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(); } }
public HomeViewModel(IImageManager imageManager, IShellViewModel shellViewModel, XMLRepository xmlRepository) { _shellViewModel = shellViewModel; TestList = new SortableBindableCollection <SingleTest>(); SelectedTest = new ObservableValue <SingleTest> { Changed = _ => { TestProperties4Debug.Clear(); } }; TestProperties4Debug = new BindableCollection <ResourcePropertyModel>(); SortSettings = new SortSettings("TestCell", ListSortDirection.Ascending); SortSettings.Changed += (sender, args) => this.Sort(TestList); ColumnNameToSortKey = new Dictionary <string, Func <SingleTest, IComparable> > { }; ColumnNameToSortKey.Add("TestCell", i => i.TestCell); ColumnNameToSortKey.Add("TestID", i => i.TestIDNumber); ColumnNameToSortKey.Add("VehicleID", i => i.VehicleID); ColumnNameToSortKey.Add("ProjectID", i => i.ProjectID); ColumnNameToSortKey.Add("TestTypeCode", i => i.TestTypeCode); ColumnNameToSortKey.Add("Priority", i => i.Priority); ColumnNameToSortKey.Add("ModificationDate", i => i.ModificationDate); GetTestListCommand = new GetTestListCommand(imageManager, TestList, xmlRepository); ShowTestPropertiesCommand = new ShowTestPropertiesCommand(imageManager, SelectedTest, TestProperties4Debug, xmlRepository); RunTestCommand = new RunTestCommand(imageManager, SelectedTest, ShowTestPropertiesCommand, xmlRepository); SaveAsNewResourcesCommand = new SaveAsNewResourcesCommand(imageManager, SelectedTest, this, ShowTestPropertiesCommand, xmlRepository); ControlSaveAsCommand = new ControlSaveAsCommand(imageManager, SelectedTest, this); var imagePathPattern = "/STARS.Applications.VETS.Plugins.VTS.UI;component/Images/{0}.png"; DisplayInfo = new ExplorerDisplayInfo { Description = Resources.VtsVets, Image16 = string.Format(imagePathPattern, "green_car_16"), Image32 = string.Format(imagePathPattern, "green_car_32"), ExplorerImage16 = string.Format(imagePathPattern, "white_car_16"), }; DisplayName = Resources.VtsVets; OnTestFinish.TestFinished += OnTestFinished; }
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; }