Skip to content

Commit 33fcad4

Browse files
committed
Seperated tests into files
1 parent 0cd8fc3 commit 33fcad4

3 files changed

Lines changed: 276 additions & 258 deletions

File tree

src/NServiceBus.AzureFunctions.Analyzer.Tests/AzureFunctionsConfigurationAnalyzerTests.cs

Lines changed: 0 additions & 258 deletions
Original file line numberDiff line numberDiff line change
@@ -153,263 +153,5 @@ void Bar(ServiceBusTriggeredEndpointConfiguration endpointConfig)
153153

154154
return Assert(AzureFunctionsDiagnostics.OverrideLocalAddressNotAllowedId, source);
155155
}
156-
157-
[Test]
158-
public Task DiagnosticIsReportedForRouteReplyToThisInstance()
159-
{
160-
var source =
161-
$@"using NServiceBus;
162-
using System;
163-
using System.Threading.Tasks;
164-
class Foo
165-
{{
166-
void Bar()
167-
{{
168-
var replyOptions = new ReplyOptions();
169-
[|replyOptions.RouteReplyToThisInstance()|];
170-
171-
var sendOptions = new SendOptions();
172-
[|sendOptions.RouteReplyToThisInstance()|];
173-
}}
174-
}}";
175-
176-
return Assert(AzureFunctionsDiagnostics.RouteReplyToThisInstanceNotAllowedId, source);
177-
}
178-
179-
[Test]
180-
public Task DiagnosticIsReportedForRouteToThisInstance()
181-
{
182-
var source =
183-
$@"using NServiceBus;
184-
using System;
185-
using System.Threading.Tasks;
186-
class Foo
187-
{{
188-
void Bar()
189-
{{
190-
var options = new SendOptions();
191-
[|options.RouteToThisInstance()|];
192-
}}
193-
}}";
194-
195-
return Assert(AzureFunctionsDiagnostics.RouteToThisInstanceNotAllowedId, source);
196-
}
197-
198-
[Test]
199-
public Task DiagnosticIsReportedForRouteReplyToAnyInstance()
200-
{
201-
var source =
202-
$@"using NServiceBus;
203-
using System;
204-
using System.Threading.Tasks;
205-
class Foo
206-
{{
207-
void Bar()
208-
{{
209-
var options = new SendOptions();
210-
[|options.RouteReplyToAnyInstance()|];
211-
212-
var replyOptions = new ReplyOptions();
213-
[|replyOptions.RouteReplyToAnyInstance()|];
214-
}}
215-
}}";
216-
217-
return Assert(AzureFunctionsDiagnostics.RouteReplyToAnyInstanceNotAllowedId, source);
218-
}
219-
220-
[Test]
221-
public Task DiagnosticIsReportedForPrefetchCount()
222-
{
223-
var source =
224-
$@"using NServiceBus;
225-
using System;
226-
using System.Threading.Tasks;
227-
class Foo
228-
{{
229-
void Bar(ServiceBusTriggeredEndpointConfiguration endpointConfig)
230-
{{
231-
[|endpointConfig.Transport.PrefetchCount|] = 5;
232-
233-
var transportConfig = endpointConfig.Transport;
234-
[|transportConfig.PrefetchCount|] = 5;
235-
}}
236-
}}";
237-
238-
return Assert(AzureFunctionsDiagnostics.PrefetchCountNotAllowedId, source);
239-
}
240-
241-
[Test]
242-
public Task DiagnosticIsReportedForPrefetchCountAsExtension()
243-
{
244-
var source =
245-
$@"using NServiceBus;
246-
using System;
247-
using System.Threading.Tasks;
248-
class Foo
249-
{{
250-
void Bar(TransportExtensions<AzureServiceBusTransport> transportExtension)
251-
{{
252-
[|transportExtension.PrefetchCount(5)|];
253-
}}
254-
}}";
255-
256-
return Assert(AzureFunctionsDiagnostics.PrefetchCountNotAllowedId, source);
257-
}
258-
259-
[Test]
260-
public Task DiagnosticIsReportedForPrefetchMultiplier()
261-
{
262-
var source =
263-
$@"using NServiceBus;
264-
using System;
265-
using System.Threading.Tasks;
266-
class Foo
267-
{{
268-
void Bar(ServiceBusTriggeredEndpointConfiguration endpointConfig)
269-
{{
270-
[|endpointConfig.Transport.PrefetchMultiplier|] = 5;
271-
272-
var transportConfig = endpointConfig.Transport;
273-
[|transportConfig.PrefetchMultiplier|] = 5;
274-
}}
275-
}}";
276-
277-
return Assert(AzureFunctionsDiagnostics.PrefetchMultiplierNotAllowedId, source);
278-
}
279-
280-
[Test]
281-
public Task DiagnosticIsReportedForPrefetchMultiplierAsExtension()
282-
{
283-
var source =
284-
$@"using NServiceBus;
285-
using System;
286-
using System.Threading.Tasks;
287-
class Foo
288-
{{
289-
void Bar(TransportExtensions<AzureServiceBusTransport> transportExtension)
290-
{{
291-
[|transportExtension.PrefetchMultiplier(5)|];
292-
}}
293-
}}";
294-
295-
return Assert(AzureFunctionsDiagnostics.PrefetchMultiplierNotAllowedId, source);
296-
}
297-
298-
[Test]
299-
public Task DiagnosticIsReportedForMaxAutoLockRenewalDuration()
300-
{
301-
var source =
302-
$@"using NServiceBus;
303-
using System;
304-
using System.Threading.Tasks;
305-
class Foo
306-
{{
307-
void Bar(ServiceBusTriggeredEndpointConfiguration endpointConfig)
308-
{{
309-
[|endpointConfig.Transport.MaxAutoLockRenewalDuration|] = new System.TimeSpan(0, 0, 5, 0);
310-
311-
var transportConfig = endpointConfig.Transport;
312-
[|transportConfig.MaxAutoLockRenewalDuration|] = new System.TimeSpan(0, 0, 5, 0);
313-
}}
314-
}}";
315-
316-
return Assert(AzureFunctionsDiagnostics.MaxAutoLockRenewalDurationNotAllowedId, source);
317-
}
318-
319-
[Test]
320-
public Task DiagnosticIsReportedForMaxAutoLockRenewalDurationAsExtension()
321-
{
322-
var source =
323-
$@"using NServiceBus;
324-
using System;
325-
using System.Threading.Tasks;
326-
class Foo
327-
{{
328-
void Bar(TransportExtensions<AzureServiceBusTransport> transportExtension)
329-
{{
330-
[|transportExtension.MaxAutoLockRenewalDuration(new System.TimeSpan(0, 0, 5, 0))|];
331-
}}
332-
}}";
333-
334-
return Assert(AzureFunctionsDiagnostics.MaxAutoLockRenewalDurationNotAllowedId, source);
335-
}
336-
337-
[Test]
338-
public Task DiagnosticIsReportedForTimeToWaitBeforeTriggeringCircuitBreaker()
339-
{
340-
var source =
341-
$@"using NServiceBus;
342-
using System;
343-
using System.Threading.Tasks;
344-
class Foo
345-
{{
346-
void Bar(ServiceBusTriggeredEndpointConfiguration endpointConfig)
347-
{{
348-
[|endpointConfig.Transport.TimeToWaitBeforeTriggeringCircuitBreaker|] = new System.TimeSpan(0, 0, 5, 0);
349-
350-
var transportConfig = endpointConfig.Transport;
351-
[|transportConfig.TimeToWaitBeforeTriggeringCircuitBreaker|] = new System.TimeSpan(0, 0, 5, 0);
352-
}}
353-
}}";
354-
355-
return Assert(AzureFunctionsDiagnostics.TimeToWaitBeforeTriggeringCircuitBreakerNotAllowedId, source);
356-
}
357-
358-
[Test]
359-
public Task DiagnosticIsReportedForTimeToWaitBeforeTriggeringCircuitBreakerAsExtension()
360-
{
361-
var source =
362-
$@"using NServiceBus;
363-
using System;
364-
using System.Threading.Tasks;
365-
class Foo
366-
{{
367-
void Bar(TransportExtensions<AzureServiceBusTransport> transportExtension)
368-
{{
369-
[|transportExtension.TimeToWaitBeforeTriggeringCircuitBreaker(new System.TimeSpan(0, 0, 5, 0))|];
370-
}}
371-
}}";
372-
373-
return Assert(AzureFunctionsDiagnostics.TimeToWaitBeforeTriggeringCircuitBreakerNotAllowedId, source);
374-
}
375-
376-
[Test]
377-
public Task DiagnosticIsReportedForEntityMaximumSize()
378-
{
379-
var source =
380-
$@"using NServiceBus;
381-
using System;
382-
using System.Threading.Tasks;
383-
class Foo
384-
{{
385-
void Bar(ServiceBusTriggeredEndpointConfiguration endpointConfig)
386-
{{
387-
[|endpointConfig.Transport.EntityMaximumSize|] = 5;
388-
389-
var transportConfig = endpointConfig.Transport;
390-
[|transportConfig.EntityMaximumSize|] = 5;
391-
}}
392-
}}";
393-
394-
return Assert(AzureFunctionsDiagnostics.EntityMaximumSizeNotAllowedId, source);
395-
}
396-
397-
[Test]
398-
public Task DiagnosticIsReportedForEntityMaximumSizeAsExtension()
399-
{
400-
var source =
401-
$@"using NServiceBus;
402-
using System;
403-
using System.Threading.Tasks;
404-
class Foo
405-
{{
406-
void Bar(TransportExtensions<AzureServiceBusTransport> transportExtension)
407-
{{
408-
[|transportExtension.EntityMaximumSize(1)|];
409-
}}
410-
}}";
411-
412-
return Assert(AzureFunctionsDiagnostics.EntityMaximumSizeNotAllowedId, source);
413-
}
414156
}
415157
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
namespace NServiceBus.AzureFunctions.Analyzer.Tests
2+
{
3+
using System.Threading.Tasks;
4+
using NUnit.Framework;
5+
6+
[TestFixture]
7+
public class AzureFunctionsSendReplyOptionsAnalyzerTests : AnalyzerTestFixture<AzureFunctionsConfigurationAnalyzer>
8+
{
9+
[Test]
10+
public Task DiagnosticIsReportedForRouteReplyToThisInstance()
11+
{
12+
var source =
13+
$@"using NServiceBus;
14+
using System;
15+
using System.Threading.Tasks;
16+
class Foo
17+
{{
18+
void Bar()
19+
{{
20+
var replyOptions = new ReplyOptions();
21+
[|replyOptions.RouteReplyToThisInstance()|];
22+
23+
var sendOptions = new SendOptions();
24+
[|sendOptions.RouteReplyToThisInstance()|];
25+
}}
26+
}}";
27+
28+
return Assert(AzureFunctionsDiagnostics.RouteReplyToThisInstanceNotAllowedId, source);
29+
}
30+
31+
[Test]
32+
public Task DiagnosticIsReportedForRouteToThisInstance()
33+
{
34+
var source =
35+
$@"using NServiceBus;
36+
using System;
37+
using System.Threading.Tasks;
38+
class Foo
39+
{{
40+
void Bar()
41+
{{
42+
var options = new SendOptions();
43+
[|options.RouteToThisInstance()|];
44+
}}
45+
}}";
46+
47+
return Assert(AzureFunctionsDiagnostics.RouteToThisInstanceNotAllowedId, source);
48+
}
49+
50+
[Test]
51+
public Task DiagnosticIsReportedForRouteReplyToAnyInstance()
52+
{
53+
var source =
54+
$@"using NServiceBus;
55+
using System;
56+
using System.Threading.Tasks;
57+
class Foo
58+
{{
59+
void Bar()
60+
{{
61+
var options = new SendOptions();
62+
[|options.RouteReplyToAnyInstance()|];
63+
64+
var replyOptions = new ReplyOptions();
65+
[|replyOptions.RouteReplyToAnyInstance()|];
66+
}}
67+
}}";
68+
69+
return Assert(AzureFunctionsDiagnostics.RouteReplyToAnyInstanceNotAllowedId, source);
70+
}
71+
}
72+
}

0 commit comments

Comments
 (0)