Skip to content

Commit

Permalink
run multi-target tests on net6 only
Browse files Browse the repository at this point in the history
  • Loading branch information
adamralph committed Mar 5, 2022
1 parent a92aedf commit 3ebf491
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 15 deletions.
2 changes: 1 addition & 1 deletion MinVerTests.Packages/Cleaning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace MinVerTests.Packages
{
public static class Cleaning
{
[Theory]
[Net6PlusTheory("With SDK < 6.0 there is a 15 minute delay after the `dotnet build` command when multi-targeting")]
[InlineData(false)]
[InlineData(true)]
public static async Task PackagesAreCleaned(bool multiTarget)
Expand Down
5 changes: 1 addition & 4 deletions MinVerTests.Packages/MultipleProjects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ namespace MinVerTests.Packages
{
public class MultipleProjects
{
// for some reason, when using SDK 3.1,
// there is a 15 minute delay after the `dotnet build` command,
// so we only run this test on SDK 5.0 and later
[Net5PlusFact]
[Net6PlusFact("With SDK < 6.0 there is a 15 minute delay after the `dotnet build` command")]
public async Task MultipleTagPrefixes()
{
// arrange
Expand Down
19 changes: 10 additions & 9 deletions MinVerTests.Packages/Net5PlusFact.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@

namespace MinVerTests.Packages
{
public sealed class Net5PlusFact : FactAttribute
public sealed class Net6PlusFact : FactAttribute
{
public Net6PlusFact(string reason) => this.Reason = reason;

public string Reason { get; }

public override string Skip
{
get => !string.IsNullOrEmpty(base.Skip)
? base.Skip
:
(
Sdk.Version.StartsWith("2.", StringComparison.Ordinal) || Sdk.Version.StartsWith("3.", StringComparison.Ordinal)
? "Not .NET 5 or later"
: ""
);
get =>
Sdk.Version.StartsWith("3.", StringComparison.Ordinal) ||
Sdk.Version.StartsWith("5.", StringComparison.Ordinal)
? this.Reason
: base.Skip;

set => base.Skip = value;
}
Expand Down
24 changes: 24 additions & 0 deletions MinVerTests.Packages/Net6PlusTheory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using MinVerTests.Infra;
using Xunit;

namespace MinVerTests.Packages
{
public sealed class Net6PlusTheory : TheoryAttribute
{
public Net6PlusTheory(string reason) => this.Reason = reason;

public string Reason { get; }

public override string Skip
{
get =>
Sdk.Version.StartsWith("3.", StringComparison.Ordinal) ||
Sdk.Version.StartsWith("5.", StringComparison.Ordinal)
? this.Reason
: base.Skip;

set => base.Skip = value;
}
}
}
2 changes: 1 addition & 1 deletion MinVerTests.Packages/Repackaging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace MinVerTests.Packages
{
public static class Repackaging
{
[Theory]
[Net6PlusTheory("With SDK < 6.0 there is a 15 minute delay after the `dotnet build` command when multi-targeting")]
[InlineData(false)]
[InlineData(true)]
public static async Task DoesNotRecreatePackage(bool multiTarget)
Expand Down

0 comments on commit 3ebf491

Please sign in to comment.