Implement the State Filters and Counts.

This commit is contained in:
Kevin Pilch-Bisson
2015-08-09 12:28:05 -07:00
parent c82e4d7e73
commit 2e07a602e1
2 changed files with 97 additions and 18 deletions
+33 -17
View File
@@ -128,23 +128,39 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<Image Source="Artwork\Passed.ico"
Height="16"
Margin="3" />
<TextBlock Text="0"
Margin="3" />
<Image Source="Artwork\Failed.ico"
Height="16"
Margin="3" />
<TextBlock Text="0"
Margin="3" />
<Image Source="Artwork\Skipped.ico"
Height="16"
Margin="3" />
<TextBlock Text="0"
Margin="3" />
</StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<RadioButton IsChecked="{Binding IsPassedFilterChecked}"
Margin="3">
<StackPanel Orientation="Horizontal">
<Image Source="Artwork\Passed.ico"
Height="16" />
<TextBlock Text="{Binding TestsPassed}" />
</StackPanel>
</RadioButton>
<RadioButton IsChecked="{Binding IsFailedFilterChecked}"
Margin="3"
Grid.Column="1">
<StackPanel Orientation="Horizontal">
<Image Source="Artwork\Failed.ico"
Height="16" />
<TextBlock Text="{Binding TestsFailed}" />
</StackPanel>
</RadioButton>
<RadioButton IsChecked="{Binding IsSkippedFilterChecked}"
Margin="3"
Grid.Column="2">
<StackPanel Orientation="Horizontal">
<Image Source="Artwork\Skipped.ico"
Height="16" />
<TextBlock Text="{Binding TestsSkipped}" />
</StackPanel>
</RadioButton>
</Grid>
<ListBox ItemsSource="{Binding TestCases}"
SelectionMode="Extended"
Grid.Row="1">
+64 -1
View File
@@ -62,13 +62,34 @@ namespace xunit.runner.wpf.ViewModel
private set { Set(ref methodsCaption, value); }
}
private int testsCompleted = -1;
private int testsCompleted = 0;
public int TestsCompleted
{
get { return testsCompleted; }
set { Set(ref testsCompleted, value); }
}
private int testsPassed = 0;
public int TestsPassed
{
get { return testsPassed; }
set { Set(ref testsPassed, value); }
}
private int testsFailed = 0;
public int TestsFailed
{
get { return testsFailed; }
set { Set(ref testsFailed, value); }
}
private int testsSkipped = 0;
public int TestsSkipped
{
get { return testsSkipped; }
set { Set(ref testsSkipped, value); }
}
private int maximumProgress = int.MaxValue;
public int MaximumProgress
{
@@ -323,6 +344,19 @@ namespace xunit.runner.wpf.ViewModel
private void TestRunVisitor_TestFinished(object sender, TestStateEventArgs e)
{
TestsCompleted++;
switch (e.State)
{
case TestState.Passed:
TestsPassed++;
break;
case TestState.Failed:
TestsFailed++;
break;
case TestState.Skipped:
TestsSkipped++;
break;
}
if (e.State > CurrentRunState)
{
CurrentRunState = e.State;
@@ -335,6 +369,35 @@ namespace xunit.runner.wpf.ViewModel
{
this.IsCancelRequested = true;
}
public bool IsPassedFilterChecked
{
get { return ResultFilter == TestState.Passed; }
set { UpdateFilter(value, TestState.Passed); }
}
public bool IsFailedFilterChecked
{
get { return ResultFilter == TestState.Failed; }
set { UpdateFilter(value, TestState.Failed); }
}
public bool IsSkippedFilterChecked
{
get { return ResultFilter == TestState.Skipped; }
set { UpdateFilter(value, TestState.Skipped); }
}
private void UpdateFilter(bool value, TestState newState)
{
if (value && ResultFilter != newState)
{
ResultFilter = newState;
RaisePropertyChanged(nameof(IsPassedFilterChecked));
RaisePropertyChanged(nameof(IsFailedFilterChecked));
RaisePropertyChanged(nameof(IsSkippedFilterChecked));
}
}
}
/// <summary>