Skip to content

Commit d6986c8

Browse files
committed
Merge branch 'main' into handle-test-cancellation
2 parents 792096a + ac3f1dc commit d6986c8

39 files changed

+430
-420
lines changed

appveyor.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ build_script:
99
- pwsh: |
1010
if ($isWindows) {
1111
Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile "./dotnet-install.ps1"
12-
./dotnet-install.ps1 -JSonFile src/global.json -Architecture x64 -InstallDir 'C:\Program Files\dotnet'
12+
./dotnet-install.ps1 -JSonFile global.json -Architecture x64 -InstallDir 'C:\Program Files\dotnet'
1313
dotnet build src --configuration Release
14-
dotnet test src --configuration Release --no-build --no-restore
14+
dotnet test --solution src/DiffEngine.slnx --configuration Release --no-build --no-restore
1515
dotnet publish src/DiffEngine.AotTests/DiffEngine.AotTests.csproj --configuration Release
1616
}
1717
else {
1818
Invoke-WebRequest "https://dot.net/v1/dotnet-install.sh" -OutFile "./dotnet-install.sh"
1919
sudo chmod u+x dotnet-install.sh
2020
if ($isMacOS) {
21-
sudo ./dotnet-install.sh --jsonfile src/global.json --architecture x64 --install-dir '/usr/local/share/dotnet'
21+
sudo ./dotnet-install.sh --jsonfile global.json --architecture x64 --install-dir '/usr/local/share/dotnet'
2222
} else {
23-
sudo ./dotnet-install.sh --jsonfile src/global.json --architecture x64 --install-dir '/usr/share/dotnet'
23+
sudo ./dotnet-install.sh --jsonfile global.json --architecture x64 --install-dir '/usr/share/dotnet'
2424
}
2525
dotnet build src --configuration Release-NotWindows
26-
dotnet test src --configuration Release-NotWindows --no-build --no-restore
26+
dotnet test --solution src/DiffEngine.slnx --configuration Release-NotWindows --no-build --no-restore
2727
dotnet publish src/DiffEngine.AotTests/DiffEngine.AotTests.csproj --configuration Release-NotWindows
2828
}
2929
on_failure:

claude.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
1313
dotnet build src --configuration Release
1414

1515
# Run all tests
16-
dotnet test src --configuration Release
16+
dotnet test --project src/DiffEngine.Tests --configuration Release
17+
dotnet test --project src/DiffEngineTray.Tests --configuration Release
1718

18-
# Run a single test file
19-
dotnet test src/DiffEngine.Tests --filter "FullyQualifiedName~ClassName"
19+
# Run a single test project with filter
20+
dotnet test --project src/DiffEngine.Tests --configuration Release --filter "FullyQualifiedName~ClassName"
2021

2122
# Run a specific test
22-
dotnet test src/DiffEngine.Tests --filter "FullyQualifiedName=DiffEngine.Tests.ClassName.TestMethod"
23+
dotnet test --project src/DiffEngine.Tests --configuration Release --filter "FullyQualifiedName=DiffEngine.Tests.ClassName.TestMethod"
2324
```
2425

2526
**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
6667
- Tool discovery uses wildcard path matching (`WildcardFileFinder`) to find executables in common install locations
6768
- Tool order can be customized via `DiffEngine_ToolOrder` environment variable
6869
- `DisabledChecker` respects `DiffEngine_Disabled` env var
69-
- Tests use xUnit and Verify for snapshot testing
70+
- Tests use TUnit and Verify for snapshot testing

docs/diff-tool.custom.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ New tools are added to the top of the order, the last tool added will resolve be
5353
```cs
5454
await DiffRunner.LaunchAsync(tempFile, targetFile);
5555
```
56-
<sup><a href='/src/DiffEngine.Tests/DiffRunnerTests.cs#L65-L69' title='Snippet source file'>snippet source</a> | <a href='#snippet-DiffRunnerLaunch' title='Start of snippet'>anchor</a></sup>
56+
<sup><a href='/src/DiffEngine.Tests/DiffRunnerTests.cs#L67-L71' title='Snippet source file'>snippet source</a> | <a href='#snippet-DiffRunnerLaunch' title='Start of snippet'>anchor</a></sup>
5757
<!-- endSnippet -->
5858

5959
Alternatively the instance returned from `AddTool*` can be used to explicitly launch that tool.

src/global.json renamed to global.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@
33
"version": "10.0.102",
44
"allowPrerelease": true,
55
"rollForward": "latestFeature"
6+
},
7+
"test": {
8+
"runner": "Microsoft.Testing.Platform"
69
}
710
}

readme.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ A tool can be launched using the following:
100100
```cs
101101
await DiffRunner.LaunchAsync(tempFile, targetFile);
102102
```
103-
<sup><a href='/src/DiffEngine.Tests/DiffRunnerTests.cs#L65-L69' title='Snippet source file'>snippet source</a> | <a href='#snippet-DiffRunnerLaunch' title='Start of snippet'>anchor</a></sup>
103+
<sup><a href='/src/DiffEngine.Tests/DiffRunnerTests.cs#L67-L71' title='Snippet source file'>snippet source</a> | <a href='#snippet-DiffRunnerLaunch' title='Start of snippet'>anchor</a></sup>
104104
<!-- endSnippet -->
105105

106106
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:
115115
```cs
116116
DiffRunner.Kill(file1, file2);
117117
```
118-
<sup><a href='/src/DiffEngine.Tests/DiffRunnerTests.cs#L78-L82' title='Snippet source file'>snippet source</a> | <a href='#snippet-DiffRunnerKill' title='Start of snippet'>anchor</a></sup>
118+
<sup><a href='/src/DiffEngine.Tests/DiffRunnerTests.cs#L81-L85' title='Snippet source file'>snippet source</a> | <a href='#snippet-DiffRunnerKill' title='Start of snippet'>anchor</a></sup>
119119
<!-- endSnippet -->
120120

121121
Note that this method will respect the above [difference behavior](/docs/diff-tool.md#detected-difference-behavior) in terms of MDI behavior.
@@ -170,37 +170,37 @@ var isAppVeyor = BuildServerDetector.IsAppVeyor;
170170
<!-- snippet: BuildServerDetectorDetectedOverride -->
171171
<a id='snippet-BuildServerDetectorDetectedOverride'></a>
172172
```cs
173-
[Fact]
173+
[Test]
174174
public async Task SetDetectedPersistsInAsyncContext()
175175
{
176176
var original = BuildServerDetector.Detected;
177177
try
178178
{
179179
BuildServerDetector.Detected = true;
180-
Assert.True(BuildServerDetector.Detected);
180+
await Assert.That(BuildServerDetector.Detected).IsTrue();
181181

182182
await Task.Delay(1);
183183

184-
Assert.True(BuildServerDetector.Detected);
184+
await Assert.That(BuildServerDetector.Detected).IsTrue();
185185
}
186186
finally
187187
{
188188
BuildServerDetector.Detected = original;
189189
}
190190
}
191191

192-
[Fact]
192+
[Test]
193193
public async Task SetDetectedDoesNotLeakToOtherContexts()
194194
{
195195
var parentValue = BuildServerDetector.Detected;
196196

197-
await Task.Run(() =>
197+
await Task.Run(async () =>
198198
{
199199
BuildServerDetector.Detected = true;
200-
Assert.True(BuildServerDetector.Detected);
200+
await Assert.That(BuildServerDetector.Detected).IsTrue();
201201
});
202202

203-
Assert.Equal(parentValue, BuildServerDetector.Detected);
203+
await Assert.That(BuildServerDetector.Detected).IsEqualTo(parentValue);
204204
}
205205
```
206206
<sup><a href='/src/DiffEngine.Tests/BuildServerDetectorTest.cs#L27-L62' title='Snippet source file'>snippet source</a> | <a href='#snippet-BuildServerDetectorDetectedOverride' title='Start of snippet'>anchor</a></sup>

src/DiffEngine.Tests/AiCliDetectorTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
public class AiCliDetectorTest
22
{
3-
[Fact]
3+
[Test]
44
public void Props()
55
{
66
// ReSharper disable UnusedVariable
@@ -16,4 +16,4 @@ public void Props()
1616

1717
// ReSharper restore UnusedVariable
1818
}
19-
}
19+
}

src/DiffEngine.Tests/BuildServerDetectorTest.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
public class BuildServerDetectorTest
22
{
3-
[Fact]
3+
[Test]
44
public void Props()
55
{
66
// ReSharper disable UnusedVariable
@@ -26,37 +26,37 @@ public void Props()
2626

2727
#region BuildServerDetectorDetectedOverride
2828

29-
[Fact]
29+
[Test]
3030
public async Task SetDetectedPersistsInAsyncContext()
3131
{
3232
var original = BuildServerDetector.Detected;
3333
try
3434
{
3535
BuildServerDetector.Detected = true;
36-
Assert.True(BuildServerDetector.Detected);
36+
await Assert.That(BuildServerDetector.Detected).IsTrue();
3737

3838
await Task.Delay(1);
3939

40-
Assert.True(BuildServerDetector.Detected);
40+
await Assert.That(BuildServerDetector.Detected).IsTrue();
4141
}
4242
finally
4343
{
4444
BuildServerDetector.Detected = original;
4545
}
4646
}
4747

48-
[Fact]
48+
[Test]
4949
public async Task SetDetectedDoesNotLeakToOtherContexts()
5050
{
5151
var parentValue = BuildServerDetector.Detected;
5252

53-
await Task.Run(() =>
53+
await Task.Run(async () =>
5454
{
5555
BuildServerDetector.Detected = true;
56-
Assert.True(BuildServerDetector.Detected);
56+
await Assert.That(BuildServerDetector.Detected).IsTrue();
5757
});
5858

59-
Assert.Equal(parentValue, BuildServerDetector.Detected);
59+
await Assert.That(BuildServerDetector.Detected).IsEqualTo(parentValue);
6060
}
6161

6262
#endregion

src/DiffEngine.Tests/DefinitionsTest.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ public class DefinitionsTest
33
static string SourceDirectory { get; } = Path.GetDirectoryName(GetSourceFile())!;
44
static string GetSourceFile([CallerFilePath] string path = "") => path;
55

6-
[Fact]
6+
[Test]
77
public void WriteList()
88
{
99
var md = Path.Combine(SourceDirectory, "diffToolList.include.md");
@@ -16,10 +16,10 @@ public void WriteList()
1616
}
1717
}
1818

19-
[Fact]
20-
public void EnvironmentVariablesShouldBeUnique()
19+
[Test]
20+
public async Task EnvironmentVariablesShouldBeUnique()
2121
{
22-
static void FindDuplicates(Func<OsSupport, OsSettings?> selectOs)
22+
static async Task FindDuplicates(Func<OsSupport, OsSettings?> selectOs)
2323
{
2424
var findDuplicates = Definitions.Tools
2525
.Select(_ => _.OsSupport)
@@ -28,13 +28,13 @@ static void FindDuplicates(Func<OsSupport, OsSettings?> selectOs)
2828
.GroupBy(_ => _);
2929
foreach (var group in findDuplicates)
3030
{
31-
Assert.Single(group);
31+
await Assert.That(group).HasSingleItem();
3232
}
3333
}
3434

35-
FindDuplicates(_ => _.Windows);
36-
FindDuplicates(_ => _.Osx);
37-
FindDuplicates(_ => _.Linux);
35+
await FindDuplicates(_ => _.Windows);
36+
await FindDuplicates(_ => _.Osx);
37+
await FindDuplicates(_ => _.Linux);
3838
}
3939

4040
static void AddToolLink(TextWriter writer, Definition tool)
@@ -65,7 +65,7 @@ static string GetOsSupport(OsSupport osSupport)
6565
return builder.ToString();
6666
}
6767

68-
[Fact]
68+
[Test]
6969
public void WriteDefaultOrder()
7070
{
7171
var md = Path.Combine(SourceDirectory, "defaultOrder.include.md");
@@ -78,7 +78,7 @@ public void WriteDefaultOrder()
7878
}
7979
}
8080

81-
[Fact]
81+
[Test]
8282
public void WriteFoundTools()
8383
{
8484
var md = Path.Combine(SourceDirectory, "diffTools.include.md");
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
21
<Project Sdk="Microsoft.NET.Sdk">
32
<PropertyGroup>
4-
<TargetFrameworks>net10.0</TargetFrameworks>
3+
<TargetFramework>net10.0</TargetFramework>
54
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net10.0;net48</TargetFrameworks>
65
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
76
<NoWarn>$(NoWarn);SYSLIB0012</NoWarn>
7+
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
8+
<OutputType>Exe</OutputType>
89
</PropertyGroup>
910
<ItemGroup>
1011
<Using Include="DiffEngine" />
1112
<PackageReference Include="MarkdownSnippets.MsBuild" PrivateAssets="all" />
12-
<PackageReference Include="Microsoft.NET.Test.Sdk" />
1313
<PackageReference Include="Argon" />
14-
<PackageReference Include="Xunit" />
15-
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" />
1614
<PackageReference Include="ProjectDefaults" PrivateAssets="all" />
1715
<ProjectReference Include="..\DiffEngine\DiffEngine.csproj" />
1816
<Compile Remove="DefinitionsTest.cs" Condition="'$(TargetFramework)' == 'net9.0'" />
17+
<PackageReference Include="TUnit" />
1918
</ItemGroup>
20-
</Project>
19+
</Project>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma warning disable CS0618 // Type or member is obsolete
22
public class DiffEngineTrayTest
33
{
4-
[Fact]
5-
public void IsRunning() =>
6-
Assert.False(DiffEngineTray.IsRunning);
4+
[Test]
5+
public async Task IsRunning() =>
6+
await Assert.That(DiffEngineTray.IsRunning).IsFalse();
77
}

0 commit comments

Comments
 (0)