Example #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();
            }
        }
        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;
        }
        protected virtual bool?GetConfirmationFromUIDialog()
        {
            IResultProvider dialog = this.UIDialogConstructor();

            if (dialog == null)
            {
                return(null);
            }
            INotificationResultCourier resultCourier = this.LordOfNotifications.DisplayNotification(dialog);
            NotificationResult         result        = resultCourier.GetResultWithWait();

            if (result.Code == ResultCode.OK || result.Code == ResultCode.Yes)
            {
                return(true);
            }
            if (result.Code == ResultCode.Close || result.Code == ResultCode.No)
            {
                return(false);
            }
            if (result.Code == ResultCode.PermanentlyClose)
            {
                this.ConfirmationSetting.Value = false;
            }
            return(null);
        }
Example #4
0
        public FileSearchResult(IResultProvider provider, FileInfo fileInfo)
        {
            _fileInfo = fileInfo;

            Provider = provider;
            ID = Hash.CreateFrom(_fileInfo.FullName);
            Title = fileInfo.GetNameWithoutExtension();
        }
Example #5
0
        public DirectorySearchResult(IResultProvider provider, DirectoryInfo directoryInfo)
        {
            _directoryInfo = directoryInfo;

            Provider = provider;
            ID = Hash.CreateFrom(_directoryInfo.FullName);
            Title = _directoryInfo.Name + "/";
        }
Example #6
0
        public StartMenuResult(IResultProvider provider, FileInfo file)
        {
            _file = file;

            ID = Hash.CreateFrom(file.FullName);
            Title = file.GetNameWithoutExtension();
            Description = file.Directory.FullName;
            Provider = provider;
        }
Example #7
0
        public ActionResult(IResultProvider provider, ActionItem actionItem)
        {
            ActionItem = actionItem;
            Provider = provider;

            ID = Hash.CreateFrom(provider.UniqueName, actionItem.Application, actionItem.Path);
            Title = ActionItem.Title;
            Description = actionItem.Path;
        }
Example #8
0
        public GeneratePasswordResult(IResultProvider provider, GeneratePasswordProviderPrefs prefs)
        {
            _preferences = prefs;

            ID = Hash.CreateFrom(provider.UniqueName);
            Title = "Generate Password";
            Description = "Generates a random password";
            Provider = provider;
        }
 public NotificationDisplayTask([NotNull] IResultProvider relatedSpecializedNotification, [NotNull] string originator)
 {
     Assert.ArgumentNotNull(relatedSpecializedNotification, "relatedSpecializedNotification");
     Assert.ArgumentNotNullOrEmpty(originator, "originator");
     this.RelatedSpecializedNotification = relatedSpecializedNotification;
     this.Originator       = originator;
     this.State            = new NotificationState();
     this.ResultWaitHandle = new ManualResetEvent(false);
 }
Example #10
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;
        }
Example #11
0
 public ResultController(
     ApplicationDbContext dbContext,
     IResultProvider DataProcessor,
     RoleManager <IdentityRole> roleManager,
     UserManager <ApplicationUser> userManager,
     IConfiguration configuration)
     : base(dbContext, roleManager, userManager, configuration)
 {
     dataProcessor = DataProcessor;
 }
        /// <summary>
        /// Creates the object representing the validation execution
        /// </summary>
        /// <param name="provider">result consumer object</param>
        public RuleExecuter(IResultProvider provider)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider", Resource.NullResultProvider);
            }

            this.resultProvider = provider;
            this.logger = null;
        }
Example #13
0
 public virtual INotificationResultCourier DisplayNotification(IResultProvider notificationBlank)
 {
     if (!this.RelatedPlantBox.IsEnabled || !this.RelatedPlantBox.RelatedPlantEx.IsEnabled)
     {
         return(new FakeNotificationResultCourier());
     }
     return(HatcherGuide <IUserNotificationsGate> .Instance.EnqueueToShow(
                notificationBlank,
                this.RelatedPlantBox.RelatedPlantEx.Plant.HumanSupportingName));
 }
        /// <summary>
        /// Creates the object representing the validation execution
        /// </summary>
        /// <param name="provider">result consumer object</param>
        public RuleExecuter(IResultProvider provider)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider", Resource.NullResultProvider);
            }

            this.resultProvider = provider;
            this.logger         = null;
        }
Example #15
0
 public virtual INotificationResultCourier DisplayNotification(IResultProvider notificationBlank)
 {
     if (!this.RelatedPlantBox.IsEnabled || !this.RelatedPlantBox.RelatedPlantEx.IsEnabled)
       {
     return new FakeNotificationResultCourier();
       }
       return HatcherGuide<IUserNotificationsGate>.Instance.EnqueueToShow(
     notificationBlank,
     this.RelatedPlantBox.RelatedPlantEx.Plant.HumanSupportingName);
 }
 public virtual INotificationResultCourier EnqueueToShow(IResultProvider notificationVM, string originator)
 {
     this.AssertInitialized();
       NotificationDisplayTask displayTask = this.GetDisplayTask(notificationVM, originator);
       if (!this.AddToDisplayQueue(displayTask))
       {
     displayTask.SetResult(new NotificationResult(ResultCode.Unspecified));
     displayTask.State = NotificationState.Aborted;
       }
       return new NotificationResultCourier(displayTask);
 }
 /// <summary>
 /// Create a facade view of interop validation engine for the current context
 /// </summary>
 /// <param name="context">the current request context object</param>
 /// <param name="resultProvider">consumer of validation results generated by interop rule engine</param>
 /// <param name="logger">logger object</param>
 /// <param name="ruleList">Pre-set rule list</param>
 public RuleEngineWrapper(ServiceContext context, IResultProvider resultProvider, ILogger logger, List <string> ruleList = null)
 {
     this.context        = context;
     this.resultConsumer = resultProvider;
     this.logger         = logger;
     this.rules          = this.context.GetRules().ToList();
     if (null != ruleList && ruleList.Count > 0)
     {
         this.rules = (from r in this.rules where ruleList.Contains(r.Name) select r).ToList();
     }
     this.categories = (from r in this.rules select r.Category).Distinct().ToList();
 }
 /// <summary>
 /// Create a facade view of interop validation engine for the current context 
 /// </summary>
 /// <param name="context">the current request context object</param>
 /// <param name="resultProvider">consumer of validation results generated by interop rule engine</param>
 /// <param name="logger">logger object</param>
 /// <param name="ruleList">Pre-set rule list</param>
 public RuleEngineWrapper(ServiceContext context, IResultProvider resultProvider, ILogger logger, List<string> ruleList = null)
 {
     this.context = context;
     this.resultConsumer = resultProvider;
     this.logger = logger;
     this.rules = this.context.GetRules().ToList();
     if (null != ruleList && ruleList.Count > 0)
     {
         this.rules = (from r in this.rules where ruleList.Contains(r.Name) select r).ToList();
     }
     this.categories = (from r in this.rules select r.Category).Distinct().ToList();
 }
Example #19
0
        public virtual INotificationResultCourier EnqueueToShow(IResultProvider notificationVM, string originator)
        {
            this.AssertInitialized();
            NotificationDisplayTask displayTask = this.GetDisplayTask(notificationVM, originator);

            if (!this.AddToDisplayQueue(displayTask))
            {
                displayTask.SetResult(new NotificationResult(ResultCode.Unspecified));
                displayTask.State = NotificationState.Aborted;
            }
            return(new NotificationResultCourier(displayTask));
        }
Example #20
0
 /// <summary>
 /// 初始化API上下文
 /// </summary>
 /// <param name="instance"> api实例类 </param>
 /// <param name="method"> api方法 </param>
 /// <param name="resultProvider"> 返回值提供程序 </param>
 /// <param name="session"> api回话信息 </param>
 /// <param name="logger"> 日志记录器 </param>
 public ApiCallContext(object instance, MethodInfo method, IResultProvider resultProvider, ISession session, ILogger logger)
 {
     _resultProvider = resultProvider ?? throw new ArgumentNullException(nameof(resultProvider));
     ApiInstance     = instance ?? throw new ArgumentNullException(nameof(instance));
     Method          = method;
     Session         = session;
     Parameters      = new NameDictionary();
     Properties      = new NameDictionary();
     Data            = new NameDictionary();
     ID = Guid.NewGuid().ToString("n");
     if (instance is ISupportSession s)
     {
         s.Session = session ?? throw ApiException.NotSupportedSession;
     }
 }
Example #21
0
        public NotificationWindowVM(
            [NotNull] PositionSize actualPositionAndSize,
            [NotNull] IResultProvider nestedNotificationVM,
            [NotNull] string originator)
        {
            Assert.ArgumentNotNull(actualPositionAndSize, "actualPositionAndSize");
            Assert.ArgumentNotNull(nestedNotificationVM, "nestedNotificationVM");
            Assert.ArgumentNotNullOrEmpty(originator, "originator");
            this.positionAndSize                      = actualPositionAndSize;
            this.positionAndSize.Changed             += this.PositionAndSizeOnChanged;
            this.NestedNotificationVM                 = nestedNotificationVM;
            this.NestedNotificationVM.ResultObtained += this.OnResultObtainedFromNestedNotification;
            this.isAlive = true;
            this.permanentCloseDescription = this.GetPermanentCloseDescription(originator);
            this.Result = new NotificationResult(ResultCode.Unspecified);

            this.CloseCommand          = new RelayCommand(this.OnCloseCommandExecute, true);
            this.PermanentCloseCommand = new RelayCommand(this.OnPermanentlyCloseExecute, true);
        }
 /// <summary>
 /// Creates a new instance of RuleExecuter from result provider and logger
 /// </summary>
 /// <param name="provider">Result provider to consume validation results.</param>
 /// <param name="logger">logger to log runtime data.</param>
 public RuleExecuter(IResultProvider provider, ILogger logger)
     : this(provider)
 {
     this.logger = logger;
 }
 /// <summary>
 /// Creates a new instance of RuleExecuter from result provider and logger
 /// </summary>
 /// <param name="provider">Result provider to consume validation results.</param>
 /// <param name="logger">logger to log runtime data.</param>
 public RuleExecuter(IResultProvider provider, ILogger logger)
     : this(provider)
 {
     this.logger = logger;
 }
Example #24
0
 protected virtual NotificationDisplayTask GetDisplayTask(IResultProvider notificationVM, string originator)
 {
     return(new NotificationDisplayTask(notificationVM, originator));
 }
Example #25
0
 internal ResultCache(IResultProvider obtainResult)
     : base(NextObjectId++)
 {
     Provider = obtainResult ?? NotSupported;
 }
 public ValuesController(IResultProvider result, ILogger <ValuesController> logger)
 {
     resultProvider = result;
     this.logger    = logger;
 }
Example #27
0
 public void AddProvider(IResultProvider provider)
 {
     providers.Add(provider);
     results.Add(new TimeSeries(SmoothingPoints));
 }
Example #28
0
 private bool HasPreferences(IResultProvider provider)
 {
     return provider
         .GetType()
         .GetInterfaces()
         .Any(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IHasPreferences<>));
 }
Example #29
0
 public PreferenceRow(IResultProvider provider, string key, object value)
 {
     Provider = provider;
     Key = key;
     Value = (value == null) ? "null" : value.ToString();
 }
Example #30
0
        public static FileSystemSearchResult CreateFrom(IResultProvider provider, FileSystemInfo fileSystemInfo)
        {
            if (fileSystemInfo.IsDirectory())
                return new DirectorySearchResult(provider, (DirectoryInfo)fileSystemInfo);

            if (fileSystemInfo.Extension == ".lnk")
                return new ShortcutSearchResult(provider, (FileInfo)fileSystemInfo);

            return new FileSearchResult(provider, (FileInfo)fileSystemInfo);
        }
 protected virtual NotificationDisplayTask GetDisplayTask(IResultProvider notificationVM, string originator)
 {
     return new NotificationDisplayTask(notificationVM, originator);
 }
Example #32
0
 public CompletionEngine(JadeCore.ITextDocument sourceDoc, TextArea textArea, IResultProvider resultsProvider)
 {
     _textArea = textArea;
     _sourceDoc = sourceDoc;
     _resulsProvider = resultsProvider;
     _textArea.TextEntering += TextAreaTextEntering;
     _textArea.TextEntered += TextAreaTextEntered;
     _currentPhase = Phase.Inactive;
 }