11namespace NServiceBus . AzureFunctions . Analyzer . Tests
22{
33 using System . Threading . Tasks ;
4- using Microsoft . CodeAnalysis . CSharp ;
54 using NUnit . Framework ;
5+ using static AzureFunctionsDiagnostics ;
66
77 [ TestFixture ]
88 public class AzureFunctionsConfigurationAnalyzerTests : AnalyzerTestFixture < AzureFunctionsConfigurationAnalyzer >
99 {
10- [ TestCase ( "DefineCriticalErrorAction((errorContext, cancellationToken) => Task.CompletedTask)" , AzureFunctionsDiagnostics . DefineCriticalErrorActionNotAllowedId , LanguageVersion . CSharp7 ) ]
11- [ TestCase ( "LimitMessageProcessingConcurrencyTo(5)" , AzureFunctionsDiagnostics . LimitMessageProcessingToNotAllowedId , LanguageVersion . CSharp7 ) ]
12- [ TestCase ( "MakeInstanceUniquelyAddressable(null)" , AzureFunctionsDiagnostics . MakeInstanceUniquelyAddressableNotAllowedId , LanguageVersion . CSharp7 ) ]
13- [ TestCase ( "OverrideLocalAddress(null)" , AzureFunctionsDiagnostics . OverrideLocalAddressNotAllowedId , LanguageVersion . CSharp7 ) ]
14- [ TestCase ( "PurgeOnStartup(true)" , AzureFunctionsDiagnostics . PurgeOnStartupNotAllowedId , LanguageVersion . CSharp7 ) ]
15- [ TestCase ( "SetDiagnosticsPath(null)" , AzureFunctionsDiagnostics . SetDiagnosticsPathNotAllowedId , LanguageVersion . CSharp7 ) ]
16- // HINT: In C# 7 this call is ambiguous with the LearningTransport version as the compiler cannot differentiate method calls via generic type constraints
17- [ TestCase ( "UseTransport<AzureServiceBusTransport>()" , AzureFunctionsDiagnostics . UseTransportNotAllowedId , LanguageVersion . CSharp8 ) ]
18- [ TestCase ( "UseTransport(new AzureServiceBusTransport(null))" , AzureFunctionsDiagnostics . UseTransportNotAllowedId , LanguageVersion . CSharp7 ) ]
19- public Task DiagnosticIsReportedForEndpointConfiguration ( string configuration , string diagnosticId , LanguageVersion minimumLangVersion )
10+ [ TestCase ( "DefineCriticalErrorAction((errorContext, cancellationToken) => Task.CompletedTask)" , DefineCriticalErrorActionNotAllowedId ) ]
11+ [ TestCase ( "LimitMessageProcessingConcurrencyTo(5)" , LimitMessageProcessingToNotAllowedId ) ]
12+ [ TestCase ( "MakeInstanceUniquelyAddressable(null)" , MakeInstanceUniquelyAddressableNotAllowedId ) ]
13+ [ TestCase ( "OverrideLocalAddress(null)" , OverrideLocalAddressNotAllowedId ) ]
14+ [ TestCase ( "PurgeOnStartup(true)" , PurgeOnStartupNotAllowedId ) ]
15+ [ TestCase ( "SetDiagnosticsPath(null)" , SetDiagnosticsPathNotAllowedId ) ]
16+ [ TestCase ( "UseTransport(new AzureServiceBusTransport(null))" , UseTransportNotAllowedId ) ]
17+ public Task DiagnosticIsReportedForEndpointConfiguration ( string configuration , string diagnosticId )
2018 {
21- testSpecificLangVersion = minimumLangVersion ;
22-
2319 var source =
2420 $@ "using NServiceBus;
2521using System;
@@ -37,8 +33,5 @@ void Bar(ServiceBusTriggeredEndpointConfiguration endpointConfig)
3733
3834 return Assert ( diagnosticId , source ) ;
3935 }
40-
41- LanguageVersion testSpecificLangVersion ;
42- protected override LanguageVersion AnalyzerLanguageVersion => testSpecificLangVersion ;
4336 }
4437}
0 commit comments