public PackageSettingsViewModel(IUnitTestEngine engine) { Runtimes = new[] { new DefaultRuntimeFramework() } .Concat(engine.TestEngine.Services.GetService <IAvailableRuntimes>().AvailableRuntimes) .ToList(); PackageSettngs.DomainUsage = "Default"; PackageSettngs.IsRunAsX86 = false; PackageSettngs.ProcessModel = "Default"; PackageSettngs.RuntimeFramework = Runtimes.FirstOrDefault(); }
public ProjectViewModel(IUnitTestEngine engine, IExportProvider provider, IFileDialogFactory fileDialogFactory) { _fileDialogFactory = fileDialogFactory; _testEngine = engine.TestEngine; RunAllTestCommand = ReactiveCommand.CreateFromTask( RunAllTestAsync, this.WhenAny( vm => vm.IsRunning, (p2) => !p2.Value)); StopTestCommand = ReactiveCommand.CreateFromTask( StopTestAsync, this.WhenAny(vm => vm.IsRunning, vm => vm.IsStopping, (p1, p2) => p1.Value == true && p2.Value == false)); RunSelectedTestCommand = ReactiveCommand.CreateFromTask( RunSelectedTestAsync, Observable.CombineLatest( this.WhenAny(vm => vm.SelectedItem, p => p.Value != null), this.WhenAny(vm => vm.IsRunning, p => p.Value == false), (p1, p2) => p1 && p2)); OpenFileCommand = ReactiveCommand.CreateFromObservable( () => Observable.StartAsync(ct => SelectFileAndload(ct)) .TakeUntil(CancelLoadingProjectCommand)); _isProjectLoading = OpenFileCommand.IsExecuting.ToProperty(this, vm => vm.IsProjectLoading); CancelLoadingProjectCommand = ReactiveCommand.Create( () => { }, OpenFileCommand.IsExecuting); AddFileCommand = ReactiveCommand.Create( () => OpenAndAddFile()); RemoveFileCommand = ReactiveCommand.Create <string>( f => { FilePathList.Remove(f); }, this.WhenAny(vm => vm.SelectedFilePath, p => string.IsNullOrEmpty(p.Value) == false)); CloseLoadingErrorCommand = ReactiveCommand.CreateFromTask( () => { ErrorMessage = null; return(Task.CompletedTask); }, this.WhenAny(vm => vm.ErrorMessage, p => string.IsNullOrEmpty(p.Value) == false)); this.WhenAnyValue(vm => vm.CompletedTestsCount).Subscribe(_ => { if (RanTestsCount == 0) { TestsProgress = 0; } else { var value = (double)CompletedTestsCount / (double)RanTestsCount * 100.0; TestsProgress = value < 100 ? value : 100.0; } }); Observable .Interval(TimeSpan.FromMilliseconds(250), DispatcherScheduler.Current) .Where(_ => this.IsRunning) .Subscribe( x => { TestTimePass += TimeSpan.FromMilliseconds(x); }); }
private void ReloadTestList() { k_TestEngine = new NUnitTestEngine(); RefreshTests(); }