33 using System ;
44 using System . Threading . Tasks ;
55 using AcceptanceTesting . EndpointTemplates ;
6- using Microsoft . Extensions . DependencyInjection ;
76 using NServiceBus ;
87 using NServiceBus . AcceptanceTesting ;
98 using NUnit . Framework ;
109 using ServiceControl . AcceptanceTesting ;
11- using Conventions = NServiceBus . AcceptanceTesting . Customization . Conventions ;
1210
1311 class When_querying_disconnected_count : AcceptanceTest
1412 {
@@ -24,16 +22,19 @@ public async Task Should_report_via_http()
2422
2523 await Define < TestContext > ( ctx => context = ctx )
2624 . WithEndpoint < MonitoredEndpoint > ( b =>
27- b . CustomConfig ( c => c . EnableMetrics ( ) . SendMetricDataToServiceControl ( Settings . DEFAULT_INSTANCE_NAME , TimeSpan . FromMilliseconds ( 200 ) , "First" ) ) )
25+ b . CustomConfig ( c => c . EnableMetrics ( ) . SendMetricDataToServiceControl ( Settings . DEFAULT_INSTANCE_NAME , TimeSpan . FromMilliseconds ( 200 ) , "First" ) )
26+ . ToCreateInstance ( ( services , configuration ) => EndpointWithExternallyManagedContainer . Create ( configuration , services ) , async ( startableEndpoint , provider , ct ) =>
27+ {
28+ context . FirstInstance = await startableEndpoint . Start ( provider , ct ) ;
29+ return context . FirstInstance ;
30+ } ) )
2831 . WithEndpoint < MonitoredEndpoint > ( b =>
29- b . CustomConfig ( c => c . EnableMetrics ( ) . SendMetricDataToServiceControl ( Settings . DEFAULT_INSTANCE_NAME , TimeSpan . FromMilliseconds ( 200 ) , "Second" ) ) )
30- . WithServiceResolve ( ( provider , _ ) =>
31- {
32- var endpointName = Conventions . EndpointNamingConvention ( typeof ( MonitoredEndpoint ) ) ;
33- context . FirstInstance = provider . GetRequiredKeyedService < IEndpointInstance > ( $ "{ endpointName } 1") ;
34- context . SecondInstance = provider . GetRequiredKeyedService < IEndpointInstance > ( $ "{ endpointName } 2") ;
35- return Task . CompletedTask ;
36- } )
32+ b . CustomConfig ( c => c . EnableMetrics ( ) . SendMetricDataToServiceControl ( Settings . DEFAULT_INSTANCE_NAME , TimeSpan . FromMilliseconds ( 200 ) , "Second" ) )
33+ . ToCreateInstance ( ( services , configuration ) => EndpointWithExternallyManagedContainer . Create ( configuration , services ) , async ( startableEndpoint , provider , ct ) =>
34+ {
35+ context . SecondInstance = await startableEndpoint . Start ( provider , ct ) ;
36+ return context . SecondInstance ;
37+ } ) )
3738 . Done ( async c =>
3839 {
3940 if ( ! c . WaitedInitial2Seconds )
0 commit comments