Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/execute-pipeline/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ inputs:
netversion:
description: 'Net version'
required: false
default: 'net9.0'
default: 'net10.0'

runs:
using: "composite"
Expand Down
14 changes: 13 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,16 @@
<None Include="$(MSBuildThisFileDirectory)assets/logo.jpg" Pack="true" PackagePath="\" />
</ItemGroup>

</Project>
<PropertyGroup>
<PolyUseEmbeddedAttribute>true</PolyUseEmbeddedAttribute>
</PropertyGroup>

<!-- Include Polyfill for all target frameworks in internal projects -->
<ItemGroup>
<PackageReference Include="Polyfill">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<PackageVersion Include="OneOf" Version="3.0.271" />
<PackageVersion Include="OneOf.SourceGenerator" Version="3.0.271" />
<PackageVersion Include="Polly" Version="8.6.4" />
<PackageVersion Include="Polyfill" Version="8.9.1" />
<PackageVersion Include="Polyfill" Version="9.0.1" />
<PackageVersion Include="PublicApiGenerator" Version="11.5.0" />
<PackageVersion Include="RandomDataGenerator.Net" Version="1.0.19.1" />
<PackageVersion Include="Shouldly" Version="4.3.0" />
Expand Down
12 changes: 2 additions & 10 deletions Polyfill.targets
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
<Project>
<PropertyGroup Condition="'$(EnableTUnitPolyfills)' != 'false'">
<PolyUseEmbeddedAttribute>true</PolyUseEmbeddedAttribute>
</PropertyGroup>

<ItemGroup Condition="'$(EnableTUnitPolyfills)' != 'false'">
<PackageReference Include="Polyfill">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<!-- Polyfill is already added by Directory.Build.props for internal projects -->
<!-- For NuGet consumers, it's added by TUnit.Core.targets with embedded attributes -->

<ItemGroup Condition="'$(TargetFrameworkIdentifier)'!='.NETCoreApp'">
<PackageReference Include="System.Threading.Tasks.Extensions" />
Expand Down
9 changes: 1 addition & 8 deletions Roslyn.props
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
<Project>

<PropertyGroup>
<PolyUseEmbeddedAttribute>true</PolyUseEmbeddedAttribute>
</PropertyGroup>
<!-- Polyfill is added by Directory.Build.props for internal projects -->

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Common" VersionOverride="$(RoslynVersion).*"/>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" VersionOverride="$(RoslynVersion).*"/>
<PackageReference Include="Polyfill">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions TUnit.Assertions.SourceGenerator.Tests/TestsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Task RunTest(string inputFile, Func<string[], Task> assertions)
public async Task RunTest(string inputFile, RunTestOptions runTestOptions, Func<string[], Task> assertions)
{
#if NET
var source = await FilePolyfill.ReadAllTextAsync(inputFile);
var source = await File.ReadAllTextAsync(inputFile);
#else
var source = File.ReadAllText(inputFile);
#endif
Expand Down Expand Up @@ -80,7 +80,7 @@ namespace System.Diagnostics.CodeAnalysis;
public class UnconditionalSuppressMessageAttribute : Attribute;
""",
#if NET
..await Task.WhenAll(runTestOptions.AdditionalFiles.Select(x => FilePolyfill.ReadAllTextAsync(x))),
..await Task.WhenAll(runTestOptions.AdditionalFiles.Select(x => File.ReadAllTextAsync(x))),
#else
..runTestOptions.AdditionalFiles.Select(x => File.ReadAllText(x)),
#endif
Expand Down Expand Up @@ -160,8 +160,8 @@ Have you added required references and additional files?

verifyTask = verifyTask.OnVerifyMismatch(async (pair, message, verify) =>
{
var received = await FilePolyfill.ReadAllTextAsync(pair.ReceivedPath);
var verified = await FilePolyfill.ReadAllTextAsync(pair.VerifiedPath);
var received = await File.ReadAllTextAsync(pair.ReceivedPath);
var verified = await File.ReadAllTextAsync(pair.VerifiedPath);

// Better diff message since original one is too large
await Assert.That(Scrub(received)).IsEqualTo(Scrub(verified));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void TestMethod()
private async Task RunTestWithInlineSource(string source)
{
var tempFile = Path.GetTempFileName() + ".cs";
await FilePolyfill.WriteAllTextAsync(tempFile, source);
await File.WriteAllTextAsync(tempFile, source);

try
{
Expand Down
8 changes: 4 additions & 4 deletions TUnit.Core.SourceGenerator.Tests/TestsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public Task RunTest(string inputFile, Func<string[], Task> assertions)
public async Task RunTest(string inputFile, RunTestOptions runTestOptions, Func<string[], Task> assertions)
{
#if NET
var source = await FilePolyfill.ReadAllTextAsync(inputFile);
var source = await File.ReadAllTextAsync(inputFile);
#else
var source = File.ReadAllText(inputFile);
#endif
Expand Down Expand Up @@ -86,7 +86,7 @@ namespace System.Diagnostics.CodeAnalysis;
public class UnconditionalSuppressMessageAttribute : Attribute;
""",
#if NET
..await Task.WhenAll(runTestOptions.AdditionalFiles.Select(x => FilePolyfill.ReadAllTextAsync(x))),
..await Task.WhenAll(runTestOptions.AdditionalFiles.Select(x => File.ReadAllTextAsync(x))),
#else
..runTestOptions.AdditionalFiles.Select(x => File.ReadAllText(x)),
#endif
Expand Down Expand Up @@ -172,8 +172,8 @@ Have you added required references and additional files?
{
verifyTask = verifyTask.OnVerifyMismatch(async (pair, message, verify) =>
{
var received = await FilePolyfill.ReadAllTextAsync(pair.ReceivedPath);
var verified = await FilePolyfill.ReadAllTextAsync(pair.VerifiedPath);
var received = await File.ReadAllTextAsync(pair.ReceivedPath);
var verified = await File.ReadAllTextAsync(pair.VerifiedPath);

// Better diff message since original one is too large
await Assert.That(Scrub(received)).IsEqualTo(Scrub(verified));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void TestWithConfiguration()
private async Task RunTestWithInlineSource(string source)
{
var tempFile = Path.GetTempFileName() + ".cs";
await FilePolyfill.WriteAllTextAsync(tempFile, source);
await File.WriteAllTextAsync(tempFile, source);

try
{
Expand Down
6 changes: 3 additions & 3 deletions TUnit.Core.SourceGenerator.Tests/Verify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ public async Task ToTask()

if (!File.Exists(_verifiedPath))
{
await FilePolyfill.WriteAllTextAsync(_receivedPath, NormalizeNewline(final));
await File.WriteAllTextAsync(_receivedPath, NormalizeNewline(final));
throw new InvalidOperationException($"No verified file found for '{name}'.");
}

var approved = await FilePolyfill.ReadAllTextAsync(_verifiedPath);
var approved = await File.ReadAllTextAsync(_verifiedPath);

if (!string.Equals(NormalizeNewline(final), NormalizeNewline(approved), StringComparison.Ordinal))
{
await FilePolyfill.WriteAllTextAsync(_receivedPath, NormalizeNewline(final));
await File.WriteAllTextAsync(_receivedPath, NormalizeNewline(final));

if (_onVerifyMismatch != null)
{
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Engine.Tests/Attributes/SkipNetFrameworkAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class SkipNetFrameworkAttribute(string reason) : SkipAttribute(reason)
{
private static readonly string NetVersion = Environment.GetEnvironmentVariable("NET_VERSION") ?? "net9.0";
private static readonly string NetVersion = Environment.GetEnvironmentVariable("NET_VERSION") ?? "net10.0";

public override Task<bool> ShouldSkip(TestRegisteredContext testRegisteredContext)
{
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Engine.Tests/InvokableTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static IEnumerable<TestMode> GetTestModes()
}
}

private static readonly string GetEnvironmentVariable = Environment.GetEnvironmentVariable("NET_VERSION") ?? "net9.0";
private static readonly string GetEnvironmentVariable = Environment.GetEnvironmentVariable("NET_VERSION") ?? "net10.0";

public static bool IsNetFramework => GetEnvironmentVariable.StartsWith("net4");

Expand Down
2 changes: 1 addition & 1 deletion TUnit.Pipeline/Modules/Abstract/TestBaseModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ protected virtual IEnumerable<string> TestableFrameworks
{
get
{
yield return "net9.0";
yield return "net10.0";
yield return "net8.0";

if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Expand Down
4 changes: 2 additions & 2 deletions TUnit.Pipeline/Modules/PublishNugetTesterAOTModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
.FindFile(x => x.Name == "TUnit.NugetTester.csproj")
.AssertExists();

// Test AOT publishing for net8.0 and net9.0
foreach (var framework in new[] { "net8.0", "net9.0" })
// Test AOT publishing
foreach (var framework in new[] { "net8.0", "net9.0", "net10.0" })
{
var result = await SubModule($"AOT-{framework}", async () =>
{
return await context.DotNet().Publish(new DotNetPublishOptions(testProject)

Check warning on line 40 in TUnit.Pipeline/Modules/PublishNugetTesterAOTModule.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (macos-latest)

Possible null reference argument for parameter 'projectSolution' in 'DotNetPublishOptions.DotNetPublishOptions(string projectSolution)'.
{
RuntimeIdentifier = GetRuntimeIdentifier(),
Configuration = Configuration.Release,
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Pipeline/Modules/RunAspNetTestsModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class RunAspNetTestsModule : Module<CommandResult>
Project = project.Name,
NoBuild = true,
Configuration = Configuration.Release,
Framework = "net9.0",
Framework = "net10.0",
WorkingDirectory = project.Folder!,
Arguments = ["--ignore-exit-code", "8", "--hangdump", "--hangdump-filename", "hangdump.aspnet-tests.dmp", "--hangdump-timeout", "5m"],
EnvironmentVariables = new Dictionary<string, string?>
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Pipeline/Modules/RunEngineTestsModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class RunEngineTestsModule : Module<CommandResult>
Project = project.Name,
NoBuild = true,
Configuration = Configuration.Release,
Framework = "net9.0",
Framework = "net10.0",
WorkingDirectory = project.Folder!,
Arguments = [
"--hangdump", "--hangdump-filename", $"hangdump.{Environment.OSVersion.Platform}.engine-tests.dmp", "--hangdump-timeout", "30m",
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Pipeline/Modules/RunTemplateTestsModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class RunTemplateTestsModule : Module<CommandResult>
WorkingDirectory = project.Folder!,
NoBuild = true,
Configuration = Configuration.Release,
Framework = "net9.0",
Framework = "net10.0",
Arguments = ["--", "--hangdump", "--hangdump-filename", "hangdump.template-tests.dmp", "--hangdump-timeout", "5m"],
EnvironmentVariables = new Dictionary<string, string?>
{
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Pipeline/Modules/TestNugetPackageModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected override IEnumerable<string> TestableFrameworks
{
get
{
yield return "net9.0";
yield return "net10.0";
yield return "net8.0";

if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Expand Down
4 changes: 2 additions & 2 deletions TUnit.PublicAPI/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ await VerifyTUnit.Verify(publicApi)
.ScrubFilePaths()
.OnVerifyMismatch(async (pair, message, verify) =>
{
var received = await FilePolyfill.ReadAllTextAsync(pair.ReceivedPath);
var verified = await FilePolyfill.ReadAllTextAsync(pair.VerifiedPath);
var received = await File.ReadAllTextAsync(pair.ReceivedPath);
var verified = await File.ReadAllTextAsync(pair.VerifiedPath);

// Better diff message since original one is too large
await Assert.That(Scrub(received)).IsEqualTo(Scrub(verified));
Expand Down
6 changes: 3 additions & 3 deletions TUnit.PublicAPI/Verify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ public async Task ToTask()

if (!File.Exists(_verifiedPath))
{
await FilePolyfill.WriteAllTextAsync(_receivedPath, NormalizeNewline(final));
await File.WriteAllTextAsync(_receivedPath, NormalizeNewline(final));
throw new InvalidOperationException($"No verified file found for '{name}'.");
}

var approved = await FilePolyfill.ReadAllTextAsync(_verifiedPath);
var approved = await File.ReadAllTextAsync(_verifiedPath);

if (!string.Equals(NormalizeNewline(final), NormalizeNewline(approved), StringComparison.Ordinal))
{
await FilePolyfill.WriteAllTextAsync(_receivedPath, NormalizeNewline(final));
await File.WriteAllTextAsync(_receivedPath, NormalizeNewline(final));

if (_onVerifyMismatch != null)
{
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion TUnit.TestProject/AfterTestAttributeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public async ValueTask OnTestEnd(TestContext testContext)
{
Console.WriteLine(@"Writing file inside WriteFileAfterTestAttribute!");

await FilePolyfill.WriteAllTextAsync(Filename, "Foo!");
await File.WriteAllTextAsync(Filename, "Foo!");
}

public int Order => 0;
Expand Down
2 changes: 1 addition & 1 deletion TUnit.TestProject/AfterTests/TestDiscoveryAfterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static async Task AfterTestDiscovery(TestDiscoveryContext context)
[AfterEvery(TestDiscovery)]
public static async Task AfterEveryTestDiscovery(TestDiscoveryContext context)
{
await FilePolyfill.WriteAllTextAsync($"TestDiscoveryAfterTests{Guid.NewGuid():N}.txt", $"{context.AllTests.Count()} tests found");
await File.WriteAllTextAsync($"TestDiscoveryAfterTests{Guid.NewGuid():N}.txt", $"{context.AllTests.Count()} tests found");

var test = context.AllTests.FirstOrDefault(x =>
x.Metadata.TestDetails.TestName == nameof(TestDiscoveryAfterTests.EnsureAfterEveryTestDiscoveryHit));
Expand Down
2 changes: 1 addition & 1 deletion TUnit.TestProject/AfterTests/TestSessionAfterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static async Task AfterTestSession(TestSessionContext context)
[AfterEvery(TestSession)]
public static async Task AfterEveryTestSession(TestSessionContext context)
{
await FilePolyfill.WriteAllTextAsync($"TestSessionAfterTests{Guid.NewGuid():N}.txt", $"{context.AllTests.Count()} tests in session");
await File.WriteAllTextAsync($"TestSessionAfterTests{Guid.NewGuid():N}.txt", $"{context.AllTests.Count()} tests in session");

var test = context.AllTests.FirstOrDefault(x =>
x.Metadata.TestDetails.TestName == nameof(TestSessionAfterTests.PepareForAfterSession));
Expand Down
2 changes: 1 addition & 1 deletion TUnit.TestProject/BeforeTests/TestDiscoveryBeforeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static async Task BeforeTestDiscovery(BeforeTestDiscoveryContext context)
[BeforeEvery(TestDiscovery)]
public static async Task BeforeEveryTestDiscovery(BeforeTestDiscoveryContext context)
{
await FilePolyfill.WriteAllTextAsync($"TestDiscoveryBeforeTests{Guid.NewGuid():N}.txt", $"Blah!");
await File.WriteAllTextAsync($"TestDiscoveryBeforeTests{Guid.NewGuid():N}.txt", $"Blah!");
}
}

Expand Down
2 changes: 1 addition & 1 deletion TUnit.TestProject/BeforeTests/TestSessionBeforeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static async Task BeforeTestSession(TestSessionContext context)
[BeforeEvery(TestSession)]
public static async Task BeforeEveryTestSession(TestSessionContext context)
{
await FilePolyfill.WriteAllTextAsync($"TestSessionBeforeTests{Guid.NewGuid():N}.txt", $"{context.AllTests.Count()} tests in session");
await File.WriteAllTextAsync($"TestSessionBeforeTests{Guid.NewGuid():N}.txt", $"{context.AllTests.Count()} tests in session");

var test = context.AllTests.FirstOrDefault(x =>
x.Metadata.TestDetails.TestName == nameof(TestSessionBeforeTests.EnsureBeforeEveryTestSessionHit));
Expand Down
Loading