Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| da4baa6f12 | |||
| 81c396dd80 | |||
| d12738e609 | |||
| 2187a6129f | |||
| 0e2dda20a3 | |||
| 39e42e894e | |||
| feecb993dd | |||
| c438ba0bc1 | |||
| aba3cf9d92 | |||
| d941a099ca |
@@ -1,4 +1,7 @@
|
||||
# xunit.runner.wpf
|
||||
|
||||
[](https://teocomi.visualstudio.com/Speckle/_build/latest?definitionId=1&branchName=master)
|
||||
|
||||
XUnit Gui written in WPF
|
||||
|
||||
Fork of [xunit.runner.wpf](https://www.nuget.org/packages/xunit.runner.wpf).
|
||||
|
||||
@@ -11,14 +11,14 @@ namespace SampleTestAssembly
|
||||
public class Class1
|
||||
{
|
||||
[Fact]
|
||||
//[Trait("TraitName1", "TraitValue1")]
|
||||
[Trait("TraitName1", "TraitValue1")]
|
||||
public void Pass()
|
||||
{
|
||||
Thread.Sleep(TimeSpan.FromSeconds(1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
//[Trait("TraitName1", "TraitValue2")]
|
||||
[Trait("TraitName1", "TraitValue2")]
|
||||
public void Fail()
|
||||
{
|
||||
Thread.Sleep(TimeSpan.FromSeconds(2));
|
||||
@@ -26,7 +26,7 @@ namespace SampleTestAssembly
|
||||
}
|
||||
|
||||
[Fact(Skip = "Testing")]
|
||||
//[Trait("TraitName2", "TraitValue2")]
|
||||
[Trait("TraitName2", "TraitValue2")]
|
||||
public void Skip()
|
||||
{
|
||||
Thread.Sleep(TimeSpan.FromSeconds(1));
|
||||
|
||||
+3
-4
@@ -4,19 +4,18 @@
|
||||
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
|
||||
|
||||
trigger:
|
||||
- master
|
||||
branches:
|
||||
include:
|
||||
- refs/tags/*
|
||||
|
||||
pool:
|
||||
vmImage: 'windows-latest'
|
||||
|
||||
|
||||
|
||||
variables:
|
||||
solution: '**/*.sln'
|
||||
buildPlatform: 'Any CPU'
|
||||
buildConfiguration: 'Release'
|
||||
|
||||
|
||||
steps:
|
||||
- task: NuGetToolInstaller@1
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
@@ -253,7 +254,12 @@ namespace Xunit.Runner.Wpf.ViewModel
|
||||
{
|
||||
if (StartupAssemblies == null)
|
||||
return;
|
||||
var assemblies = StartupAssemblies.Select(x => new AssemblyAndConfigFile(x, configFileName: null));
|
||||
List<AssemblyAndConfigFile> assemblies = new List<AssemblyAndConfigFile>();
|
||||
foreach(var assembly in StartupAssemblies)
|
||||
{
|
||||
if (File.Exists(assembly))
|
||||
assemblies.Add(new AssemblyAndConfigFile(assembly, configFileName: null));
|
||||
}
|
||||
await AddAssemblies(assemblies);
|
||||
//await AddAssemblies(ParseCommandLine(Environment.GetCommandLineArgs().Skip(1)));
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@ namespace Xunit.Runner.Wpf.ViewModel
|
||||
|
||||
private class TraitViewModelComparer : IEqualityComparer<TraitViewModel>, IComparer<TraitViewModel>
|
||||
{
|
||||
public int Compare(TraitViewModel x, TraitViewModel y) => StringComparer.Ordinal.Compare(x.Text, y.Text);
|
||||
public bool Equals(TraitViewModel x, TraitViewModel y) => StringComparer.Ordinal.Equals(x.Text, y.Text);
|
||||
public int GetHashCode(TraitViewModel obj) => obj.Text.GetHashCode();
|
||||
public int Compare(TraitViewModel x, TraitViewModel y) => StringComparer.Ordinal.Compare(x.FullText, y.FullText);
|
||||
public bool Equals(TraitViewModel x, TraitViewModel y) => StringComparer.Ordinal.Equals(x.FullText, y.FullText);
|
||||
public int GetHashCode(TraitViewModel obj) => obj.FullText.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,118 +6,129 @@ using Xunit.Runner.Wpf;
|
||||
|
||||
namespace Xunit.Runner.Wpf.ViewModel
|
||||
{
|
||||
public partial class TraitViewModel : ViewModelBase
|
||||
public partial class TraitViewModel : ViewModelBase
|
||||
{
|
||||
private readonly TraitViewModel _parent;
|
||||
private bool? _isChecked;
|
||||
private bool _isExpanded;
|
||||
private string _text;
|
||||
|
||||
public ObservableCollection<TraitViewModel> Children { get; }
|
||||
|
||||
public TraitViewModel(string text)
|
||||
: this(null, text)
|
||||
{
|
||||
private readonly TraitViewModel _parent;
|
||||
private bool? _isChecked;
|
||||
private bool _isExpanded;
|
||||
private string _text;
|
||||
|
||||
public ObservableCollection<TraitViewModel> Children { get; }
|
||||
|
||||
public TraitViewModel(string text)
|
||||
: this(null, text)
|
||||
{
|
||||
}
|
||||
|
||||
private TraitViewModel(TraitViewModel parent, string text)
|
||||
{
|
||||
this._parent = parent;
|
||||
this._isChecked = false;
|
||||
this._isExpanded = true;
|
||||
this._text = text;
|
||||
this.Children = new ObservableCollection<TraitViewModel>();
|
||||
}
|
||||
|
||||
private void SetIsChecked(bool? value, bool updateChildren, bool updateParent)
|
||||
{
|
||||
if (value == this._isChecked)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this._isChecked = value;
|
||||
|
||||
if (updateChildren && value != null)
|
||||
{
|
||||
foreach (var child in this.Children)
|
||||
{
|
||||
child.SetIsChecked(value, updateChildren: true, updateParent: false);
|
||||
}
|
||||
}
|
||||
|
||||
if (updateParent && _parent != null)
|
||||
{
|
||||
_parent.VerifyCheckState();
|
||||
}
|
||||
|
||||
this.RaisePropertyChanged(nameof(IsChecked));
|
||||
}
|
||||
|
||||
private void VerifyCheckState()
|
||||
{
|
||||
bool? state = null;
|
||||
var isFirst = true;
|
||||
|
||||
foreach (var child in this.Children)
|
||||
{
|
||||
if (isFirst)
|
||||
{
|
||||
state = child.IsChecked;
|
||||
isFirst = false;
|
||||
}
|
||||
else if (state != child.IsChecked)
|
||||
{
|
||||
state = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.SetIsChecked(state, updateChildren: false, updateParent: true);
|
||||
}
|
||||
|
||||
public void AddValues(IEnumerable<string> values)
|
||||
{
|
||||
foreach (var value in values)
|
||||
{
|
||||
var index = this.Children.BinarySearch(value, StringComparer.Ordinal.Compare, v => v.Text);
|
||||
if (index < 0)
|
||||
{
|
||||
this.Children.Insert(~index, new TraitViewModel(this, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TraitViewModel GetOrAdd(string text)
|
||||
{
|
||||
var index = this.Children.BinarySearch(text, StringComparer.Ordinal, vm => vm.Text);
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
var viewModel = new TraitViewModel(this, text);
|
||||
this.Children.Insert(~index, viewModel);
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
return this.Children[index];
|
||||
}
|
||||
|
||||
public bool? IsChecked
|
||||
{
|
||||
get { return _isChecked; }
|
||||
set { SetIsChecked(value, updateChildren: true, updateParent: true); }
|
||||
}
|
||||
|
||||
public bool IsExpanded
|
||||
{
|
||||
get { return _isExpanded; }
|
||||
set { Set(ref _isExpanded, value); }
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get { return _text; }
|
||||
set { Set(ref _text, value); }
|
||||
}
|
||||
}
|
||||
|
||||
private TraitViewModel(TraitViewModel parent, string text)
|
||||
{
|
||||
this._parent = parent;
|
||||
this._isChecked = false;
|
||||
this._isExpanded = true;
|
||||
this._text = text;
|
||||
this.Children = new ObservableCollection<TraitViewModel>();
|
||||
}
|
||||
|
||||
private void SetIsChecked(bool? value, bool updateChildren, bool updateParent)
|
||||
{
|
||||
if (value == this._isChecked)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this._isChecked = value;
|
||||
|
||||
if (updateChildren && value != null)
|
||||
{
|
||||
foreach (var child in this.Children)
|
||||
{
|
||||
child.SetIsChecked(value, updateChildren: true, updateParent: false);
|
||||
}
|
||||
}
|
||||
|
||||
if (updateParent && _parent != null)
|
||||
{
|
||||
_parent.VerifyCheckState();
|
||||
}
|
||||
|
||||
this.RaisePropertyChanged(nameof(IsChecked));
|
||||
}
|
||||
|
||||
private void VerifyCheckState()
|
||||
{
|
||||
bool? state = null;
|
||||
var isFirst = true;
|
||||
|
||||
foreach (var child in this.Children)
|
||||
{
|
||||
if (isFirst)
|
||||
{
|
||||
state = child.IsChecked;
|
||||
isFirst = false;
|
||||
}
|
||||
else if (state != child.IsChecked)
|
||||
{
|
||||
state = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.SetIsChecked(state, updateChildren: false, updateParent: true);
|
||||
}
|
||||
|
||||
public void AddValues(IEnumerable<string> values)
|
||||
{
|
||||
foreach (var value in values)
|
||||
{
|
||||
var index = this.Children.BinarySearch(value, StringComparer.Ordinal.Compare, v => v.Text);
|
||||
if (index < 0)
|
||||
{
|
||||
this.Children.Insert(~index, new TraitViewModel(this, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TraitViewModel GetOrAdd(string text)
|
||||
{
|
||||
var index = this.Children.BinarySearch(text, StringComparer.Ordinal, vm => vm.Text);
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
var viewModel = new TraitViewModel(this, text);
|
||||
this.Children.Insert(~index, viewModel);
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
return this.Children[index];
|
||||
}
|
||||
|
||||
public bool? IsChecked
|
||||
{
|
||||
get { return _isChecked; }
|
||||
set { SetIsChecked(value, updateChildren: true, updateParent: true); }
|
||||
}
|
||||
|
||||
public bool IsExpanded
|
||||
{
|
||||
get { return _isExpanded; }
|
||||
set { Set(ref _isExpanded, value); }
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get { return _text; }
|
||||
set { Set(ref _text, value); }
|
||||
}
|
||||
|
||||
public string FullText
|
||||
{
|
||||
get
|
||||
{
|
||||
var fullText = _text;
|
||||
if (_parent != null)
|
||||
fullText = _parent.FullText + _text;
|
||||
return fullText;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
@@ -16,7 +16,9 @@
|
||||
<PackageIcon></PackageIcon>
|
||||
<PackageIconUrl>https://avatars2.githubusercontent.com/u/2092016</PackageIconUrl>
|
||||
<PackageIconUrl>https://avatars2.githubusercontent.com/u/2092016</PackageIconUrl>
|
||||
<Version>1.0.3</Version>
|
||||
<Version>1.0.7</Version>
|
||||
<AssemblyVersion>1.0.7.0</AssemblyVersion>
|
||||
<FileVersion>1.0.7.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user