Skip to content

Commit 405d2c4

Browse files
authored
Merge pull request #788 from nunit/chore/bump-nunit-version
chore: Bump NUnit to version 4.2.2
2 parents e026ba5 + b643c64 commit 405d2c4

File tree

2 files changed

+6
-57
lines changed

2 files changed

+6
-57
lines changed

src/nunit.analyzers.tests/TestCaseUsage/TestCaseUsageAnalyzerTests.cs

Lines changed: 5 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -15,57 +15,6 @@ namespace NUnit.Analyzers.Tests.TestCaseUsage
1515
[TestFixture]
1616
public sealed class TestCaseUsageAnalyzerTests
1717
{
18-
#if NUNIT4
19-
#if NET6_0_OR_GREATER
20-
// This can go once NUnit 4.2.0 is released and we update our reference.
21-
private const string GenericTestCaseAttributeSource = """
22-
using System;
23-
24-
namespace NUnit.Framework
25-
{
26-
#pragma warning disable CA1019 // Define accessors for attribute arguments
27-
28-
/// <summary>
29-
/// Marks a method as a parameterized test suite and provides arguments for each test case.
30-
/// </summary>
31-
/// <typeparam name="T">The type of the argument for the test case.</typeparam>
32-
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
33-
public sealed class TestCaseAttribute<T> : TestCaseAttribute
34-
{
35-
/// <summary>
36-
/// Initializes a new instance of the <see cref="TestCaseAttribute{T}"/> class.
37-
/// </summary>
38-
/// <param name="argument">The argument for the test case.</param>
39-
public TestCaseAttribute(T argument)
40-
: base(new object?[] { argument })
41-
{
42-
this.TypeArgs = new[] { typeof(T) };
43-
}
44-
}
45-
46-
/// <summary>
47-
/// Marks a method as a parameterized test suite and provides arguments for each test case.
48-
/// </summary>
49-
/// <typeparam name="T">The type of the argument for the test case.</typeparam>
50-
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
51-
public sealed class TestCaseAttribute<T1, T2> : TestCaseAttribute
52-
{
53-
/// <summary>
54-
/// Initializes a new instance of the <see cref="TestCaseAttribute{T1,T2}"/> class.
55-
/// </summary>
56-
/// <param name="argument">The argument for the test case.</param>
57-
public TestCaseAttribute(T1 argument1, T2 argument2)
58-
: base(new object?[] { argument1, argument2 })
59-
{
60-
this.TypeArgs = new[] { typeof(T1), typeof(T2) };
61-
}
62-
}
63-
}
64-
65-
""";
66-
#endif
67-
#endif
68-
6918
private readonly DiagnosticAnalyzer analyzer = new TestCaseUsageAnalyzer();
7019

7120
private static IEnumerable<TestCaseData> SpecialConversions
@@ -818,7 +767,7 @@ class AnalyzeWhenArgumentIsGenericTypeParameter
818767
[TestCase<byte>(2)]
819768
public void Test(byte a) { }
820769
}");
821-
RoslynAssert.Valid(this.analyzer, GenericTestCaseAttributeSource, testCode);
770+
RoslynAssert.Valid(this.analyzer, testCode);
822771
}
823772

824773
[Test]
@@ -830,7 +779,7 @@ class AnalyzeWhenArgumentIsGenericTypeParameter
830779
[TestCase<byte, uint>(2, 3)]
831780
public void Test(byte a, uint b) { }
832781
}");
833-
RoslynAssert.Valid(this.analyzer, GenericTestCaseAttributeSource, testCode);
782+
RoslynAssert.Valid(this.analyzer, testCode);
834783
}
835784

836785
[Test]
@@ -844,7 +793,7 @@ public void Test(int a) { }
844793
}");
845794
RoslynAssert.Diagnostics(this.analyzer,
846795
ExpectedDiagnostic.Create(AnalyzerIdentifiers.TestCaseParameterTypeMismatchUsage),
847-
GenericTestCaseAttributeSource, testCode);
796+
testCode);
848797
}
849798

850799
[Test]
@@ -858,7 +807,7 @@ public void Test(int a, uint b) { }
858807
}");
859808
RoslynAssert.Diagnostics(this.analyzer,
860809
ExpectedDiagnostic.Create(AnalyzerIdentifiers.TestCaseParameterTypeMismatchUsage),
861-
GenericTestCaseAttributeSource, testCode);
810+
testCode);
862811
}
863812

864813
[Test]
@@ -873,7 +822,7 @@ public sealed class AnalyzeWhenTestMethodHasTypeParameterArgumentType
873822
[TestCase<double>(1)]
874823
public void TestWithGenericParameter<T>(T arg1) { }
875824
}");
876-
RoslynAssert.Valid(this.analyzer, GenericTestCaseAttributeSource, testCode);
825+
RoslynAssert.Valid(this.analyzer, testCode);
877826
}
878827
#endif
879828

src/nunit.analyzers.tests/nunit.analyzers.tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</ItemGroup>
2323

2424
<ItemGroup Condition="'$(NUnitVersion)' == '4'">
25-
<PackageReference Include="NUnit" Version="4.1.0" />
25+
<PackageReference Include="NUnit" Version="4.2.2" />
2626
</ItemGroup>
2727

2828
<ItemGroup Condition="'$(NUnitVersion)' == '3'">

0 commit comments

Comments
 (0)