Skip to content

Commit 9d9cadc

Browse files
authored
Use new analyzer testing framework package (#7635)
* Adapt analyzer and fixer tests to Particular.AnalyzerTesting * Remove unnecessary compilation extension methods * Move out SourceGeneratorTest * Use new package alpha * alpha 2 * 1.0.0 final * Fix namespace from other side of merge
1 parent c28a3c4 commit 9d9cadc

28 files changed

+357
-1411
lines changed

src/NServiceBus.Core.Analyzer.Tests.Roslyn5/AwaitOrCaptureTasksAnalyzerTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace NServiceBus.Core.Analyzer.Tests;
44

55
using System.Threading.Tasks;
6-
using Helpers;
76
using NUnit.Framework;
7+
using Particular.AnalyzerTesting;
88

99
[TestFixture]
1010
public class AwaitOrCaptureTasksAnalyzerTests : AnalyzerTestFixture<AwaitOrCaptureTasksAnalyzer>
@@ -81,7 +81,7 @@ void Bar({type} obj)
8181
}}
8282
}}";
8383

84-
return Assert(DiagnosticIds.AwaitOrCaptureTasks, source);
84+
return Assert(source, DiagnosticIds.AwaitOrCaptureTasks);
8585
}
8686

8787
[TestCase("session.Send(new object())")]
@@ -110,7 +110,7 @@ void Bar(IUniformSession session)
110110
}}
111111
}}";
112112

113-
return Assert(DiagnosticIds.AwaitOrCaptureTasks, source);
113+
return Assert(source, DiagnosticIds.AwaitOrCaptureTasks);
114114
}
115115

116116
[TestCase("RequestTimeout<object>(context, DateTime.Now)")]
@@ -135,7 +135,7 @@ protected override void ConfigureHowToFindSaga(SagaPropertyMapper<Data> mapper)
135135
136136
class Data : ContainSagaData {{}}";
137137

138-
return Assert(DiagnosticIds.AwaitOrCaptureTasks, source);
138+
return Assert(source, DiagnosticIds.AwaitOrCaptureTasks);
139139
}
140140

141141
[Test]
@@ -152,7 +152,7 @@ async Task Bar(IPipelineContext ctx)
152152
}
153153
}";
154154

155-
return Assert(DiagnosticIds.AwaitOrCaptureTasks, source);
155+
return Assert(source, DiagnosticIds.AwaitOrCaptureTasks);
156156
}
157157

158158
[TestCase(

src/NServiceBus.Core.Analyzer.Tests.Roslyn5/FeatureDefaultsEnableFeatureAnalyzerTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace NServiceBus.Core.Analyzer.Tests;
44

55
using System.Threading.Tasks;
6-
using Helpers;
76
using NUnit.Framework;
7+
using Particular.AnalyzerTesting;
88

99
[TestFixture]
1010
public class FeatureDefaultsEnableFeatureAnalyzerTests : AnalyzerTestFixture<FeatureDefaultsEnableFeatureAnalyzer>
@@ -32,7 +32,7 @@ protected override void Setup(FeatureConfigurationContext context) { }
3232
}
3333
""";
3434

35-
return Assert(DiagnosticIds.DoNotEnableFeaturesInDefaults, source);
35+
return Assert(source, DiagnosticIds.DoNotEnableFeaturesInDefaults);
3636
}
3737

3838
[Test]
@@ -67,7 +67,7 @@ protected override void Setup(FeatureConfigurationContext context) { }
6767
}
6868
""";
6969

70-
return Assert(DiagnosticIds.DoNotEnableFeaturesInDefaults, source);
70+
return Assert(source, DiagnosticIds.DoNotEnableFeaturesInDefaults);
7171
}
7272

7373
[Test]
@@ -98,7 +98,7 @@ protected override void Setup(FeatureConfigurationContext context) { }
9898
}
9999
""";
100100

101-
return Assert(DiagnosticIds.DoNotEnableFeaturesInDefaults, source);
101+
return Assert(source, DiagnosticIds.DoNotEnableFeaturesInDefaults);
102102
}
103103

104104
[Test]
@@ -135,7 +135,7 @@ protected override void Setup(FeatureConfigurationContext context) { }
135135
}
136136
""";
137137

138-
return Assert(DiagnosticIds.DoNotEnableFeaturesInDefaults, source);
138+
return Assert(source, DiagnosticIds.DoNotEnableFeaturesInDefaults);
139139
}
140140

141141
[Test]

src/NServiceBus.Core.Analyzer.Tests.Roslyn5/FeatureDefaultsEnableFeatureFixerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace NServiceBus.Core.Analyzer.Tests;
44

55
using System.Threading.Tasks;
6-
using Helpers;
76
using NServiceBus.Core.Analyzer.Fixes;
87
using NUnit.Framework;
8+
using Particular.AnalyzerTesting;
99

1010
[TestFixture]
1111
public class FeatureDefaultsEnableFeatureFixerTests : CodeFixTestFixture<FeatureDefaultsEnableFeatureAnalyzer, FeatureDefaultsEnableFeatureFixer>

src/NServiceBus.Core.Analyzer.Tests.Roslyn5/ForwardCancellationToken/ForwardCancellationTokenFixerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace NServiceBus.Core.Analyzer.Tests;
44

55
using System.Threading.Tasks;
6-
using Helpers;
76
using NServiceBus.Core.Analyzer.Fixes;
87
using NUnit.Framework;
8+
using Particular.AnalyzerTesting;
99

1010
[TestFixture]
1111
public class ForwardCancellationTokenFixerTests : CodeFixTestFixture<ForwardCancellationTokenAnalyzer, ForwardCancellationTokenFixer>

0 commit comments

Comments
 (0)