Skip to content

Commit

Permalink
EnvironmentVariables.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
thomhurst committed Dec 26, 2024
1 parent 1aef439 commit 697d22c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
8 changes: 8 additions & 0 deletions TUnit.Engine.Tests/EnvironmentVariables.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace TUnit.Engine.Tests;

public class EnvironmentVariables
{
public static readonly string? NetVersion = Environment.GetEnvironmentVariable("NET_VERSION");

public static readonly bool IsNet472 = NetVersion == "net472";
}
2 changes: 1 addition & 1 deletion TUnit.Engine.Tests/InvokableTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected async Task RunTestsWithFilter(string filter,
{
await RunWithoutAot(filter, assertions, runOptions, assertionExpression);

if (Environment.GetEnvironmentVariable("NET_VERSION") == "net472")
if (EnvironmentVariables.IsNet472)
{
return;
}
Expand Down
8 changes: 8 additions & 0 deletions TUnit.Pipeline/EnvironmentVariables.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace TUnit.Pipeline;

public class EnvironmentVariables
{
public static readonly string? NetVersion = Environment.GetEnvironmentVariable("NET_VERSION");

public static readonly bool IsNet472 = NetVersion == "net472";
}
2 changes: 1 addition & 1 deletion TUnit.Pipeline/Modules/PublishAOTModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class PublishAOTModule : Module<CommandResult>

protected override Task<SkipDecision> ShouldSkip(IPipelineContext context)
{
return Task.FromResult<SkipDecision>(Environment.GetEnvironmentVariable("NET_VERSION") == "net472");
return Task.FromResult<SkipDecision>(EnvironmentVariables.IsNet472);
}

protected override async Task<CommandResult?> ExecuteAsync(IPipelineContext context, CancellationToken cancellationToken)
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Pipeline/Modules/PublishSingleFileModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class PublishSingleFileModule : Module<CommandResult>

protected override Task<SkipDecision> ShouldSkip(IPipelineContext context)
{
return Task.FromResult<SkipDecision>(Environment.GetEnvironmentVariable("NET_VERSION") == "net472");
return Task.FromResult<SkipDecision>(EnvironmentVariables.IsNet472);
}

protected override async Task<CommandResult?> ExecuteAsync(IPipelineContext context, CancellationToken cancellationToken)
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 @@ -18,7 +18,7 @@ public class TestNugetPackageModule : Module<CommandResult[]>

public TestNugetPackageModule()
{
if (Environment.GetEnvironmentVariable("NET_VERSION") == "net472")
if (EnvironmentVariables.IsNet472)
{
_frameworks.Add("net472");
}
Expand Down

0 comments on commit 697d22c

Please sign in to comment.