From 31dcac42cd9133ac67c056576452e06389a1c54d Mon Sep 17 00:00:00 2001 From: Manfred Brands Date: Wed, 8 Jan 2025 16:04:36 +0800 Subject: [PATCH] DateTime and TimeOnly also work with NUnit 3 --- .../TestCaseUsageAnalyzerTests.cs | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/nunit.analyzers.tests/TestCaseUsage/TestCaseUsageAnalyzerTests.cs b/src/nunit.analyzers.tests/TestCaseUsage/TestCaseUsageAnalyzerTests.cs index 29be2a44..f394673b 100644 --- a/src/nunit.analyzers.tests/TestCaseUsage/TestCaseUsageAnalyzerTests.cs +++ b/src/nunit.analyzers.tests/TestCaseUsage/TestCaseUsageAnalyzerTests.cs @@ -767,6 +767,20 @@ public void TestWithGenericParameter(T arg1) { } RoslynAssert.Valid(this.analyzer, testCode); } +#if NET6_0_OR_GREATER + [TestCaseSource(nameof(SpecialConversions_NET6))] + public void AnalyzeWhenArgumentIsSpecialConversionNET6(string value, Type targetType) + { + var testCode = TestUtility.WrapClassInNamespaceAndAddUsing($@" + public sealed class AnalyzeWhenArgumentIsSpecialConversion + {{ + [TestCase(""{value}"")] + public void Test({targetType.Name} a) {{ }} + }}"); + RoslynAssert.Valid(this.analyzer, testCode); + } +#endif + #if NUNIT4 #if NET6_0_OR_GREATER [Test] @@ -835,18 +849,6 @@ public void TestWithGenericParameter(T arg1) { } }"); RoslynAssert.Valid(this.analyzer, testCode); } - - [TestCaseSource(nameof(SpecialConversions_NET6))] - public void AnalyzeWhenArgumentIsSpecialConversionNET6(string value, Type targetType) - { - var testCode = TestUtility.WrapClassInNamespaceAndAddUsing($@" - public sealed class AnalyzeWhenArgumentIsSpecialConversion - {{ - [TestCase(""{value}"")] - public void Test({targetType.Name} a) {{ }} - }}"); - RoslynAssert.Valid(this.analyzer, testCode); - } #endif [Test]