Skip to content

Commit ec800ff

Browse files
authored
Update to xunit v3
1 parent 85316ba commit ec800ff

File tree

8 files changed

+16
-18
lines changed

8 files changed

+16
-18
lines changed

Directory.Packages.props

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,12 @@
3838
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
3939
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="9.0.0" />
4040
<PackageVersion Include="Validation" Version="2.5.51" />
41-
<PackageVersion Include="Xunit.Combinatorial" Version="1.6.24" />
42-
<PackageVersion Include="Xunit.SkippableFact" Version="1.5.23" />
41+
<PackageVersion Include="Xunit.Combinatorial" Version="2.0.24" />
4342
</ItemGroup>
4443
<ItemGroup Label="Library.Template">
4544
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
4645
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2" />
47-
<PackageVersion Include="xunit" Version="2.9.2" />
46+
<PackageVersion Include="xunit.v3" Version="1.1.0" />
4847
</ItemGroup>
4948
<ItemGroup>
5049
<!-- Put repo-specific GlobalPackageReference items in this group. -->

test/Cake.GitVersioning.Tests/Cake.GitVersioning.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<PackageReference Include="Microsoft.NET.Test.Sdk" />
1919
<PackageReference Include="Nerdbank.GitVersioning.LKG" />
2020
<PackageReference Include="xunit.runner.visualstudio" />
21-
<PackageReference Include="xunit" />
21+
<PackageReference Include="xunit.v3" />
2222
</ItemGroup>
2323

2424
</Project>

test/Nerdbank.GitVersioning.Tests/AssemblyInfoTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
public class AssemblyInfoTest : IClassFixture<MSBuildFixture> // The MSBuildFixture throws PlatformNotSupportedException when run on mono.
1515
{
16-
[SkippableTheory(typeof(PlatformNotSupportedException))]
16+
[Theory]
1717
[InlineData(false)]
1818
[InlineData(true)]
1919
[InlineData(null)]
@@ -91,7 +91,7 @@ type internal ThisAssembly() =
9191
Assert.Equal(expected, built);
9292
}
9393

94-
[SkippableTheory(typeof(PlatformNotSupportedException))]
94+
[Theory]
9595
[InlineData(null, "MyRootNamespace")]
9696
[InlineData("", "MyRootNamespace")]
9797
[InlineData("MyCustomNamespace", null)]
@@ -152,7 +152,7 @@ type internal ThisAssembly() =
152152
Assert.Equal(expected, built);
153153
}
154154

155-
[SkippableTheory(typeof(PlatformNotSupportedException))]
155+
[Theory]
156156
[InlineData(false)]
157157
[InlineData(true)]
158158
[InlineData(null)]
@@ -228,7 +228,7 @@ internal static partial class ThisAssembly {{
228228
Assert.Equal(expected, built);
229229
}
230230

231-
[SkippableTheory(typeof(PlatformNotSupportedException))]
231+
[Theory]
232232
[InlineData(null, "MyRootNamespace")]
233233
[InlineData("", "MyRootNamespace")]
234234
[InlineData("MyCustomNamespace", null)]
@@ -286,7 +286,7 @@ internal static partial class ThisAssembly {{
286286
Assert.Equal(expected, built);
287287
}
288288

289-
[SkippableTheory(typeof(PlatformNotSupportedException))]
289+
[Theory]
290290
[InlineData(false)]
291291
[InlineData(true)]
292292
[InlineData(null)]
@@ -342,7 +342,7 @@ End Class
342342
Assert.Equal(expected, built);
343343
}
344344

345-
[SkippableTheory(typeof(PlatformNotSupportedException))]
345+
[Theory]
346346
[InlineData(null, "MyRootNamespace")]
347347
[InlineData("", "MyRootNamespace")]
348348
[InlineData("MyCustomNamespace", null)]

test/Nerdbank.GitVersioning.Tests/BuildIntegrationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ public async Task AssemblyInfo_HasKeyData(string keyFile, bool delaySigned)
191191
result.BuildResult.ProjectStateAfterBuild.GetPropertyValue("VersionSourceFile"))));
192192
this.Logger.WriteLine(versionCsContent);
193193

194-
SyntaxTree sourceFile = CSharpSyntaxTree.ParseText(versionCsContent);
195-
SyntaxNode syntaxTree = await sourceFile.GetRootAsync();
194+
SyntaxTree sourceFile = CSharpSyntaxTree.ParseText(versionCsContent, cancellationToken: TestContext.Current.CancellationToken);
195+
SyntaxNode syntaxTree = await sourceFile.GetRootAsync(TestContext.Current.CancellationToken);
196196
IEnumerable<VariableDeclaratorSyntax> fields = syntaxTree.DescendantNodes().OfType<VariableDeclaratorSyntax>();
197197

198198
var publicKeyField = (LiteralExpressionSyntax)fields.SingleOrDefault(f => f.Identifier.ValueText == "PublicKey")?.Initializer.Value;

test/Nerdbank.GitVersioning.Tests/GitContextTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ public void SelectCommitByPartialId(bool fromPack, bool oddLength)
9393
Assert.Equal(this.LibGit2Repository.Head.Tip.Sha, this.Context.GitCommitId);
9494
}
9595

96-
[SkippableTheory]
96+
[Theory]
9797
[InlineData(4)]
9898
[InlineData(7)]
9999
[InlineData(8)]
100100
[InlineData(11)]
101101
public void GetShortUniqueCommitId(int length)
102102
{
103-
Skip.If(length < 7 && this.Context is Nerdbank.GitVersioning.LibGit2.LibGit2Context, "LibGit2Sharp never returns commit IDs with fewer than 7 characters.");
103+
Assert.SkipWhen(length < 7 && this.Context is Nerdbank.GitVersioning.LibGit2.LibGit2Context, "LibGit2Sharp never returns commit IDs with fewer than 7 characters.");
104104
Assert.Equal(this.Context.GitCommitId.Substring(0, length), this.Context.GetShortUniqueCommitId(length));
105105
}
106106

test/Nerdbank.GitVersioning.Tests/LibGit2GitExtensionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ public void GetIdAsVersion_MigrationFromVersionTxtToJson()
467467
public void TestBiggerRepo()
468468
{
469469
string testBiggerRepoPath = @"D:\git\Nerdbank.GitVersioning";
470-
Skip.If(!Directory.Exists(testBiggerRepoPath), $"{testBiggerRepoPath} does not exist.");
470+
Assert.SkipWhen(!Directory.Exists(testBiggerRepoPath), $"{testBiggerRepoPath} does not exist.");
471471

472472
using var largeRepo = new Repository(testBiggerRepoPath);
473473
foreach (Commit commit in largeRepo.Head.Commits)

test/Nerdbank.GitVersioning.Tests/Nerdbank.GitVersioning.Tests.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@
4444
<PackageReference Include="System.Memory" />
4545
<PackageReference Include="System.Threading.Tasks.Dataflow" />
4646
<PackageReference Include="Xunit.Combinatorial" />
47-
<PackageReference Include="Xunit.SkippableFact" />
4847
<PackageReference Include="xunit.runner.visualstudio" />
49-
<PackageReference Include="xunit" />
48+
<PackageReference Include="xunit.v3" />
5049
</ItemGroup>
5150
</Project>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// Copyright (c) .NET Foundation and Contributors. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
global using Xunit.Abstractions;
4+
global using Xunit;

0 commit comments

Comments
 (0)