public TestListViewModel() { _testSessionContextLoader = new TestSessionContextLoader(this); _settingsService = new UserSettingsService(); _testRunner = new TestCaseRunner(); InitializeTestListCommand = new AsyncDelegateCommand(InitializeTestList); ExecuteAllTestsCommand = new AsyncDelegateCommand(ExecuteAllTests); ExecuteSelectedTestsCommand = new AsyncDelegateCommand(ExecuteSelectedTests); ExecuteSelectedTestsInParallelCommand = new AsyncDelegateCommand(ExecuteSelectedTestsInParallel); TestGroups = new ObservableCollection<TestGroupViewModel>(); TestCategories = new ObservableCollection<TestCategoryViewModel>(); TestResultFilters = new ObservableCollection<TestResultFilterViewModel>(); InitializeTestResultFilters(); ConfigFilePath = _settingsService.LastConfigFilePath; _testSessionContextLoader.ProgressChanged += OnTestSessionContextLoaderProgressChanged; _testRunner.TestCaseFinished += OnTestCaseFinished; _testRunner.TestCaseStarting += OnTestCaseStarting; IsProgressIndeterminate = true; EventAggregator.TestViewModelSelected += OnTestViewModelSelected; }
public TestGroupViewModel(string name, IEnumerable<TestCase> testCases, TestListViewModel testListViewModel) { _testListViewModel = testListViewModel; var testCaseList = testCases.ToList(); Name = name; Tests = new ObservableCollection<TestViewModel>(testCaseList.Select(x => new TestViewModel(x))); VisibleTests = new ObservableCollection<TestViewModel>(Tests); ToggleExpandCollapseCommand = new DelegateCommand(ToggleExpandCollapse); ExecuteTestsCommand = new AsyncDelegateCommand(ExecuteTests); ExecuteTestsInParallelCommand = new AsyncDelegateCommand(ExecuteTestsInParallel); foreach (var testViewModel in Tests) { testViewModel.PropertyChanged += OnTestViewModelPropertyChanged; } TotalTestCaseCount = testCaseList.Count; EventAggregator.TestResultFilterSelectionChanged += UpdateVisibleTests; EventAggregator.TestCategorySelectionChanged += UpdateVisibleTests; EventAggregator.SearchStringChanged += x => UpdateVisibleTests(); }