-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathConfigurationAnalyzerTestsCSharp8.cs
More file actions
33 lines (29 loc) · 1.16 KB
/
ConfigurationAnalyzerTestsCSharp8.cs
File metadata and controls
33 lines (29 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
namespace NServiceBus.AzureFunctions.InProcess.Analyzer.Tests;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp;
using NUnit.Framework;
using static AzureFunctionsDiagnostics;
[TestFixture]
public class ConfigurationAnalyzerTestsCSharp8 : AnalyzerTestFixture<ConfigurationAnalyzer>
{
// HINT: In C# 7 this call is ambiguous with the LearningTransport version as the compiler cannot differentiate method calls via generic type constraints
[TestCase("UseTransport<AzureServiceBusTransport>(null)", UseTransportNotAllowedId)]
public Task DiagnosticIsReportedForEndpointConfiguration(string configuration, string diagnosticId)
{
var source =
$@"using NServiceBus;
using System;
using System.Threading.Tasks;
class Foo
{{
void Bar(ServiceBusTriggeredEndpointConfiguration endpointConfig)
{{
[|endpointConfig.AdvancedConfiguration.{configuration}|];
var advancedConfig = endpointConfig.AdvancedConfiguration;
[|advancedConfig.{configuration}|];
}}
}}";
return Assert(diagnosticId, source);
}
protected override LanguageVersion AnalyzerLanguageVersion => LanguageVersion.CSharp8;
}