Beispiel #1
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();
            }
        }
Beispiel #2
0
        public LineCoverageAdornment(
            IWpfTextView textView,
            ITextDocumentFactoryService documentFactory,
            ICoverageProvider coverageProvider,
            IResultProvider resultProvider,
            IOptions options,
            SelectTestCommand selectTestCommand,
            JumpToTestCommand jumpToTestCommand,
            DebugTestCommand debugTestCommand)
        {
            if (textView == null)
            {
                throw new ArgumentNullException(nameof(textView));
            }

            _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;

            _coverageProvider = coverageProvider;
            _resultProvider   = resultProvider;

            _selectTestCommand = selectTestCommand;
            _jumpToTestCommand = jumpToTestCommand;
            _debugTestCommand  = debugTestCommand;

            TryInitilaizeFilePath();

            _adornmentLayer          = _textView.GetAdornmentLayer(TextViewCreationListener.CoverageAdornmentLayerName);
            _textView.LayoutChanged += OnLayoutChanged;

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

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

            _textView.Closed += OnClosed;
        }
        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;
        }
 public static void Setup(ILoggingService loggingService, ICoverageProvider provider, ICoverageResultsParser parser)
 {
     CoverageExtension.loggingService = loggingService;
     Repository = new CoverageResultsRepository(parser);
     CoverageExtension.provider = provider;
 }
 public CoverageService(ICoverageProvider provider, ICoverageResultsRepository repository)
 {
     this.provider   = provider;
     this.repository = repository;
     UnitTestService.TestSessionStarting += UnitTestService_TestSessionStarting;
 }
Beispiel #6
0
 public LoggedCoverageService(ICoverageProvider provider, ICoverageResultsRepository repository, ILoggingService loggingService) : base(provider, repository)
 {
     this.loggingService = loggingService;
 }
        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;
        }
Beispiel #8
0
 internal CoveragePadPresenter(ICoveragePad pad, ILoggingService log, ICoverageResultsRepository repository, ICoverageProvider provider)
 {
     this.pad           = pad;
     this.log           = log;
     this.repository    = repository;
     testProjectService = new TestProjectService();
     testProjectService.TestProjectsChanged += RefreshTestProjects;
     coverageService = new LoggedCoverageService(provider, repository, log);
 }
Beispiel #9
0
 public LoggedCoverageService(ICoverageProvider provider, ICoverageResultsRepository repository) : base(provider, repository)
 {
 }