429 lines
20 KiB
XML
429 lines
20 KiB
XML
<Window
|
|
x:Class="Xunit.Runner.Wpf.MainWindow"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Platform"
|
|
xmlns:converters="clr-namespace:Xunit.Runner.Wpf.Converters"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
|
|
xmlns:local="clr-namespace:Xunit.Runner.Wpf"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
|
xmlns:vm="clr-namespace:Xunit.Runner.Wpf.ViewModel"
|
|
Name="Main"
|
|
Title="xUnit.net Test Runner"
|
|
Width="525"
|
|
Height="600"
|
|
MinWidth="425"
|
|
MinHeight="525"
|
|
DataContext="{Binding Main, Source={StaticResource Locator}}"
|
|
Icon="Artwork\Application.ico"
|
|
ResizeMode="CanResizeWithGrip"
|
|
mc:Ignorable="d">
|
|
|
|
<i:Interaction.Triggers>
|
|
<i:EventTrigger EventName="Loaded">
|
|
<cmd:EventToCommand Command="{Binding WindowLoadedCommand}" />
|
|
</i:EventTrigger>
|
|
|
|
<i:EventTrigger EventName="Closing">
|
|
<cmd:EventToCommand Command="{Binding WindowClosingCommand}" PassEventArgsToCommand="True" />
|
|
</i:EventTrigger>
|
|
</i:Interaction.Triggers>
|
|
|
|
<Window.Resources>
|
|
<converters:TestStateConverter x:Key="TestStateConverter" />
|
|
</Window.Resources>
|
|
|
|
<Grid local:CommandBindings.Registration="{Binding CommandBindings}">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="auto" />
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="auto" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<Menu Grid.Row="0">
|
|
<MenuItem Header="_File">
|
|
<MenuItem Command="{Binding ExitCommand}" Header="E_xit" />
|
|
</MenuItem>
|
|
<MenuItem Header="_Assembly">
|
|
<MenuItem Command="ApplicationCommands.Open" Header="_Open" />
|
|
<MenuItem Header="R_ecent" ItemsSource="{Binding RecentAssemblies}">
|
|
<MenuItem.ItemContainerStyle>
|
|
<Style TargetType="MenuItem">
|
|
<Setter Property="Header" Value="{Binding FilePath}" />
|
|
<Setter Property="Command" Value="{Binding Command}" />
|
|
<Setter Property="CommandParameter" Value="{Binding}" />
|
|
</Style>
|
|
</MenuItem.ItemContainerStyle>
|
|
</MenuItem>
|
|
<Separator />
|
|
<MenuItem Command="{Binding AssemblyRemoveAllCommand}" Header="_Unload" />
|
|
<MenuItem Command="{Binding AssemblyReloadAllCommand}" Header="_Reload" />
|
|
<Separator />
|
|
<MenuItem
|
|
Command="{Binding AutoReloadAssembliesCommand}"
|
|
Header="_Auto Reload Test Assemblies"
|
|
IsCheckable="True"
|
|
IsChecked="{Binding AutoReloadAssemblies}" />
|
|
</MenuItem>
|
|
<MenuItem Header="_Project">
|
|
<MenuItem Header="_Open" />
|
|
<MenuItem Header="_Recent" />
|
|
<Separator />
|
|
<MenuItem Header="_Close" />
|
|
<Separator />
|
|
<MenuItem Header="_Save" />
|
|
<MenuItem Header="Save _As..." />
|
|
</MenuItem>
|
|
</Menu>
|
|
|
|
<Grid Grid.Row="1">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" MinWidth="200px" />
|
|
<ColumnDefinition Width="2*" MinWidth="200px" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="auto" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<GroupBox
|
|
Grid.Row="0"
|
|
Grid.Column="0"
|
|
Margin="3"
|
|
Header="Refinements">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="auto" />
|
|
<RowDefinition Height="auto" />
|
|
<RowDefinition Height="auto" />
|
|
<RowDefinition Height="auto" />
|
|
<RowDefinition Height="auto" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<Label Grid.Row="0" Content="Search:" />
|
|
<TextBox Grid.Row="1" Text="{Binding FilterString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
|
|
|
<Label Grid.Row="2" Content="Assemblies:" />
|
|
<ListBox
|
|
Grid.Row="3"
|
|
Height="175"
|
|
ItemsSource="{Binding Assemblies}"
|
|
SelectionMode="Extended">
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate DataType="vm:TestAssemblyViewModel">
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Text="{Binding DisplayName}" />
|
|
|
|
<TextBlock
|
|
FontStyle="Italic"
|
|
Foreground="Gray"
|
|
Text=" Discovering tests...">
|
|
|
|
<TextBlock.Style>
|
|
<Style TargetType="TextBlock">
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding State}" Value="{x:Static vm:AssemblyState.Loading}">
|
|
<Setter Property="Visibility" Value="Visible" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</TextBlock.Style>
|
|
|
|
</TextBlock>
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
|
|
<ListBox.ItemContainerStyle>
|
|
<Style TargetType="{x:Type ListBoxItem}">
|
|
<Setter Property="IsSelected" Value="{Binding Mode=TwoWay, Path=IsSelected}" />
|
|
</Style>
|
|
</ListBox.ItemContainerStyle>
|
|
|
|
<ListBox.ContextMenu>
|
|
<ContextMenu>
|
|
<MenuItem Command="{Binding AssemblyReloadCommand}" Header="Reload" />
|
|
<MenuItem Command="{Binding AssemblyReloadAllCommand}" Header="Reload All" />
|
|
<Separator />
|
|
<MenuItem Command="{Binding AssemblyRemoveCommand}" Header="Remove" />
|
|
<MenuItem Command="{Binding AssemblyRemoveAllCommand}" Header="Remove All" />
|
|
</ContextMenu>
|
|
</ListBox.ContextMenu>
|
|
</ListBox>
|
|
|
|
<Label Grid.Row="4" Content="Traits:" />
|
|
|
|
<TreeView Grid.Row="5" ItemsSource="{Binding Traits}">
|
|
|
|
<TreeView.Resources>
|
|
<HierarchicalDataTemplate DataType="{x:Type vm:TraitViewModel}" ItemsSource="{Binding Children}">
|
|
|
|
<CheckBox Content="{Binding Text}" IsChecked="{Binding IsChecked}">
|
|
<i:Interaction.Triggers>
|
|
<i:EventTrigger EventName="Checked">
|
|
<cmd:EventToCommand Command="{Binding DataContext.TraitCheckedChangedCommand, RelativeSource={RelativeSource AncestorType=Window}}" CommandParameter="{Binding}" />
|
|
</i:EventTrigger>
|
|
|
|
<i:EventTrigger EventName="Unchecked">
|
|
<cmd:EventToCommand Command="{Binding DataContext.TraitCheckedChangedCommand, RelativeSource={RelativeSource AncestorType=Window}}" CommandParameter="{Binding}" />
|
|
</i:EventTrigger>
|
|
</i:Interaction.Triggers>
|
|
</CheckBox>
|
|
|
|
</HierarchicalDataTemplate>
|
|
</TreeView.Resources>
|
|
|
|
<TreeView.ItemContainerStyle>
|
|
<Style TargetType="TreeViewItem">
|
|
<Setter Property="IsExpanded" Value="{Binding IsExpanded}" />
|
|
</Style>
|
|
</TreeView.ItemContainerStyle>
|
|
|
|
<TreeView.ContextMenu>
|
|
<ContextMenu>
|
|
<MenuItem Command="{Binding TraitsClearCommand}" Header="Clear" />
|
|
</ContextMenu>
|
|
</TreeView.ContextMenu>
|
|
|
|
</TreeView>
|
|
</Grid>
|
|
</GroupBox>
|
|
|
|
<Grid Grid.Row="1" Grid.Column="0">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Button
|
|
Grid.Column="0"
|
|
Margin="10,0,0,0"
|
|
Command="{Binding RunAllCommand}"
|
|
Content="_Run All" />
|
|
<Button
|
|
Grid.Column="1"
|
|
Command="{Binding RunSelectedCommand}"
|
|
Content="Run _Selected" />
|
|
<Button
|
|
Grid.Column="2"
|
|
Margin="0,0,10,0"
|
|
Command="{Binding CancelCommand}"
|
|
Content="_Cancel" />
|
|
</Grid>
|
|
|
|
<Grid Grid.Row="0" Grid.Column="1">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*" MinHeight="200px" />
|
|
<RowDefinition Height="auto" />
|
|
<RowDefinition Height="*" MinHeight="200px" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<GroupBox
|
|
Grid.Row="0"
|
|
Margin="3"
|
|
Header="{Binding TestCasesCaption}">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="auto" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<StackPanel Orientation="Horizontal">
|
|
<ToggleButton
|
|
Grid.Column="0"
|
|
Margin="0,4,2,4"
|
|
Background="Transparent"
|
|
BorderThickness="0"
|
|
Command="{Binding TestFilterChanged}"
|
|
IsChecked="{Binding FilterPassedTests}">
|
|
<StackPanel Orientation="Horizontal">
|
|
<Image Source="Artwork\Passed_large.png" />
|
|
<TextBlock
|
|
Margin="4,0"
|
|
VerticalAlignment="Center"
|
|
FontSize="16"
|
|
Text="{Binding TestsPassed, StringFormat={}{0:#\,0}}" />
|
|
</StackPanel>
|
|
</ToggleButton>
|
|
|
|
<ToggleButton
|
|
Grid.Column="1"
|
|
Margin="2,4"
|
|
Background="Transparent"
|
|
BorderThickness="0"
|
|
Command="{Binding TestFilterChanged}"
|
|
IsChecked="{Binding FilterFailedTests}">
|
|
<StackPanel Orientation="Horizontal">
|
|
<Image Source="Artwork\Failed_large.png" />
|
|
<TextBlock
|
|
Margin="4,0"
|
|
VerticalAlignment="Center"
|
|
FontSize="16"
|
|
Text="{Binding TestsFailed, StringFormat={}{0:#\,0}}" />
|
|
</StackPanel>
|
|
</ToggleButton>
|
|
|
|
<ToggleButton
|
|
Grid.Column="2"
|
|
Margin="2,4,0,4"
|
|
Background="Transparent"
|
|
BorderThickness="0"
|
|
Command="{Binding TestFilterChanged}"
|
|
IsChecked="{Binding FilterSkippedTests}">
|
|
<StackPanel Orientation="Horizontal">
|
|
<Image Source="Artwork\Skipped_large.png" />
|
|
<TextBlock
|
|
Margin="4,0"
|
|
VerticalAlignment="Center"
|
|
FontSize="16"
|
|
Text="{Binding TestsSkipped, StringFormat={}{0:#\,0}}" />
|
|
</StackPanel>
|
|
</ToggleButton>
|
|
|
|
<ToggleButton
|
|
Grid.Column="2"
|
|
Margin="2,4,0,4"
|
|
Background="Transparent"
|
|
BorderThickness="0"
|
|
Command="{Binding TestFilterChanged}"
|
|
IsChecked="{Binding FilterRunningTests}">
|
|
<StackPanel Orientation="Horizontal">
|
|
<Image Source="Artwork\Running_large.png" />
|
|
<TextBlock
|
|
Margin="4,0"
|
|
VerticalAlignment="Center"
|
|
FontSize="16"
|
|
Text="{Binding TestsRunning, StringFormat={}{0:#\,0}}" />
|
|
</StackPanel>
|
|
</ToggleButton>
|
|
</StackPanel>
|
|
|
|
<ListBox
|
|
x:Name="TestCases"
|
|
Grid.Row="1"
|
|
ItemsSource="{Binding FilteredTestCases}"
|
|
SelectedItem="{Binding SelectedTestCase, Mode=TwoWay}"
|
|
SelectionChanged="TestCases_SelectionChanged"
|
|
SelectionMode="Extended">
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate DataType="vm:TestCaseViewModel">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="20" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Image
|
|
Grid.Column="0"
|
|
Width="16"
|
|
Margin="0,0,2,0"
|
|
Source="{Binding Path=State, Mode=OneWay, Converter={StaticResource TestStateConverter}}" />
|
|
|
|
<TextBlock
|
|
Grid.Column="1"
|
|
VerticalAlignment="Center"
|
|
Text="{Binding DisplayName}" />
|
|
</Grid>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
<ListBox.InputBindings>
|
|
<KeyBinding Key="Enter" Command="{Binding RunSelectedCommand}" />
|
|
</ListBox.InputBindings>
|
|
<i:Interaction.Triggers>
|
|
<i:EventTrigger EventName="MouseDoubleClick">
|
|
<cmd:EventToCommand Command="{Binding Path=RunSelectedCommand}" PassEventArgsToCommand="False" />
|
|
</i:EventTrigger>
|
|
</i:Interaction.Triggers>
|
|
</ListBox>
|
|
</Grid>
|
|
</GroupBox>
|
|
|
|
<GridSplitter
|
|
Grid.Row="1"
|
|
Height="3"
|
|
HorizontalAlignment="Stretch"
|
|
Background="White" />
|
|
|
|
<GroupBox
|
|
Grid.Row="2"
|
|
Margin="3"
|
|
Header="Output">
|
|
<TextBox
|
|
FontFamily="Consolas"
|
|
HorizontalScrollBarVisibility="Auto"
|
|
IsReadOnly="True"
|
|
Text="{Binding Output}"
|
|
VerticalScrollBarVisibility="Visible" />
|
|
</GroupBox>
|
|
</Grid>
|
|
|
|
<GridSplitter
|
|
Grid.Column="0"
|
|
Width="3"
|
|
VerticalAlignment="Stretch"
|
|
Background="White" />
|
|
|
|
<ProgressBar
|
|
Grid.Row="1"
|
|
Grid.Column="1"
|
|
Margin="3"
|
|
Foreground="{Binding Path=CurrentRunState, Converter={StaticResource TestStateConverter}, Mode=OneWay}"
|
|
Maximum="{Binding MaximumProgress}"
|
|
Minimum="0"
|
|
Value="{Binding Path=TestsCompleted}" />
|
|
</Grid>
|
|
|
|
<StackPanel Grid.Row="2">
|
|
<Border
|
|
Margin="3"
|
|
BorderBrush="LightGray"
|
|
BorderThickness="1" />
|
|
<StatusBar>
|
|
<StatusBar.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="auto" />
|
|
<ColumnDefinition Width="auto" />
|
|
<ColumnDefinition Width="auto" />
|
|
<ColumnDefinition Width="16" />
|
|
</Grid.ColumnDefinitions>
|
|
</Grid>
|
|
</ItemsPanelTemplate>
|
|
</StatusBar.ItemsPanel>
|
|
|
|
<StatusBarItem Grid.Column="1">
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Foreground="DarkGreen" Text="Tests passed: " />
|
|
|
|
<TextBlock Text="{Binding TestsPassed, StringFormat={}{0:#\,0}}" />
|
|
</StackPanel>
|
|
</StatusBarItem>
|
|
|
|
<StatusBarItem Grid.Column="2">
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Foreground="DarkRed" Text="Tests failed: " />
|
|
|
|
<TextBlock Text="{Binding TestsFailed, StringFormat={}{0:#\,0}}" />
|
|
</StackPanel>
|
|
</StatusBarItem>
|
|
|
|
<StatusBarItem Grid.Column="3">
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Foreground="DarkGoldenrod" Text="Tests skipped: " />
|
|
|
|
<TextBlock Text="{Binding TestsSkipped, StringFormat={}{0:#\,0}}" />
|
|
</StackPanel>
|
|
</StatusBarItem>
|
|
</StatusBar>
|
|
</StackPanel>
|
|
</Grid>
|
|
</Window>
|