@@ -4437,6 +4437,33 @@ public async Task ClientsCallerPropertyCanBeUsedOutsideOfHub()
4437
4437
}
4438
4438
}
4439
4439
4440
+ [ Fact ]
4441
+ public async Task CanSendThroughIHubContext ( )
4442
+ {
4443
+ using ( StartVerifiableLog ( ) )
4444
+ {
4445
+ var serviceProvider = HubConnectionHandlerTestUtils . CreateServiceProvider ( null , LoggerFactory ) ;
4446
+ var connectionHandler = serviceProvider . GetService < HubConnectionHandler < MethodHub > > ( ) ;
4447
+
4448
+ using var client = new TestClient ( ) ;
4449
+
4450
+ var connectionHandlerTask = await client . ConnectAsync ( connectionHandler ) ;
4451
+
4452
+ // Wait for a connection, or for the endpoint to fail.
4453
+ await client . Connected . OrThrowIfOtherFails ( connectionHandlerTask ) . DefaultTimeout ( ) ;
4454
+
4455
+ IHubContext context = ( IHubContext ) serviceProvider . GetRequiredService < IHubContext < MethodHub > > ( ) ;
4456
+ await context . Clients . All . SendAsync ( "Send" , "test" ) ;
4457
+
4458
+ var message = await client . ReadAsync ( ) . DefaultTimeout ( ) ;
4459
+ var invocation = Assert . IsType < InvocationMessage > ( message ) ;
4460
+
4461
+ Assert . Single ( invocation . Arguments ) ;
4462
+ Assert . Equal ( "test" , invocation . Arguments [ 0 ] ) ;
4463
+ Assert . Equal ( "Send" , invocation . Target ) ;
4464
+ }
4465
+ }
4466
+
4440
4467
[ Fact ]
4441
4468
public async Task ConnectionCloseCleansUploadStreams ( )
4442
4469
{
@@ -4500,33 +4527,6 @@ public async Task SpecificHubOptionForMaximumReceiveMessageSizeIsUsedOverGlobalH
4500
4527
}
4501
4528
}
4502
4529
4503
- [ Fact ]
4504
- public async Task CanSendThroughIHubContext ( )
4505
- {
4506
- using ( StartVerifiableLog ( ) )
4507
- {
4508
- var serviceProvider = HubConnectionHandlerTestUtils . CreateServiceProvider ( null , LoggerFactory ) ;
4509
- var connectionHandler = serviceProvider . GetService < HubConnectionHandler < MethodHub > > ( ) ;
4510
-
4511
- using var client = new TestClient ( ) ;
4512
-
4513
- var connectionHandlerTask = await client . ConnectAsync ( connectionHandler ) ;
4514
-
4515
- // Wait for a connection, or for the endpoint to fail.
4516
- await client . Connected . OrThrowIfOtherFails ( connectionHandlerTask ) . DefaultTimeout ( ) ;
4517
-
4518
- IHubContext context = serviceProvider . GetRequiredService < IHubContext < MethodHub > > ( ) ;
4519
- await context . Clients . All . SendAsync ( "Send" , "test" ) ;
4520
-
4521
- var message = await client . ReadAsync ( ) . DefaultTimeout ( ) ;
4522
- var invocation = Assert . IsType < InvocationMessage > ( message ) ;
4523
-
4524
- Assert . Single ( invocation . Arguments ) ;
4525
- Assert . Equal ( "test" , invocation . Arguments [ 0 ] ) ;
4526
- Assert . Equal ( "Send" , invocation . Target ) ;
4527
- }
4528
- }
4529
-
4530
4530
[ Fact ]
4531
4531
public async Task CanSendThroughIHubContextBaseHub ( )
4532
4532
{
0 commit comments