diff --git a/appveyor.yml b/appveyor.yml
index d5795b6c..e0e80911 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -9,21 +9,21 @@ build_script:
- pwsh: |
if ($isWindows) {
Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile "./dotnet-install.ps1"
- ./dotnet-install.ps1 -JSonFile src/global.json -Architecture x64 -InstallDir 'C:\Program Files\dotnet'
+ ./dotnet-install.ps1 -JSonFile global.json -Architecture x64 -InstallDir 'C:\Program Files\dotnet'
dotnet build src --configuration Release
- dotnet test src --configuration Release --no-build --no-restore
+ dotnet test --solution src/DiffEngine.slnx --configuration Release --no-build --no-restore
dotnet publish src/DiffEngine.AotTests/DiffEngine.AotTests.csproj --configuration Release
}
else {
Invoke-WebRequest "https://dot.net/v1/dotnet-install.sh" -OutFile "./dotnet-install.sh"
sudo chmod u+x dotnet-install.sh
if ($isMacOS) {
- sudo ./dotnet-install.sh --jsonfile src/global.json --architecture x64 --install-dir '/usr/local/share/dotnet'
+ sudo ./dotnet-install.sh --jsonfile global.json --architecture x64 --install-dir '/usr/local/share/dotnet'
} else {
- sudo ./dotnet-install.sh --jsonfile src/global.json --architecture x64 --install-dir '/usr/share/dotnet'
+ sudo ./dotnet-install.sh --jsonfile global.json --architecture x64 --install-dir '/usr/share/dotnet'
}
dotnet build src --configuration Release-NotWindows
- dotnet test src --configuration Release-NotWindows --no-build --no-restore
+ dotnet test --solution src/DiffEngine.slnx --configuration Release-NotWindows --no-build --no-restore
dotnet publish src/DiffEngine.AotTests/DiffEngine.AotTests.csproj --configuration Release-NotWindows
}
on_failure:
diff --git a/claude.md b/claude.md
index d5d96bee..7ed4a4e7 100644
--- a/claude.md
+++ b/claude.md
@@ -13,13 +13,14 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
dotnet build src --configuration Release
# Run all tests
-dotnet test src --configuration Release
+dotnet test --project src/DiffEngine.Tests --configuration Release
+dotnet test --project src/DiffEngineTray.Tests --configuration Release
-# Run a single test file
-dotnet test src/DiffEngine.Tests --filter "FullyQualifiedName~ClassName"
+# Run a single test project with filter
+dotnet test --project src/DiffEngine.Tests --configuration Release --filter "FullyQualifiedName~ClassName"
# Run a specific test
-dotnet test src/DiffEngine.Tests --filter "FullyQualifiedName=DiffEngine.Tests.ClassName.TestMethod"
+dotnet test --project src/DiffEngine.Tests --configuration Release --filter "FullyQualifiedName=DiffEngine.Tests.ClassName.TestMethod"
```
**SDK Requirements:** .NET 10 SDK (see `src/global.json`). The project uses preview/prerelease SDK features.
@@ -66,4 +67,4 @@ DiffEngine is a library that manages launching and cleanup of diff tools for sna
- Tool discovery uses wildcard path matching (`WildcardFileFinder`) to find executables in common install locations
- Tool order can be customized via `DiffEngine_ToolOrder` environment variable
- `DisabledChecker` respects `DiffEngine_Disabled` env var
-- Tests use xUnit and Verify for snapshot testing
+- Tests use TUnit and Verify for snapshot testing
diff --git a/docs/diff-tool.custom.md b/docs/diff-tool.custom.md
index fb1d4242..eee2b615 100644
--- a/docs/diff-tool.custom.md
+++ b/docs/diff-tool.custom.md
@@ -53,7 +53,7 @@ New tools are added to the top of the order, the last tool added will resolve be
```cs
await DiffRunner.LaunchAsync(tempFile, targetFile);
```
-snippet source | anchor
+snippet source | anchor
Alternatively the instance returned from `AddTool*` can be used to explicitly launch that tool.
diff --git a/src/global.json b/global.json
similarity index 64%
rename from src/global.json
rename to global.json
index 9edac847..5f8d5f85 100644
--- a/src/global.json
+++ b/global.json
@@ -3,5 +3,8 @@
"version": "10.0.102",
"allowPrerelease": true,
"rollForward": "latestFeature"
+ },
+ "test": {
+ "runner": "Microsoft.Testing.Platform"
}
}
\ No newline at end of file
diff --git a/readme.md b/readme.md
index 26d03599..e5c48c01 100644
--- a/readme.md
+++ b/readme.md
@@ -100,7 +100,7 @@ A tool can be launched using the following:
```cs
await DiffRunner.LaunchAsync(tempFile, targetFile);
```
-snippet source | anchor
+snippet source | anchor
Note that this method will respect the above [difference behavior](/docs/diff-tool.md#detected-difference-behavior) in terms of Auto refresh and MDI behaviors.
@@ -115,7 +115,7 @@ A tool can be closed using the following:
```cs
DiffRunner.Kill(file1, file2);
```
-snippet source | anchor
+snippet source | anchor
Note that this method will respect the above [difference behavior](/docs/diff-tool.md#detected-difference-behavior) in terms of MDI behavior.
@@ -170,18 +170,18 @@ var isAppVeyor = BuildServerDetector.IsAppVeyor;
```cs
-[Fact]
+[Test]
public async Task SetDetectedPersistsInAsyncContext()
{
var original = BuildServerDetector.Detected;
try
{
BuildServerDetector.Detected = true;
- Assert.True(BuildServerDetector.Detected);
+ await Assert.That(BuildServerDetector.Detected).IsTrue();
await Task.Delay(1);
- Assert.True(BuildServerDetector.Detected);
+ await Assert.That(BuildServerDetector.Detected).IsTrue();
}
finally
{
@@ -189,18 +189,18 @@ public async Task SetDetectedPersistsInAsyncContext()
}
}
-[Fact]
+[Test]
public async Task SetDetectedDoesNotLeakToOtherContexts()
{
var parentValue = BuildServerDetector.Detected;
- await Task.Run(() =>
+ await Task.Run(async () =>
{
BuildServerDetector.Detected = true;
- Assert.True(BuildServerDetector.Detected);
+ await Assert.That(BuildServerDetector.Detected).IsTrue();
});
- Assert.Equal(parentValue, BuildServerDetector.Detected);
+ await Assert.That(BuildServerDetector.Detected).IsEqualTo(parentValue);
}
```
snippet source | anchor
diff --git a/src/DiffEngine.Tests/AiCliDetectorTest.cs b/src/DiffEngine.Tests/AiCliDetectorTest.cs
index 5ecca503..fac6f1ab 100644
--- a/src/DiffEngine.Tests/AiCliDetectorTest.cs
+++ b/src/DiffEngine.Tests/AiCliDetectorTest.cs
@@ -1,6 +1,6 @@
public class AiCliDetectorTest
{
- [Fact]
+ [Test]
public void Props()
{
// ReSharper disable UnusedVariable
@@ -16,4 +16,4 @@ public void Props()
// ReSharper restore UnusedVariable
}
-}
+}
\ No newline at end of file
diff --git a/src/DiffEngine.Tests/BuildServerDetectorTest.cs b/src/DiffEngine.Tests/BuildServerDetectorTest.cs
index b15cb36b..97152286 100644
--- a/src/DiffEngine.Tests/BuildServerDetectorTest.cs
+++ b/src/DiffEngine.Tests/BuildServerDetectorTest.cs
@@ -1,6 +1,6 @@
public class BuildServerDetectorTest
{
- [Fact]
+ [Test]
public void Props()
{
// ReSharper disable UnusedVariable
@@ -26,18 +26,18 @@ public void Props()
#region BuildServerDetectorDetectedOverride
- [Fact]
+ [Test]
public async Task SetDetectedPersistsInAsyncContext()
{
var original = BuildServerDetector.Detected;
try
{
BuildServerDetector.Detected = true;
- Assert.True(BuildServerDetector.Detected);
+ await Assert.That(BuildServerDetector.Detected).IsTrue();
await Task.Delay(1);
- Assert.True(BuildServerDetector.Detected);
+ await Assert.That(BuildServerDetector.Detected).IsTrue();
}
finally
{
@@ -45,18 +45,18 @@ public async Task SetDetectedPersistsInAsyncContext()
}
}
- [Fact]
+ [Test]
public async Task SetDetectedDoesNotLeakToOtherContexts()
{
var parentValue = BuildServerDetector.Detected;
- await Task.Run(() =>
+ await Task.Run(async () =>
{
BuildServerDetector.Detected = true;
- Assert.True(BuildServerDetector.Detected);
+ await Assert.That(BuildServerDetector.Detected).IsTrue();
});
- Assert.Equal(parentValue, BuildServerDetector.Detected);
+ await Assert.That(BuildServerDetector.Detected).IsEqualTo(parentValue);
}
#endregion
diff --git a/src/DiffEngine.Tests/DefinitionsTest.cs b/src/DiffEngine.Tests/DefinitionsTest.cs
index 94e70d28..c26be0ea 100644
--- a/src/DiffEngine.Tests/DefinitionsTest.cs
+++ b/src/DiffEngine.Tests/DefinitionsTest.cs
@@ -3,7 +3,7 @@ public class DefinitionsTest
static string SourceDirectory { get; } = Path.GetDirectoryName(GetSourceFile())!;
static string GetSourceFile([CallerFilePath] string path = "") => path;
- [Fact]
+ [Test]
public void WriteList()
{
var md = Path.Combine(SourceDirectory, "diffToolList.include.md");
@@ -16,10 +16,10 @@ public void WriteList()
}
}
- [Fact]
- public void EnvironmentVariablesShouldBeUnique()
+ [Test]
+ public async Task EnvironmentVariablesShouldBeUnique()
{
- static void FindDuplicates(Func selectOs)
+ static async Task FindDuplicates(Func selectOs)
{
var findDuplicates = Definitions.Tools
.Select(_ => _.OsSupport)
@@ -28,13 +28,13 @@ static void FindDuplicates(Func selectOs)
.GroupBy(_ => _);
foreach (var group in findDuplicates)
{
- Assert.Single(group);
+ await Assert.That(group).HasSingleItem();
}
}
- FindDuplicates(_ => _.Windows);
- FindDuplicates(_ => _.Osx);
- FindDuplicates(_ => _.Linux);
+ await FindDuplicates(_ => _.Windows);
+ await FindDuplicates(_ => _.Osx);
+ await FindDuplicates(_ => _.Linux);
}
static void AddToolLink(TextWriter writer, Definition tool)
@@ -65,7 +65,7 @@ static string GetOsSupport(OsSupport osSupport)
return builder.ToString();
}
- [Fact]
+ [Test]
public void WriteDefaultOrder()
{
var md = Path.Combine(SourceDirectory, "defaultOrder.include.md");
@@ -78,7 +78,7 @@ public void WriteDefaultOrder()
}
}
- [Fact]
+ [Test]
public void WriteFoundTools()
{
var md = Path.Combine(SourceDirectory, "diffTools.include.md");
diff --git a/src/DiffEngine.Tests/DiffEngine.Tests.csproj b/src/DiffEngine.Tests/DiffEngine.Tests.csproj
index 0c3eed2e..f820529f 100644
--- a/src/DiffEngine.Tests/DiffEngine.Tests.csproj
+++ b/src/DiffEngine.Tests/DiffEngine.Tests.csproj
@@ -1,19 +1,19 @@
- net10.0
+ net10.0
net10.0;net48
true
$(NoWarn);SYSLIB0012
+ true
+ Exe
-
-
-
+
-
\ No newline at end of file
+
diff --git a/src/DiffEngine.Tests/DiffEngineTrayTest.cs b/src/DiffEngine.Tests/DiffEngineTrayTest.cs
index d350ebc5..806f7253 100644
--- a/src/DiffEngine.Tests/DiffEngineTrayTest.cs
+++ b/src/DiffEngine.Tests/DiffEngineTrayTest.cs
@@ -1,7 +1,7 @@
#pragma warning disable CS0618 // Type or member is obsolete
public class DiffEngineTrayTest
{
- [Fact]
- public void IsRunning() =>
- Assert.False(DiffEngineTray.IsRunning);
+ [Test]
+ public async Task IsRunning() =>
+ await Assert.That(DiffEngineTray.IsRunning).IsFalse();
}
diff --git a/src/DiffEngine.Tests/DiffRunnerTests.cs b/src/DiffEngine.Tests/DiffRunnerTests.cs
index 72075bdc..77a20c58 100644
--- a/src/DiffEngine.Tests/DiffRunnerTests.cs
+++ b/src/DiffEngine.Tests/DiffRunnerTests.cs
@@ -9,7 +9,8 @@ public class DiffRunnerTests
string file1;
string command;
- [Fact(Skip = "Explicit")]
+ [Test]
+ [Skip("Explicit")]
public async Task MaxInstancesToLaunch()
{
DiffRunner.MaxInstancesToLaunch(1);
@@ -19,10 +20,10 @@ public async Task MaxInstancesToLaunch()
ProcessCleanup.Refresh();
var result = await DiffRunner.LaunchAsync(file1, "fake.txt");
await Task.Delay(300);
- Assert.Equal(LaunchResult.StartedNewInstance, result);
+ await Assert.That(result).IsEqualTo(LaunchResult.StartedNewInstance);
ProcessCleanup.Refresh();
result = await DiffRunner.LaunchAsync(file2, "fake.txt");
- Assert.Equal(LaunchResult.TooManyRunningDiffTools, result);
+ await Assert.That(result).IsEqualTo(LaunchResult.TooManyRunningDiffTools);
ProcessCleanup.Refresh();
DiffRunner.Kill(file1, "fake.txt");
DiffRunner.Kill(file2, "fake.txt");
@@ -33,7 +34,8 @@ public async Task MaxInstancesToLaunch()
}
}
- [Fact(Skip = "Explicit")]
+ [Test]
+ [Skip("Explicit")]
public async Task MaxInstancesToLaunchAsync()
{
DiffRunner.MaxInstancesToLaunch(1);
@@ -43,10 +45,10 @@ public async Task MaxInstancesToLaunchAsync()
ProcessCleanup.Refresh();
var result = await DiffRunner.LaunchAsync(file1, "fake.txt");
await Task.Delay(300);
- Assert.Equal(LaunchResult.StartedNewInstance, result);
+ await Assert.That(result).IsEqualTo(LaunchResult.StartedNewInstance);
ProcessCleanup.Refresh();
result = await DiffRunner.LaunchAsync(file2, "fake.txt");
- Assert.Equal(LaunchResult.TooManyRunningDiffTools, result);
+ await Assert.That(result).IsEqualTo(LaunchResult.TooManyRunningDiffTools);
ProcessCleanup.Refresh();
DiffRunner.Kill(file1, "fake.txt");
DiffRunner.Kill(file2, "fake.txt");
@@ -69,7 +71,8 @@ static async Task Launch()
#endregion
}
- [Fact(Skip = "Explicit")]
+ [Test]
+ [Skip("Explicit")]
public async Task KillAsync()
{
await DiffRunner.LaunchAsync(file1, file2);
@@ -82,25 +85,25 @@ public async Task KillAsync()
#endregion
}
- [Fact]
- public void LaunchAndKillDisabled()
+ [Test]
+ public async Task LaunchAndKillDisabled()
{
DiffRunner.Disabled = true;
try
{
- Assert.False(IsRunning());
- Assert.False(ProcessCleanup.IsRunning(command));
+ await Assert.That(IsRunning()).IsFalse();
+ await Assert.That(ProcessCleanup.IsRunning(command)).IsFalse();
var result = DiffRunner.Launch(file1, file2);
- Assert.Equal(LaunchResult.Disabled, result);
+ await Assert.That(result).IsEqualTo(LaunchResult.Disabled);
Thread.Sleep(500);
ProcessCleanup.Refresh();
- Assert.False(IsRunning());
- Assert.False(ProcessCleanup.IsRunning(command));
+ await Assert.That(IsRunning()).IsFalse();
+ await Assert.That(ProcessCleanup.IsRunning(command)).IsFalse();
DiffRunner.Kill(file1, file2);
Thread.Sleep(500);
ProcessCleanup.Refresh();
- Assert.False(IsRunning());
- Assert.False(ProcessCleanup.IsRunning(command));
+ await Assert.That(IsRunning()).IsFalse();
+ await Assert.That(ProcessCleanup.IsRunning(command)).IsFalse();
}
finally
{
@@ -108,25 +111,25 @@ public void LaunchAndKillDisabled()
}
}
- [Fact]
+ [Test]
public async Task LaunchAndKillDisabledAsync()
{
DiffRunner.Disabled = true;
try
{
- Assert.False(IsRunning());
- Assert.False(ProcessCleanup.IsRunning(command));
+ await Assert.That(IsRunning()).IsFalse();
+ await Assert.That(ProcessCleanup.IsRunning(command)).IsFalse();
var result = await DiffRunner.LaunchAsync(file1, file2);
- Assert.Equal(LaunchResult.Disabled, result);
+ await Assert.That(result).IsEqualTo(LaunchResult.Disabled);
Thread.Sleep(500);
ProcessCleanup.Refresh();
- Assert.False(IsRunning());
- Assert.False(ProcessCleanup.IsRunning(command));
+ await Assert.That(IsRunning()).IsFalse();
+ await Assert.That(ProcessCleanup.IsRunning(command)).IsFalse();
DiffRunner.Kill(file1, file2);
Thread.Sleep(500);
ProcessCleanup.Refresh();
- Assert.False(IsRunning());
- Assert.False(ProcessCleanup.IsRunning(command));
+ await Assert.That(IsRunning()).IsFalse();
+ await Assert.That(ProcessCleanup.IsRunning(command)).IsFalse();
}
finally
{
@@ -134,40 +137,40 @@ public async Task LaunchAndKillDisabledAsync()
}
}
- [Fact]
- public void LaunchAndKill()
+ [Test]
+ public async Task LaunchAndKill()
{
- Assert.False(IsRunning());
- Assert.False(ProcessCleanup.IsRunning(command));
+ await Assert.That(IsRunning()).IsFalse();
+ await Assert.That(ProcessCleanup.IsRunning(command)).IsFalse();
var result = DiffRunner.Launch(file1, file2);
- Assert.Equal(LaunchResult.StartedNewInstance, result);
+ await Assert.That(result).IsEqualTo(LaunchResult.StartedNewInstance);
Thread.Sleep(500);
ProcessCleanup.Refresh();
- Assert.True(IsRunning());
- Assert.True(ProcessCleanup.IsRunning(command));
+ await Assert.That(IsRunning()).IsTrue();
+ await Assert.That(ProcessCleanup.IsRunning(command)).IsTrue();
DiffRunner.Kill(file1, file2);
Thread.Sleep(500);
ProcessCleanup.Refresh();
- Assert.False(IsRunning());
- Assert.False(ProcessCleanup.IsRunning(command));
+ await Assert.That(IsRunning()).IsFalse();
+ await Assert.That(ProcessCleanup.IsRunning(command)).IsFalse();
}
- [Fact]
+ [Test]
public async Task LaunchAndKillAsync()
{
- Assert.False(IsRunning());
- Assert.False(ProcessCleanup.IsRunning(command));
+ await Assert.That(IsRunning()).IsFalse();
+ await Assert.That(ProcessCleanup.IsRunning(command)).IsFalse();
var result = await DiffRunner.LaunchAsync(file1, file2);
- Assert.Equal(LaunchResult.StartedNewInstance, result);
+ await Assert.That(result).IsEqualTo(LaunchResult.StartedNewInstance);
Thread.Sleep(500);
ProcessCleanup.Refresh();
- Assert.True(IsRunning());
- Assert.True(ProcessCleanup.IsRunning(command));
+ await Assert.That(IsRunning()).IsTrue();
+ await Assert.That(ProcessCleanup.IsRunning(command)).IsTrue();
DiffRunner.Kill(file1, file2);
Thread.Sleep(500);
ProcessCleanup.Refresh();
- Assert.False(IsRunning());
- Assert.False(ProcessCleanup.IsRunning(command));
+ await Assert.That(IsRunning()).IsFalse();
+ await Assert.That(ProcessCleanup.IsRunning(command)).IsFalse();
}
static bool IsRunning() =>
diff --git a/src/DiffEngine.Tests/DiffToolsTest.cs b/src/DiffEngine.Tests/DiffToolsTest.cs
index d06f00f1..48a5a177 100644
--- a/src/DiffEngine.Tests/DiffToolsTest.cs
+++ b/src/DiffEngine.Tests/DiffToolsTest.cs
@@ -3,14 +3,14 @@ public class DiffToolsTest
static string SourceDirectory { get; } = Path.GetDirectoryName(GetSourceFile())!;
static string GetSourceFile([CallerFilePath] string path = "") => path;
- [Fact]
+ [Test]
public void MaxInstancesToLaunch() =>
#region MaxInstancesToLaunch
DiffRunner.MaxInstancesToLaunch(10);
#endregion
- [Fact]
- public void AddTool()
+ [Test]
+ public async Task AddTool()
{
var diffToolPath = FakeDiffTool.Exe;
@@ -32,13 +32,13 @@ public void AddTool()
#endregion
var resolved = DiffTools.Resolved.Select(_ => _.Name).First();
- Assert.Equal(resolvedTool.Name, resolved);
- Assert.True(DiffTools.TryFindByExtension(".jpg", out var forExtension));
- Assert.Equal(resolvedTool.Name, forExtension.Name);
+ await Assert.That(resolved).IsEqualTo(resolvedTool.Name);
+ await Assert.That(DiffTools.TryFindByExtension(".jpg", out var forExtension)).IsTrue();
+ await Assert.That(forExtension!.Name).IsEqualTo(resolvedTool.Name);
}
- [Fact]
- public void OrderShouldNotMessWithAddTool()
+ [Test]
+ public async Task OrderShouldNotMessWithAddTool()
{
var diffToolPath = FakeDiffTool.Exe;
var resolvedTool = DiffTools.AddTool(
@@ -54,13 +54,13 @@ public void OrderShouldNotMessWithAddTool()
exePath: diffToolPath,
binaryExtensions: [])!;
DiffTools.UseOrder(DiffTool.VisualStudio, DiffTool.AraxisMerge);
- Assert.Equal("MyCustomDiffTool", resolvedTool.Name);
- Assert.True(DiffTools.TryFindByExtension(".txt", out var forExtension));
- Assert.Equal("MyCustomDiffTool", forExtension.Name);
+ await Assert.That(resolvedTool.Name).IsEqualTo("MyCustomDiffTool");
+ await Assert.That(DiffTools.TryFindByExtension(".txt", out var forExtension)).IsTrue();
+ await Assert.That(forExtension!.Name).IsEqualTo("MyCustomDiffTool");
}
- [Fact]
- public void TextConvention()
+ [Test]
+ public async Task TextConvention()
{
var diffToolPath = FakeDiffTool.Exe;
DiffTools.AddTool(
@@ -76,12 +76,12 @@ public void TextConvention()
exePath: diffToolPath,
binaryExtensions: []);
var combine = Path.Combine(SourceDirectory, "input.temp.txtConvention");
- Assert.True(DiffTools.TryFindForInputFilePath(combine, out var tool));
- Assert.Equal("MyCustomDiffTool", tool.Name);
+ await Assert.That(DiffTools.TryFindForInputFilePath(combine, out var tool)).IsTrue();
+ await Assert.That(tool!.Name).IsEqualTo("MyCustomDiffTool");
}
#if DEBUG
- [Fact]
+ [Test]
public void AddToolBasedOn()
{
// ReSharper disable once UnusedVariable
@@ -219,8 +219,8 @@ public void TryFindByName()
}
#endif
*/
- [Fact]
- public void TryFindByName_IsCaseInsensitive()
+ [Test]
+ public async Task TryFindByName_IsCaseInsensitive()
{
var diffToolPath = FakeDiffTool.Exe;
@@ -238,24 +238,24 @@ public void TryFindByName_IsCaseInsensitive()
binaryExtensions: []);
// Exact case
- Assert.True(DiffTools.TryFindByName("MyCaseSensitiveTool", out var tool1));
- Assert.Equal("MyCaseSensitiveTool", tool1.Name);
+ await Assert.That(DiffTools.TryFindByName("MyCaseSensitiveTool", out var tool1)).IsTrue();
+ await Assert.That(tool1!.Name).IsEqualTo("MyCaseSensitiveTool");
// All lowercase
- Assert.True(DiffTools.TryFindByName("mycasesensitivetool", out var tool2));
- Assert.Equal("MyCaseSensitiveTool", tool2.Name);
+ await Assert.That(DiffTools.TryFindByName("mycasesensitivetool", out var tool2)).IsTrue();
+ await Assert.That(tool2!.Name).IsEqualTo("MyCaseSensitiveTool");
// All uppercase
- Assert.True(DiffTools.TryFindByName("MYCASESENSITIVETOOL", out var tool3));
- Assert.Equal("MyCaseSensitiveTool", tool3.Name);
+ await Assert.That(DiffTools.TryFindByName("MYCASESENSITIVETOOL", out var tool3)).IsTrue();
+ await Assert.That(tool3!.Name).IsEqualTo("MyCaseSensitiveTool");
// Mixed case
- Assert.True(DiffTools.TryFindByName("myCASEsensitiveTOOL", out var tool4));
- Assert.Equal("MyCaseSensitiveTool", tool4.Name);
+ await Assert.That(DiffTools.TryFindByName("myCASEsensitiveTOOL", out var tool4)).IsTrue();
+ await Assert.That(tool4!.Name).IsEqualTo("MyCaseSensitiveTool");
}
- [Fact]
- public void AddTool_RejectsDuplicateNameCaseInsensitive()
+ [Test]
+ public async Task AddTool_RejectsDuplicateNameCaseInsensitive()
{
var diffToolPath = FakeDiffTool.Exe;
@@ -287,7 +287,7 @@ public void AddTool_RejectsDuplicateNameCaseInsensitive()
exePath: diffToolPath,
binaryExtensions: []));
- Assert.Contains("Tool with name already exists", exception.Message);
+ await Assert.That(exception.Message).Contains("Tool with name already exists");
}
public DiffToolsTest() =>
diff --git a/src/DiffEngine.Tests/GlobalUsings.cs b/src/DiffEngine.Tests/GlobalUsings.cs
index add0efda..89e938b0 100644
--- a/src/DiffEngine.Tests/GlobalUsings.cs
+++ b/src/DiffEngine.Tests/GlobalUsings.cs
@@ -1,5 +1,7 @@
global using EmptyFiles;
-global using Xunit;
global using System.Diagnostics;
global using System.Reflection;
global using System.Text;
+global using TUnit.Assertions;
+global using TUnit.Assertions.Extensions;
+global using TUnit.Core;
diff --git a/src/DiffEngine.Tests/LinuxOsxProcessTests.cs b/src/DiffEngine.Tests/LinuxOsxProcessTests.cs
index a666b6dc..59e6eb18 100644
--- a/src/DiffEngine.Tests/LinuxOsxProcessTests.cs
+++ b/src/DiffEngine.Tests/LinuxOsxProcessTests.cs
@@ -1,42 +1,42 @@
public class LinuxOsxProcessTests
{
- [Fact]
- public void TryParseWithZshInstalled()
+ [Test]
+ public async Task TryParseWithZshInstalled()
{
var parse = LinuxOsxProcess.TryParse("20872 -zsh", out var command);
- Assert.True(parse);
+ await Assert.That(parse).IsTrue();
var processCommand = command!.Value;
- Assert.Equal(20872, processCommand.Process);
- Assert.Equal("-zsh", processCommand.Command);
+ await Assert.That(processCommand.Process).IsEqualTo(20872);
+ await Assert.That(processCommand.Command).IsEqualTo("-zsh");
}
- [Fact]
- public void TryParse()
+ [Test]
+ public async Task TryParse()
{
var parse = LinuxOsxProcess.TryParse("309 /System/Library/coreauthd -foo", out var command);
- Assert.True(parse);
+ await Assert.That(parse).IsTrue();
var processCommand = command!.Value;
- Assert.Equal(309, processCommand.Process);
- Assert.Equal("/System/Library/coreauthd -foo", processCommand.Command);
+ await Assert.That(processCommand.Process).IsEqualTo(309);
+ await Assert.That(processCommand.Command).IsEqualTo("/System/Library/coreauthd -foo");
}
- [Fact]
- public void TryParse_noSlash()
+ [Test]
+ public async Task TryParse_noSlash()
{
var parse = LinuxOsxProcess.TryParse("309 System/Library/coreauthd -foo", out var command);
- Assert.True(parse);
+ await Assert.That(parse).IsTrue();
var processCommand = command!.Value;
- Assert.Equal(309, processCommand.Process);
- Assert.Equal("System/Library/coreauthd -foo", processCommand.Command);
+ await Assert.That(processCommand.Process).IsEqualTo(309);
+ await Assert.That(processCommand.Command).IsEqualTo("System/Library/coreauthd -foo");
}
- [Fact]
- public void TryParse_singleDigit()
+ [Test]
+ public async Task TryParse_singleDigit()
{
var parse = LinuxOsxProcess.TryParse("309 System/Library/coreauthd -foo", out var command);
- Assert.True(parse);
+ await Assert.That(parse).IsTrue();
var processCommand = command!.Value;
- Assert.Equal(309, processCommand.Process);
- Assert.Equal("System/Library/coreauthd -foo", processCommand.Command);
+ await Assert.That(processCommand.Process).IsEqualTo(309);
+ await Assert.That(processCommand.Command).IsEqualTo("System/Library/coreauthd -foo");
}
}
diff --git a/src/DiffEngine.Tests/ModuleInitializer.cs b/src/DiffEngine.Tests/ModuleInitializer.cs
index 69da424e..b9205d43 100644
--- a/src/DiffEngine.Tests/ModuleInitializer.cs
+++ b/src/DiffEngine.Tests/ModuleInitializer.cs
@@ -1,6 +1,4 @@
-[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly, DisableTestParallelization = true)]
-
-public static class ModuleInitializer
+public static class ModuleInitializer
{
[ModuleInitializer]
public static void Initialize()
@@ -9,4 +7,4 @@ public static void Initialize()
Logging.Enable();
DiffRunner.Disabled = false;
}
-}
\ No newline at end of file
+}
diff --git a/src/DiffEngine.Tests/OrderReaderTest.cs b/src/DiffEngine.Tests/OrderReaderTest.cs
index 42a4921e..5d323fd9 100644
--- a/src/DiffEngine.Tests/OrderReaderTest.cs
+++ b/src/DiffEngine.Tests/OrderReaderTest.cs
@@ -1,17 +1,18 @@
public class OrderReaderTest
{
- [Fact]
- public void ParseEnvironmentVariable()
+ [Test]
+ public async Task ParseEnvironmentVariable()
{
var diffTools = OrderReader.ParseEnvironment("VisualStudio,Meld").ToList();
- Assert.Equal(DiffTool.VisualStudio, diffTools[0]);
- Assert.Equal(DiffTool.Meld, diffTools[1]);
+ await Assert.That(diffTools[0]).IsEqualTo(DiffTool.VisualStudio);
+ await Assert.That(diffTools[1]).IsEqualTo(DiffTool.Meld);
}
- [Fact]
- public void BadEnvironmentVariable()
+ [Test]
+ public async Task BadEnvironmentVariable()
{
+ // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
var exception = Assert.Throws(() => OrderReader.ParseEnvironment("Foo").ToList());
- Assert.Equal("Unable to parse tool from `DiffEngine_ToolOrder` environment variable: Foo", exception.Message);
+ await Assert.That(exception.Message).IsEqualTo("Unable to parse tool from `DiffEngine_ToolOrder` environment variable: Foo");
}
}
diff --git a/src/DiffEngine.Tests/OsSettingsResolverTest.cs b/src/DiffEngine.Tests/OsSettingsResolverTest.cs
index 4bf78aef..ede05981 100644
--- a/src/DiffEngine.Tests/OsSettingsResolverTest.cs
+++ b/src/DiffEngine.Tests/OsSettingsResolverTest.cs
@@ -1,37 +1,37 @@
public class OsSettingsResolverTest
{
- [Fact]
- public void Simple()
+ [Test]
+ public async Task Simple()
{
var paths = OsSettingsResolver.ExpandProgramFiles(["Path"]).ToList();
- Assert.Equal("Path", paths.Single());
+ await Assert.That(paths.Single()).IsEqualTo("Path");
}
- [Fact]
- public void Expand()
+ [Test]
+ public async Task Expand()
{
var paths = OsSettingsResolver.ExpandProgramFiles([@"%ProgramFiles%\Path"]).ToList();
- Assert.Equal(@"%ProgramFiles%\Path", paths[0]);
- Assert.Equal(@"%ProgramW6432%\Path", paths[1]);
- Assert.Equal(@"%ProgramFiles(x86)%\Path", paths[2]);
+ await Assert.That(paths[0]).IsEqualTo(@"%ProgramFiles%\Path");
+ await Assert.That(paths[1]).IsEqualTo(@"%ProgramW6432%\Path");
+ await Assert.That(paths[2]).IsEqualTo(@"%ProgramFiles(x86)%\Path");
}
- [Fact]
- public void TryFindForEnvironmentVariable_NoEnv()
+ [Test]
+ public async Task TryFindForEnvironmentVariable_NoEnv()
{
- Assert.False(OsSettingsResolver.TryFindForEnvironmentVariable("FakeTool", "FakeTool.exe", out var envPath));
- Assert.Null(envPath);
+ await Assert.That(OsSettingsResolver.TryFindForEnvironmentVariable("FakeTool", "FakeTool.exe", out var envPath)).IsFalse();
+ await Assert.That(envPath).IsNull();
}
- [Fact]
- public void TryFindForEnvironmentVariable_WithEnvFile()
+ [Test]
+ public async Task TryFindForEnvironmentVariable_WithEnvFile()
{
var location = Assembly.GetExecutingAssembly().Location;
Environment.SetEnvironmentVariable("DiffEngine_FakeTool", location);
try
{
- Assert.True(OsSettingsResolver.TryFindForEnvironmentVariable("FakeTool", "DiffEngine.Tests.dll", out var envPath));
- Assert.Equal(location, envPath);
+ await Assert.That(OsSettingsResolver.TryFindForEnvironmentVariable("FakeTool", "DiffEngine.Tests.dll", out var envPath)).IsTrue();
+ await Assert.That(envPath).IsEqualTo(location);
}
finally
{
@@ -39,15 +39,15 @@ public void TryFindForEnvironmentVariable_WithEnvFile()
}
}
- [Fact]
- public void TryFindForEnvironmentVariable_WithEnvFile_incorrectCase()
+ [Test]
+ public async Task TryFindForEnvironmentVariable_WithEnvFile_incorrectCase()
{
var location = Assembly.GetExecutingAssembly().Location;
Environment.SetEnvironmentVariable("DiffEngine_FakeTool", location);
try
{
- Assert.True(OsSettingsResolver.TryFindForEnvironmentVariable("FakeTool", "diffengine.tests.dll", out var envPath));
- Assert.Equal(location, envPath);
+ await Assert.That(OsSettingsResolver.TryFindForEnvironmentVariable("FakeTool", "diffengine.tests.dll", out var envPath)).IsTrue();
+ await Assert.That(envPath).IsEqualTo(location);
}
finally
{
@@ -55,15 +55,15 @@ public void TryFindForEnvironmentVariable_WithEnvFile_incorrectCase()
}
}
- [Fact]
- public void TryFindForEnvironmentVariable_WithEnvDir()
+ [Test]
+ public async Task TryFindForEnvironmentVariable_WithEnvDir()
{
var location = Assembly.GetExecutingAssembly().Location;
Environment.SetEnvironmentVariable("DiffEngine_FakeTool", Path.GetDirectoryName(location));
try
{
- Assert.True(OsSettingsResolver.TryFindForEnvironmentVariable("FakeTool", "DiffEngine.Tests.dll", out var envPath));
- Assert.Equal(location, envPath);
+ await Assert.That(OsSettingsResolver.TryFindForEnvironmentVariable("FakeTool", "DiffEngine.Tests.dll", out var envPath)).IsTrue();
+ await Assert.That(envPath).IsEqualTo(location);
}
finally
{
@@ -71,15 +71,15 @@ public void TryFindForEnvironmentVariable_WithEnvDir()
}
}
- [Fact]
- public void TryFindForEnvironmentVariable_WithEnv_BadPath()
+ [Test]
+ public async Task TryFindForEnvironmentVariable_WithEnv_BadPath()
{
var location = Assembly.GetExecutingAssembly().Location;
Environment.SetEnvironmentVariable("DiffEngine_FakeTool", location);
try
{
var exception = Assert.Throws(()=>OsSettingsResolver.TryFindForEnvironmentVariable("FakeTool", "NoFile.dll", out _));
- Assert.Equal(exception.Message, $"Could not find exe defined by DiffEngine_FakeTool. Path: {location}");
+ await Assert.That($"Could not find exe defined by DiffEngine_FakeTool. Path: {location}").IsEqualTo(exception.Message);
}
finally
{
@@ -87,27 +87,27 @@ public void TryFindForEnvironmentVariable_WithEnv_BadPath()
}
}
- [Fact]
- public void EnvPath()
+ [Test]
+ public async Task EnvPath()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
var found = OsSettingsResolver.TryFindInEnvPath("cmd.exe", out var filePath);
- Assert.True(found);
- Assert.Equal(@"C:\Windows\System32\cmd.exe", filePath, ignoreCase: true);
+ await Assert.That(found).IsTrue();
+ await Assert.That(filePath).IsEqualTo(@"C:\Windows\System32\cmd.exe");
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ||
RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
var found = OsSettingsResolver.TryFindInEnvPath("sh", out var filePath);
- Assert.True(found);
- Assert.NotNull(filePath);
+ await Assert.That(found).IsTrue();
+ await Assert.That(filePath).IsNotNull();
}
}
- [Fact]
- public void EnvVar()
+ [Test]
+ public async Task EnvVar()
{
var launchArguments = new LaunchArguments(
Left: (_, _) => string.Empty,
@@ -123,7 +123,7 @@ public void EnvVar()
new(Windows: new("cmd.exe", launchArguments, "")),
out var filePath,
out _);
- Assert.True(found);
- Assert.Equal(@"C:\Windows\System32\cmd.exe", filePath, ignoreCase: true);
+ await Assert.That(found).IsTrue();
+ await Assert.That(filePath).IsEqualTo(@"C:\Windows\System32\cmd.exe");
}
}
diff --git a/src/DiffEngine.Tests/ProcessCleanupTests.cs b/src/DiffEngine.Tests/ProcessCleanupTests.cs
index cce18576..ddc0592f 100644
--- a/src/DiffEngine.Tests/ProcessCleanupTests.cs
+++ b/src/DiffEngine.Tests/ProcessCleanupTests.cs
@@ -1,11 +1,11 @@
public class ProcessCleanupTests
{
- [Fact]
- public void Find()
+ [Test]
+ public async Task Find()
{
var list = ProcessCleanup.FindAll().ToList();
// new processes have large Ids
- Assert.True(list[0].Process > list[1].Process);
+ await Assert.That(list[0].Process > list[1].Process).IsTrue();
foreach (var x in list)
{
Debug.WriteLine($"{x.Process} {x.Command}");
diff --git a/src/DiffEngine.Tests/TargetPositionTest.cs b/src/DiffEngine.Tests/TargetPositionTest.cs
index 43949d38..b81a6a0e 100644
--- a/src/DiffEngine.Tests/TargetPositionTest.cs
+++ b/src/DiffEngine.Tests/TargetPositionTest.cs
@@ -1,38 +1,38 @@
public class TargetPositionTest
{
- [Theory]
- [InlineData("true", true)]
- [InlineData("TRUE", true)]
- [InlineData("True", true)]
- [InlineData("tRuE", true)]
- [InlineData("false", false)]
- [InlineData("FALSE", false)]
- [InlineData("False", false)]
- [InlineData("fAlSe", false)]
- public void ParseTargetOnLeft_IsCaseInsensitive(string input, bool expected)
+ [Test]
+ [Arguments("true", true)]
+ [Arguments("TRUE", true)]
+ [Arguments("True", true)]
+ [Arguments("tRuE", true)]
+ [Arguments("false", false)]
+ [Arguments("FALSE", false)]
+ [Arguments("False", false)]
+ [Arguments("fAlSe", false)]
+ public async Task ParseTargetOnLeft_IsCaseInsensitive(string input, bool expected)
{
var result = TargetPosition.ParseTargetOnLeft(input);
- Assert.Equal(expected, result);
+ await Assert.That(result).IsEqualTo(expected);
}
- [Fact]
- public void ParseTargetOnLeft_NullReturnsNull()
+ [Test]
+ public async Task ParseTargetOnLeft_NullReturnsNull()
{
var result = TargetPosition.ParseTargetOnLeft(null);
- Assert.Null(result);
+ await Assert.That(result).IsNull();
}
- [Theory]
- [InlineData("yes")]
- [InlineData("no")]
- [InlineData("1")]
- [InlineData("0")]
- [InlineData("")]
- [InlineData("invalid")]
- public void ParseTargetOnLeft_InvalidValueThrows(string input)
+ [Test]
+ [Arguments("yes")]
+ [Arguments("no")]
+ [Arguments("1")]
+ [Arguments("0")]
+ [Arguments("")]
+ [Arguments("invalid")]
+ public async Task ParseTargetOnLeft_InvalidValueThrows(string input)
{
var exception = Assert.Throws(() => TargetPosition.ParseTargetOnLeft(input));
- Assert.Contains("Unable to parse Position", exception.Message);
- Assert.Contains(input, exception.Message);
+ await Assert.That(exception.Message).Contains("Unable to parse Position");
+ await Assert.That(exception.Message).Contains(input);
}
}
diff --git a/src/DiffEngine.Tests/WildcardFileFinderTests.cs b/src/DiffEngine.Tests/WildcardFileFinderTests.cs
index 785ca910..bef21ec5 100644
--- a/src/DiffEngine.Tests/WildcardFileFinderTests.cs
+++ b/src/DiffEngine.Tests/WildcardFileFinderTests.cs
@@ -4,42 +4,42 @@ public class WildcardFileFinderTests
static string SourceDirectory { get; } = Path.GetDirectoryName(GetSourceFile())!;
static string GetSourceFile([CallerFilePath] string path = "") => path;
- [Fact]
- public void MultiMatchDir_order1()
+ [Test]
+ public async Task MultiMatchDir_order1()
{
var dir1 = Path.Combine(SourceDirectory, "DirForSearch", "dir1");
var dir2 = Path.Combine(SourceDirectory, "DirForSearch", "dir2");
Directory.SetLastWriteTime(dir2, DateTime.Now.AddDays(-1));
Directory.SetLastWriteTime(dir1, DateTime.Now);
var path = Path.Combine(SourceDirectory, "DirForSearch", "*", "TextFile1.txt");
- Assert.True(WildcardFileFinder.TryFind(path, out var result));
- Assert.True(File.Exists(result), result);
+ await Assert.That(WildcardFileFinder.TryFind(path, out var result)).IsTrue();
+ await Assert.That(File.Exists(result)).IsTrue();
}
- [Fact]
- public void MultiMatchDir_order2()
+ [Test]
+ public async Task MultiMatchDir_order2()
{
var dir1 = Path.Combine(SourceDirectory, "DirForSearch", "dir1");
var dir2 = Path.Combine(SourceDirectory, "DirForSearch", "dir2");
Directory.SetLastWriteTime(dir1, DateTime.Now.AddDays(-1));
Directory.SetLastWriteTime(dir2, DateTime.Now);
var path = Path.Combine(SourceDirectory, "DirForSearch", "*", "TextFile1.txt");
- Assert.True(WildcardFileFinder.TryFind(path, out var result));
- Assert.True(File.Exists(result), result);
+ await Assert.That(WildcardFileFinder.TryFind(path, out var result)).IsTrue();
+ await Assert.That(File.Exists(result)).IsTrue();
}
- [Fact]
- public void FullFilePath()
+ [Test]
+ public async Task FullFilePath()
{
- Assert.True(WildcardFileFinder.TryFind(SourceFile, out var result));
- Assert.True(File.Exists(result), result);
+ await Assert.That(WildcardFileFinder.TryFind(SourceFile, out var result)).IsTrue();
+ await Assert.That(File.Exists(result)).IsTrue();
}
- [Fact]
- public void FullFilePath_missing()
+ [Test]
+ public async Task FullFilePath_missing()
{
- Assert.False(WildcardFileFinder.TryFind(SourceFile.Replace(".cs", ".foo"), out var result));
- Assert.Null(result);
+ await Assert.That(WildcardFileFinder.TryFind(SourceFile.Replace(".cs", ".foo"), out var result)).IsFalse();
+ await Assert.That(result).IsNull();
}
//[Fact]
@@ -58,21 +58,21 @@ public void FullFilePath_missing()
// Assert.Null(result);
//}
- [Fact]
- public void WildCardInDir()
+ [Test]
+ public async Task WildCardInDir()
{
var directory = SourceDirectory.Replace("Tests", "Test*");
var path = Path.Combine(directory, "WildcardFileFinderTests.cs");
- Assert.True(WildcardFileFinder.TryFind(path, out var result));
- Assert.True(File.Exists(result), result);
+ await Assert.That(WildcardFileFinder.TryFind(path, out var result)).IsTrue();
+ await Assert.That(File.Exists(result)).IsTrue();
}
- [Fact]
- public void WildCardInDir_missing()
+ [Test]
+ public async Task WildCardInDir_missing()
{
var directory = SourceDirectory.Replace("Tests", "Test*.Foo");
var path = Path.Combine(directory, "WildcardFileFinderTests.cs");
- Assert.False(WildcardFileFinder.TryFind(path, out var result));
- Assert.Null(result);
+ await Assert.That(WildcardFileFinder.TryFind(path, out var result)).IsFalse();
+ await Assert.That(result).IsNull();
}
}
diff --git a/src/DiffEngine.Tests/WindowsProcessTests.cs b/src/DiffEngine.Tests/WindowsProcessTests.cs
index 34e7e69e..59b3f279 100644
--- a/src/DiffEngine.Tests/WindowsProcessTests.cs
+++ b/src/DiffEngine.Tests/WindowsProcessTests.cs
@@ -3,42 +3,42 @@
#endif
public class WindowsProcessTests
{
- [Theory]
- [InlineData("\"C:\\Program Files\\Beyond Compare 4\\BComp.exe\" C:\\temp\\file.1.txt C:\\temp\\file.2.txt", true)]
- [InlineData("notepad.exe C:\\Users\\test\\doc.1.txt C:\\Users\\test\\doc.2.txt", true)]
- [InlineData("\"C:\\diff\\tool.exe\" D:\\path\\to\\source.1.cs D:\\path\\to\\target.2.cs", true)]
- [InlineData("code.exe --diff file.a.b file.c.d", true)]
- [InlineData("app.exe path.with.dots path.more.dots", true)]
- public void MatchesPattern_WithTwoFilePaths_ReturnsTrue(string commandLine, bool expected)
+ [Test]
+ [Arguments("\"C:\\Program Files\\Beyond Compare 4\\BComp.exe\" C:\\temp\\file.1.txt C:\\temp\\file.2.txt", true)]
+ [Arguments("notepad.exe C:\\Users\\test\\doc.1.txt C:\\Users\\test\\doc.2.txt", true)]
+ [Arguments("\"C:\\diff\\tool.exe\" D:\\path\\to\\source.1.cs D:\\path\\to\\target.2.cs", true)]
+ [Arguments("code.exe --diff file.a.b file.c.d", true)]
+ [Arguments("app.exe path.with.dots path.more.dots", true)]
+ public async Task MatchesPattern_WithTwoFilePaths_ReturnsTrue(string commandLine, bool expected)
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return;
}
- Assert.Equal(expected, WindowsProcess.MatchesPattern(commandLine));
+ await Assert.That(WindowsProcess.MatchesPattern(commandLine)).IsEqualTo(expected);
}
- [Theory]
- [InlineData("notepad.exe")]
- [InlineData(@"notepad.exe C:\temp\file.txt")]
- [InlineData("cmd.exe /c dir")]
- [InlineData("explorer.exe")]
- [InlineData("")]
- [InlineData("singleword")]
- [InlineData("app.exe onepath.with.dots")]
- public void MatchesPattern_WithoutTwoFilePaths_ReturnsFalse(string commandLine)
+ [Test]
+ [Arguments("notepad.exe")]
+ [Arguments(@"notepad.exe C:\temp\file.txt")]
+ [Arguments("cmd.exe /c dir")]
+ [Arguments("explorer.exe")]
+ [Arguments("")]
+ [Arguments("singleword")]
+ [Arguments("app.exe onepath.with.dots")]
+ public async Task MatchesPattern_WithoutTwoFilePaths_ReturnsFalse(string commandLine)
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return;
}
- Assert.False(WindowsProcess.MatchesPattern(commandLine));
+ await Assert.That(WindowsProcess.MatchesPattern(commandLine)).IsFalse();
}
- [Fact]
- public void FindAll_ReturnsProcessCommands()
+ [Test]
+ public async Task FindAll_ReturnsProcessCommands()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
@@ -46,15 +46,15 @@ public void FindAll_ReturnsProcessCommands()
}
var result = WindowsProcess.FindAll();
- Assert.NotNull(result);
+ await Assert.That(result).IsNotNull();
foreach (var cmd in result)
{
Debug.WriteLine($"{cmd.Process}: {cmd.Command}");
}
}
- [Fact]
- public void TryTerminateProcess_WithWindowedProcess_GracefullyCloses()
+ [Test]
+ public async Task TryTerminateProcess_WithWindowedProcess_GracefullyCloses()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
@@ -70,7 +70,7 @@ public void TryTerminateProcess_WithWindowedProcess_GracefullyCloses()
CreateNoWindow = true
});
- Assert.NotNull(process);
+ await Assert.That(process).IsNotNull();
try
{
@@ -80,10 +80,10 @@ public void TryTerminateProcess_WithWindowedProcess_GracefullyCloses()
// Attempt graceful termination via CloseMainWindow
var result = WindowsProcess.TryTerminateProcess(process.Id);
- Assert.True(result);
+ await Assert.That(result).IsTrue();
// Verify process exited gracefully
- Assert.True(process.WaitForExit(1000));
+ await Assert.That(process.WaitForExit(1000)).IsTrue();
}
finally
{
@@ -102,8 +102,8 @@ public void TryTerminateProcess_WithWindowedProcess_GracefullyCloses()
}
}
- [Fact]
- public void TryTerminateProcess_WithNonWindowedProcess_ForcefullyTerminates()
+ [Test]
+ public async Task TryTerminateProcess_WithNonWindowedProcess_ForcefullyTerminates()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
@@ -118,7 +118,7 @@ public void TryTerminateProcess_WithNonWindowedProcess_ForcefullyTerminates()
CreateNoWindow = true
});
- Assert.NotNull(process);
+ await Assert.That(process).IsNotNull();
try
{
@@ -128,10 +128,10 @@ public void TryTerminateProcess_WithNonWindowedProcess_ForcefullyTerminates()
// Attempt termination (should fall back to forceful kill since no main window)
var result = WindowsProcess.TryTerminateProcess(process.Id);
- Assert.True(result);
+ await Assert.That(result).IsTrue();
// Verify process was terminated (should be immediate with forceful kill)
- Assert.True(process.WaitForExit(1000));
+ await Assert.That(process.WaitForExit(1000)).IsTrue();
}
finally
{
@@ -150,8 +150,8 @@ public void TryTerminateProcess_WithNonWindowedProcess_ForcefullyTerminates()
}
}
- [Fact]
- public void TryTerminateProcess_WithInvalidProcessId_ReturnsFalse()
+ [Test]
+ public async Task TryTerminateProcess_WithInvalidProcessId_ReturnsFalse()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
@@ -161,6 +161,6 @@ public void TryTerminateProcess_WithInvalidProcessId_ReturnsFalse()
// Use a very unlikely process ID
var result = WindowsProcess.TryTerminateProcess(999999);
- Assert.False(result);
+ await Assert.That(result).IsFalse();
}
}
diff --git a/src/DiffEngine.slnx b/src/DiffEngine.slnx
index 2adaed3a..f74292d9 100644
--- a/src/DiffEngine.slnx
+++ b/src/DiffEngine.slnx
@@ -11,7 +11,7 @@
-
+
diff --git a/src/DiffEngine/BuildServerDetector.cs b/src/DiffEngine/BuildServerDetector.cs
index 980deae1..c0ce9bb6 100644
--- a/src/DiffEngine/BuildServerDetector.cs
+++ b/src/DiffEngine/BuildServerDetector.cs
@@ -106,4 +106,4 @@ public static bool Detected
get => overrideDetected.Value ?? detected;
set => overrideDetected.Value = value;
}
-}
\ No newline at end of file
+}
diff --git a/src/DiffEngineTray.Tests/AsyncTimerTests.cs b/src/DiffEngineTray.Tests/AsyncTimerTests.cs
index c35d2247..c811cf8a 100644
--- a/src/DiffEngineTray.Tests/AsyncTimerTests.cs
+++ b/src/DiffEngineTray.Tests/AsyncTimerTests.cs
@@ -1,6 +1,6 @@
public class AsyncTimerTests
{
- [Fact]
+ [Test]
public async Task It_calls_error_callback()
{
var errorCallbackInvoked = new TaskCompletionSource();
@@ -13,10 +13,10 @@ public async Task It_calls_error_callback()
errorCallbackInvoked.TrySetResult(true);
});
- Assert.True(await errorCallbackInvoked.Task);
+ await Assert.That(await errorCallbackInvoked.Task).IsTrue();
}
- [Fact]
+ [Test]
public async Task It_continues_to_run_after_an_error()
{
var callbackInvokedAfterError = new TaskCompletionSource();
@@ -24,7 +24,7 @@ public async Task It_continues_to_run_after_an_error()
var fail = true;
var exceptionThrown = false;
await using var timer = new AsyncTimer(
- callback: _ =>
+ callback: async _ =>
{
if (fail)
{
@@ -32,9 +32,8 @@ public async Task It_continues_to_run_after_an_error()
throw new("Simulated!");
}
- Assert.True(exceptionThrown);
+ await Assert.That(exceptionThrown).IsTrue();
callbackInvokedAfterError.TrySetResult(true);
- return Task.FromResult(0);
},
interval: TimeSpan.Zero,
errorCallback: _ =>
@@ -42,10 +41,10 @@ public async Task It_continues_to_run_after_an_error()
exceptionThrown = true;
});
- Assert.True(await callbackInvokedAfterError.Task);
+ await Assert.That(await callbackInvokedAfterError.Task).IsTrue();
}
- [Fact]
+ [Test]
public async Task Stop_cancels_token_while_in_callback()
{
var callbackCanceled = false;
@@ -67,10 +66,10 @@ public async Task Stop_cancels_token_while_in_callback()
var stopTask = timer.DisposeAsync();
stopInitiated.SetResult(true);
await stopTask;
- Assert.True(callbackCanceled);
+ await Assert.That(callbackCanceled).IsTrue();
}
- [Fact]
+ [Test]
public async Task Stop_waits_for_callback_to_complete()
{
var callbackCompleted = new TaskCompletionSource();
@@ -89,9 +88,9 @@ public async Task Stop_waits_for_callback_to_complete()
var delayTask = Task.Delay(1000);
var firstToComplete = await Task.WhenAny(stopTask, delayTask);
- Assert.Equal(delayTask, firstToComplete);
+ await Assert.That(firstToComplete).IsEqualTo(delayTask);
callbackCompleted.SetResult(true);
await stopTask;
}
-}
\ No newline at end of file
+}
diff --git a/src/DiffEngineTray.Tests/DiffEngineTray.Tests.csproj b/src/DiffEngineTray.Tests/DiffEngineTray.Tests.csproj
index 530d5f5e..8a0e234c 100644
--- a/src/DiffEngineTray.Tests/DiffEngineTray.Tests.csproj
+++ b/src/DiffEngineTray.Tests/DiffEngineTray.Tests.csproj
@@ -2,23 +2,23 @@
net10.0-windows
$(NoWarn);CA1416;NU1902
+ true
+ Exe
-
-
+
-
-
+
diff --git a/src/DiffEngineTray.Tests/GlobalUsings.cs b/src/DiffEngineTray.Tests/GlobalUsings.cs
index 591251d6..3b81dec8 100644
--- a/src/DiffEngineTray.Tests/GlobalUsings.cs
+++ b/src/DiffEngineTray.Tests/GlobalUsings.cs
@@ -1,2 +1,8 @@
-global using Xunit;
global using System.Diagnostics;
+
+[assembly: ParallelLimiter]
+
+public class SingleThreadedLimit : TUnit.Core.Interfaces.IParallelLimit
+{
+ public int Limit => 1;
+}
diff --git a/src/DiffEngineTray.Tests/HotKeyControlTests.cs b/src/DiffEngineTray.Tests/HotKeyControlTests.cs
index dbe81999..62093abf 100644
--- a/src/DiffEngineTray.Tests/HotKeyControlTests.cs
+++ b/src/DiffEngineTray.Tests/HotKeyControlTests.cs
@@ -1,7 +1,7 @@
#if DEBUG
public class HotKeyControlTests
{
- [Fact]
+ [Test]
public async Task WithKeys()
{
using var target = new HotKeyControl
@@ -15,7 +15,7 @@ public async Task WithKeys()
await Verify(target);
}
- [Fact]
+ [Test]
public async Task Default()
{
using var target = new HotKeyControl();
diff --git a/src/DiffEngineTray.Tests/ImagesTest.cs b/src/DiffEngineTray.Tests/ImagesTest.cs
index 342912c1..0c3e4a4a 100644
--- a/src/DiffEngineTray.Tests/ImagesTest.cs
+++ b/src/DiffEngineTray.Tests/ImagesTest.cs
@@ -1,53 +1,53 @@
public class ImagesTest
{
- [Fact]
- public void AllImagesLoaded()
+ [Test]
+ public async Task AllImagesLoaded()
{
// Verify all icon resources load correctly
- Assert.NotNull(Images.Active);
- Assert.NotNull(Images.Default);
+ await Assert.That(Images.Active).IsNotNull();
+ await Assert.That(Images.Default).IsNotNull();
// Verify all image resources load correctly
- Assert.NotNull(Images.Exit);
- Assert.NotNull(Images.Delete);
- Assert.NotNull(Images.AcceptAll);
- Assert.NotNull(Images.Accept);
- Assert.NotNull(Images.Discard);
- Assert.NotNull(Images.VisualStudio);
- Assert.NotNull(Images.Folder);
- Assert.NotNull(Images.Options);
- Assert.NotNull(Images.Link);
+ await Assert.That(Images.Exit).IsNotNull();
+ await Assert.That(Images.Delete).IsNotNull();
+ await Assert.That(Images.AcceptAll).IsNotNull();
+ await Assert.That(Images.Accept).IsNotNull();
+ await Assert.That(Images.Discard).IsNotNull();
+ await Assert.That(Images.VisualStudio).IsNotNull();
+ await Assert.That(Images.Folder).IsNotNull();
+ await Assert.That(Images.Options).IsNotNull();
+ await Assert.That(Images.Link).IsNotNull();
}
- [Fact]
- public void IconsHaveValidSize()
+ [Test]
+ public async Task IconsHaveValidSize()
{
- Assert.True(Images.Active.Width > 0);
- Assert.True(Images.Active.Height > 0);
- Assert.True(Images.Default.Width > 0);
- Assert.True(Images.Default.Height > 0);
+ await Assert.That(Images.Active.Width > 0).IsTrue();
+ await Assert.That(Images.Active.Height > 0).IsTrue();
+ await Assert.That(Images.Default.Width > 0).IsTrue();
+ await Assert.That(Images.Default.Height > 0).IsTrue();
}
- [Fact]
- public void ImagesHaveValidSize()
+ [Test]
+ public async Task ImagesHaveValidSize()
{
- Assert.True(Images.Exit.Width > 0);
- Assert.True(Images.Exit.Height > 0);
- Assert.True(Images.Delete.Width > 0);
- Assert.True(Images.Delete.Height > 0);
- Assert.True(Images.AcceptAll.Width > 0);
- Assert.True(Images.AcceptAll.Height > 0);
- Assert.True(Images.Accept.Width > 0);
- Assert.True(Images.Accept.Height > 0);
- Assert.True(Images.Discard.Width > 0);
- Assert.True(Images.Discard.Height > 0);
- Assert.True(Images.VisualStudio.Width > 0);
- Assert.True(Images.VisualStudio.Height > 0);
- Assert.True(Images.Folder.Width > 0);
- Assert.True(Images.Folder.Height > 0);
- Assert.True(Images.Options.Width > 0);
- Assert.True(Images.Options.Height > 0);
- Assert.True(Images.Link.Width > 0);
- Assert.True(Images.Link.Height > 0);
+ await Assert.That(Images.Exit.Width > 0).IsTrue();
+ await Assert.That(Images.Exit.Height > 0).IsTrue();
+ await Assert.That(Images.Delete.Width > 0).IsTrue();
+ await Assert.That(Images.Delete.Height > 0).IsTrue();
+ await Assert.That(Images.AcceptAll.Width > 0).IsTrue();
+ await Assert.That(Images.AcceptAll.Height > 0).IsTrue();
+ await Assert.That(Images.Accept.Width > 0).IsTrue();
+ await Assert.That(Images.Accept.Height > 0).IsTrue();
+ await Assert.That(Images.Discard.Width > 0).IsTrue();
+ await Assert.That(Images.Discard.Height > 0).IsTrue();
+ await Assert.That(Images.VisualStudio.Width > 0).IsTrue();
+ await Assert.That(Images.VisualStudio.Height > 0).IsTrue();
+ await Assert.That(Images.Folder.Width > 0).IsTrue();
+ await Assert.That(Images.Folder.Height > 0).IsTrue();
+ await Assert.That(Images.Options.Width > 0).IsTrue();
+ await Assert.That(Images.Options.Height > 0).IsTrue();
+ await Assert.That(Images.Link.Width > 0).IsTrue();
+ await Assert.That(Images.Link.Height > 0).IsTrue();
}
}
diff --git a/src/DiffEngineTray.Tests/MenuBuilderTest.cs b/src/DiffEngineTray.Tests/MenuBuilderTest.cs
index e7a9ebb5..b2dfbf38 100644
--- a/src/DiffEngineTray.Tests/MenuBuilderTest.cs
+++ b/src/DiffEngineTray.Tests/MenuBuilderTest.cs
@@ -1,5 +1,6 @@
using EmptyFiles;
+[TUnit.Core.Executors.STAThreadExecutor]
public class MenuBuilderTest :
IDisposable
{
@@ -7,7 +8,7 @@ public class MenuBuilderTest :
{
};
- [Fact]
+ [Test]
public async Task Empty()
{
await using var tracker = new RecordingTracker();
@@ -18,7 +19,7 @@ public async Task Empty()
await Verify(menu, settings);
}
- [Fact]
+ [Test]
public async Task OnlyMove()
{
await using var tracker = new RecordingTracker();
@@ -30,7 +31,7 @@ public async Task OnlyMove()
await Verify(menu, settings);
}
- [Fact]
+ [Test]
public async Task OnlyDelete()
{
await using var tracker = new RecordingTracker();
@@ -42,7 +43,7 @@ public async Task OnlyDelete()
await Verify(menu, settings);
}
- [Fact]
+ [Test]
public async Task Full()
{
await using var tracker = new RecordingTracker();
@@ -57,7 +58,7 @@ public async Task Full()
await Verify(menu, settings);
}
- [Fact]
+ [Test]
public async Task DiffTempTarget()
{
await using var tracker = new RecordingTracker();
@@ -71,7 +72,7 @@ public async Task DiffTempTarget()
await Verify(menu, settings);
}
- [Fact]
+ [Test]
public async Task Many()
{
await using var tracker = new RecordingTracker();
@@ -87,7 +88,7 @@ public async Task Many()
await Verify(menu, settings);
}
- [Fact]
+ [Test]
public async Task Grouped()
{
await using var tracker = new RecordingTracker();
@@ -100,7 +101,7 @@ public async Task Grouped()
await Verify(menu, settings);
}
- [Fact]
+ [Test]
public async Task FullGrouped()
{
await using var tracker = new RecordingTracker();
diff --git a/src/DiffEngineTray.Tests/OptionsFormTests.cs b/src/DiffEngineTray.Tests/OptionsFormTests.cs
index df6a3d55..53dee826 100644
--- a/src/DiffEngineTray.Tests/OptionsFormTests.cs
+++ b/src/DiffEngineTray.Tests/OptionsFormTests.cs
@@ -21,7 +21,7 @@ public OptionsFormTests() =>
// form.ShowDialog();
// form.BringToFront();
//}
- [Fact]
+ [Test]
public async Task WithKeys()
{
using var form = new OptionsForm(
@@ -37,7 +37,7 @@ public async Task WithKeys()
await Verify(form);
}
- [Fact]
+ [Test]
public async Task Default()
{
using var form = new OptionsForm(
diff --git a/src/DiffEngineTray.Tests/PiperTest.cs b/src/DiffEngineTray.Tests/PiperTest.cs
index 66ba364d..f72191a4 100644
--- a/src/DiffEngineTray.Tests/PiperTest.cs
+++ b/src/DiffEngineTray.Tests/PiperTest.cs
@@ -16,7 +16,7 @@ public void Dispose()
listener.Dispose();
}
- [Fact]
+ [Test]
public Task MoveJson() =>
Verify(
PiperClient.BuildMovePayload(
@@ -27,7 +27,7 @@ public Task MoveJson() =>
true,
1000));
- [Fact]
+ [Test]
public Task DeleteJson() =>
Verify(
PiperClient.BuildMovePayload(
@@ -38,7 +38,7 @@ public Task DeleteJson() =>
true,
1000));
- [Fact]
+ [Test]
public async Task Delete()
{
DeletePayload received = null!;
@@ -51,7 +51,7 @@ public async Task Delete()
await Verify(received);
}
- [Fact]
+ [Test]
public async Task Move()
{
MovePayload received = null!;
@@ -64,7 +64,7 @@ public async Task Move()
await Verify(received);
}
- [Fact]
+ [Test]
public async Task SendOnly()
{
var file = Path.GetFullPath("temp.txt");
diff --git a/src/DiffEngineTray.Tests/ProcessExTest.cs b/src/DiffEngineTray.Tests/ProcessExTest.cs
index ff9e8d95..cdba52d7 100644
--- a/src/DiffEngineTray.Tests/ProcessExTest.cs
+++ b/src/DiffEngineTray.Tests/ProcessExTest.cs
@@ -1,18 +1,17 @@
public class ProcessExTest
{
- [Fact]
- public void TryGet()
+ [Test]
+ public async Task TryGet()
{
using var current = Process.GetCurrentProcess();
- Assert.True(ProcessEx.TryGet(current.Id, out var found));
- Assert.NotNull(found);
- found.Dispose();
+ await Assert.That(ProcessEx.TryGet(current.Id, out var found)).IsTrue();
+ found!.Dispose();
}
- [Fact]
- public void TryGetMissing()
+ [Test]
+ public async Task TryGetMissing()
{
- Assert.False(ProcessEx.TryGet(40000, out var found));
- Assert.Null(found);
+ await Assert.That(ProcessEx.TryGet(40000, out var found)).IsFalse();
+ await Assert.That(found).IsNull();
}
-}
\ No newline at end of file
+}
diff --git a/src/DiffEngineTray.Tests/RecordingTracker.cs b/src/DiffEngineTray.Tests/RecordingTracker.cs
index 928f5091..64155ec7 100644
--- a/src/DiffEngineTray.Tests/RecordingTracker.cs
+++ b/src/DiffEngineTray.Tests/RecordingTracker.cs
@@ -7,10 +7,10 @@
{
})
{
- public void AssertEmpty()
+ public async Task AssertEmpty()
{
- Assert.Empty(Deletes);
- Assert.Empty(Moves);
- Assert.False(TrackingAny);
+ await Assert.That(Deletes).IsEmpty();
+ await Assert.That(Moves).IsEmpty();
+ await Assert.That(TrackingAny).IsFalse();
}
-}
\ No newline at end of file
+}
diff --git a/src/DiffEngineTray.Tests/SolutionDirectoryFinderTests.cs b/src/DiffEngineTray.Tests/SolutionDirectoryFinderTests.cs
index c6292a64..44d924db 100644
--- a/src/DiffEngineTray.Tests/SolutionDirectoryFinderTests.cs
+++ b/src/DiffEngineTray.Tests/SolutionDirectoryFinderTests.cs
@@ -4,7 +4,7 @@ public class SolutionDirectoryFinderTests
static string SourceFile { get; } = GetSourceFile();
static string GetSourceFile([CallerFilePath] string path = "") => path;
- [Fact]
+ [Test]
public Task Find() =>
Verify(SolutionDirectoryFinder.Find(SourceFile));
}
diff --git a/src/DiffEngineTray.Tests/TrackerClearTest.cs b/src/DiffEngineTray.Tests/TrackerClearTest.cs
index b4d303e9..b09c7d52 100644
--- a/src/DiffEngineTray.Tests/TrackerClearTest.cs
+++ b/src/DiffEngineTray.Tests/TrackerClearTest.cs
@@ -1,14 +1,14 @@
public class TrackerClearTest :
IDisposable
{
- [Fact]
+ [Test]
public async Task Simple()
{
await using var tracker = new RecordingTracker();
tracker.AddDelete(file1);
tracker.AddMove(file2, file2, "theExe", "theArguments", true, null);
tracker.Clear();
- tracker.AssertEmpty();
+ await tracker.AssertEmpty();
}
public void Dispose()
diff --git a/src/DiffEngineTray.Tests/TrackerDeleteTest.cs b/src/DiffEngineTray.Tests/TrackerDeleteTest.cs
index edcc6bcd..5c320c47 100644
--- a/src/DiffEngineTray.Tests/TrackerDeleteTest.cs
+++ b/src/DiffEngineTray.Tests/TrackerDeleteTest.cs
@@ -1,82 +1,83 @@
+
public class TrackerDeleteTest :
IDisposable
{
- [Fact]
+ [Test]
public async Task AddSingle()
{
await using var tracker = new RecordingTracker();
tracker.AddDelete(file1);
- Assert.Single(tracker.Deletes);
- Assert.True(tracker.TrackingAny);
+ await Assert.That(tracker.Deletes).HasSingleItem();
+ await Assert.That(tracker.TrackingAny).IsTrue();
}
- [Fact]
+ [Test]
public async Task AddSingle_BackgroundDelete()
{
await using var tracker = new RecordingTracker();
tracker.AddDelete(file1);
File.Delete(file1);
Thread.Sleep(5000);
- tracker.AssertEmpty();
+ await tracker.AssertEmpty();
}
- [Fact]
+ [Test]
public async Task AddMultiple()
{
await using var tracker = new RecordingTracker();
tracker.AddDelete(file1);
tracker.AddDelete(file2);
- Assert.Equal(2, tracker.Deletes.Count);
- Assert.True(tracker.TrackingAny);
+ await Assert.That(tracker.Deletes.Count).IsEqualTo(2);
+ await Assert.That(tracker.TrackingAny).IsTrue();
}
- [Fact]
+ [Test]
public async Task AddSame()
{
await using var tracker = new RecordingTracker();
tracker.AddDelete(file1);
tracker.AddDelete(file1);
- Assert.Single(tracker.Deletes);
- Assert.True(tracker.TrackingAny);
+ await Assert.That(tracker.Deletes).HasSingleItem();
+ await Assert.That(tracker.TrackingAny).IsTrue();
}
- [Fact]
+ [Test]
public async Task AcceptAllSingle()
{
await using var tracker = new RecordingTracker();
tracker.AddDelete(file1);
tracker.AcceptAll();
- tracker.AssertEmpty();
+ await tracker.AssertEmpty();
}
- [Fact]
+ [Test]
public async Task AcceptAllMultiple()
{
await using var tracker = new RecordingTracker();
tracker.AddDelete(file1);
tracker.AddDelete(file2);
tracker.AcceptAll();
- tracker.AssertEmpty();
+ await tracker.AssertEmpty();
}
- [Fact]
+ [Test]
public async Task AcceptSingle()
{
await using var tracker = new RecordingTracker();
var tracked = tracker.AddDelete(file1);
tracker.Accept(tracked);
- tracker.AssertEmpty();
+ await tracker.AssertEmpty();
}
- [Fact]
+ [Test]
public async Task AcceptSingle_NotEmpty()
{
await using var tracker = new RecordingTracker();
var tracked = tracker.AddDelete(file1);
tracker.AddDelete(file2);
tracker.Accept(tracked);
- Assert.Single(tracker.Deletes);
- Assert.True(tracker.TrackingAny);
+ await Assert.That(tracker.Deletes).HasSingleItem();
+ await Assert.That(tracker.TrackingAny).IsTrue();
}
public void Dispose()
diff --git a/src/DiffEngineTray.Tests/TrackerMoveTest.cs b/src/DiffEngineTray.Tests/TrackerMoveTest.cs
index f64504f0..3040482f 100644
--- a/src/DiffEngineTray.Tests/TrackerMoveTest.cs
+++ b/src/DiffEngineTray.Tests/TrackerMoveTest.cs
@@ -1,26 +1,26 @@
public class TrackerMoveTest :
IDisposable
{
- [Fact]
+ [Test]
public async Task AddSingle()
{
await using var tracker = new RecordingTracker();
tracker.AddMove(file1, file1, "theExe", "theArguments", true, null);
- Assert.Single(tracker.Moves);
- Assert.True(tracker.TrackingAny);
+ await Assert.That(tracker.Moves).HasSingleItem();
+ await Assert.That(tracker.TrackingAny).IsTrue();
}
- [Fact]
+ [Test]
public async Task AddMultiple()
{
await using var tracker = new RecordingTracker();
tracker.AddMove(file1, file1, "theExe", "theArguments", true, null);
tracker.AddMove(file2, file2, "theExe", "theArguments", true, null);
- Assert.Equal(2, tracker.Moves.Count);
- Assert.True(tracker.TrackingAny);
+ await Assert.That(tracker.Moves.Count).IsEqualTo(2);
+ await Assert.That(tracker.TrackingAny).IsTrue();
}
- [Fact]
+ [Test]
public async Task AddSame()
{
await using var tracker = new RecordingTracker();
@@ -28,37 +28,37 @@ public async Task AddSame()
using var process = Process.GetCurrentProcess();
var processId = process.Id;
var tracked = tracker.AddMove(file1, file1, "theExe", "theArguments", false, processId);
- Assert.Single(tracker.Moves);
- Assert.Equal(process.Id, tracked.Process!.Id);
- Assert.True(tracker.TrackingAny);
+ await Assert.That(tracker.Moves).HasSingleItem();
+ await Assert.That(tracked.Process!.Id).IsEqualTo(process.Id);
+ await Assert.That(tracker.TrackingAny).IsTrue();
}
- [Fact]
+ [Test]
public async Task AcceptAllSingle()
{
await using var tracker = new RecordingTracker();
tracker.AddMove(file1, file1, "theExe", "theArguments", true, null);
tracker.AcceptAll();
- tracker.AssertEmpty();
+ await tracker.AssertEmpty();
}
- [Fact]
+ [Test]
public async Task AcceptAllMultiple()
{
await using var tracker = new RecordingTracker();
tracker.AddMove(file1, file1, "theExe", "theArguments", true, null);
tracker.AddMove(file2, file2, "theExe", "theArguments", true, null);
tracker.AcceptAll();
- tracker.AssertEmpty();
+ await tracker.AssertEmpty();
}
- [Fact]
+ [Test]
public async Task AcceptSingle()
{
await using var tracker = new RecordingTracker();
var tracked = tracker.AddMove(file1, file1, "theExe", "theArguments", true, null);
tracker.Accept(tracked);
- tracker.AssertEmpty();
+ await tracker.AssertEmpty();
}
// [Fact]
@@ -71,7 +71,7 @@ public async Task AcceptSingle()
// tracker.AssertEmpty();
// }
- [Fact]
+ [Test]
public async Task AddSingle_BackgroundDeleteTarget()
{
await using var tracker = new RecordingTracker();
@@ -80,19 +80,19 @@ public async Task AddSingle_BackgroundDeleteTarget()
Thread.Sleep(3000);
// many diff tools do not require a target.
// so the non exist of a target file should not flush that item
- Assert.Single(tracker.Moves);
- Assert.True(tracker.TrackingAny);
+ await Assert.That(tracker.Moves).HasSingleItem();
+ await Assert.That(tracker.TrackingAny).IsTrue();
}
- [Fact]
+ [Test]
public async Task AcceptSingle_NotEmpty()
{
await using var tracker = new RecordingTracker();
var tracked = tracker.AddMove(file1, file1, "theExe", "theArguments", true, null);
tracker.AddMove(file2, file2, "theExe", "theArguments", true, null);
tracker.Accept(tracked);
- Assert.Single(tracker.Moves);
- Assert.True(tracker.TrackingAny);
+ await Assert.That(tracker.Moves).HasSingleItem();
+ await Assert.That(tracker.TrackingAny).IsTrue();
}
public void Dispose()
diff --git a/src/DiffEngineTray.Tests/VersionReaderTest.cs b/src/DiffEngineTray.Tests/VersionReaderTest.cs
index fe3de582..507df66b 100644
--- a/src/DiffEngineTray.Tests/VersionReaderTest.cs
+++ b/src/DiffEngineTray.Tests/VersionReaderTest.cs
@@ -1,9 +1,9 @@
public class VersionReaderTest
{
- [Fact]
- public void AddSingle()
+ [Test]
+ public async Task AddSingle()
{
- Assert.NotEmpty(VersionReader.VersionString);
- Assert.NotNull(VersionReader.VersionString);
+ await Assert.That(VersionReader.VersionString).IsNotEmpty();
+ await Assert.That(VersionReader.VersionString).IsNotNull();
}
-}
\ No newline at end of file
+}
diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props
index 0cdf9fe4..fd99bac3 100644
--- a/src/Directory.Packages.props
+++ b/src/Directory.Packages.props
@@ -8,7 +8,6 @@
-
@@ -17,11 +16,10 @@
-
-
-
+
+