diff --git a/xunit.runner.wpf/MainWindow.xaml b/xunit.runner.wpf/MainWindow.xaml index 304d941..981b37e 100644 --- a/xunit.runner.wpf/MainWindow.xaml +++ b/xunit.runner.wpf/MainWindow.xaml @@ -110,6 +110,11 @@ + + + + + diff --git a/xunit.runner.wpf/ViewModel/MainViewModel.cs b/xunit.runner.wpf/ViewModel/MainViewModel.cs index 9ef4e59..5999710 100644 --- a/xunit.runner.wpf/ViewModel/MainViewModel.cs +++ b/xunit.runner.wpf/ViewModel/MainViewModel.cs @@ -50,6 +50,7 @@ namespace xunit.runner.wpf.ViewModel this.RunCommand = new RelayCommand(OnExecuteRun, CanExecuteRun); this.CancelCommand = new RelayCommand(OnExecuteCancel, CanExecuteCancel); this.TraitSelectionChangedCommand = new RelayCommand(OnTraitSelectionChanged); + this.TraitsClearCommand = new RelayCommand(OnTraitsClear); } private static bool TestCaseMatches(TestCaseViewModel testCase, SearchQuery searchQuery) @@ -108,6 +109,7 @@ namespace xunit.runner.wpf.ViewModel public RelayCommand RunCommand { get; } public RelayCommand CancelCommand { get; } public ICommand TraitSelectionChangedCommand { get; } + public ICommand TraitsClearCommand { get; } public CommandBindingCollection CommandBindings { get; } @@ -328,8 +330,6 @@ namespace xunit.runner.wpf.ViewModel tc.State = TestState.NotRun; } - // TODO: Need a way to filter based on traits - var runAll = TestCases.Count == this.allTestCases.Count; var testSessionList = new List(); @@ -437,6 +437,14 @@ namespace xunit.runner.wpf.ViewModel FilterAfterDelay(); } + private void OnTraitsClear() + { + foreach (var cur in this.traitCollectionView.Collection) + { + cur.IsSelected = false; + } + } + public bool IncludePassedTests { get { return searchQuery.IncludePassedTests; } diff --git a/xunit.runner.wpf/ViewModel/TraitViewModel.cs b/xunit.runner.wpf/ViewModel/TraitViewModel.cs index 11b2f1b..d58211f 100644 --- a/xunit.runner.wpf/ViewModel/TraitViewModel.cs +++ b/xunit.runner.wpf/ViewModel/TraitViewModel.cs @@ -9,13 +9,19 @@ namespace xunit.runner.wpf.ViewModel { public sealed class TraitViewModel : ViewModelBase { - public readonly string _name; - public readonly string _value; + private readonly string _name; + private readonly string _value; + private bool _isSelected; public string Name => _name; public string Value => _value; public string DisplayName => $"{Name}={Value}"; - public bool IsSelected { get; set; } + + public bool IsSelected + { + get { return _isSelected; } + set { Set(ref _isSelected, value, nameof(IsSelected)); } + } public TraitViewModel(string name, string value) {