public async Task InvokeAllAsync_ForSpecificHub_WithMultipleServers_WritesTo_AllConnections_Output() { var manager1 = new OrleansHubLifetimeManager <MyHub>(new LoggerFactory().CreateLogger <OrleansHubLifetimeManager <MyHub> >(), this._fixture.ClientProvider); var manager2 = new OrleansHubLifetimeManager <MyHub>(new LoggerFactory().CreateLogger <OrleansHubLifetimeManager <MyHub> >(), this._fixture.ClientProvider); var manager3 = new OrleansHubLifetimeManager <DifferentHub>(new LoggerFactory().CreateLogger <OrleansHubLifetimeManager <DifferentHub> >(), this._fixture.ClientProvider); using (var client1 = new TestClient()) using (var client2 = new TestClient()) using (var client3 = new TestClient()) { var connection1 = HubConnectionContextUtils.Create(client1.Connection); var connection2 = HubConnectionContextUtils.Create(client2.Connection); var connection3 = HubConnectionContextUtils.Create(client3.Connection); await manager1.OnConnectedAsync(connection1); await manager2.OnConnectedAsync(connection2); await manager3.OnConnectedAsync(connection3); await manager1.SendAllAsync("Hello", new object[] { "World" }); await AssertMessageAsync(client1); await AssertMessageAsync(client2); Assert.Null(client3.TryRead()); } }
public async Task HubUsingGenericBase_NonInterfaceMatchingNaming_Output() { using (var client1 = new TestClient()) { var manager = new OrleansHubLifetimeManager <DaHubUsingBase>(new LoggerFactory().CreateLogger <OrleansHubLifetimeManager <DaHubUsingBase> >(), _fixture.ClientProvider); var connection1 = HubConnectionContextUtils.Create(client1.Connection); await manager.OnConnectedAsync(connection1).OrTimeout(); await manager.SendAllAsync("Hello", new object[] { "World" }).OrTimeout(); await AssertMessageAsync(client1); } }
public async Task InvokeAllAsync_WritesTo_AllConnections_Output() { using (var client1 = new TestClient()) using (var client2 = new TestClient()) { var manager = new OrleansHubLifetimeManager <MyHub>(new LoggerFactory().CreateLogger <OrleansHubLifetimeManager <MyHub> >(), this._fixture.ClientProvider); var connection1 = HubConnectionContextUtils.Create(client1.Connection); var connection2 = HubConnectionContextUtils.Create(client2.Connection); await manager.OnConnectedAsync(connection1).OrTimeout(); await manager.OnConnectedAsync(connection2).OrTimeout(); await manager.SendAllAsync("Hello", new object[] { "World" }).OrTimeout(); await AssertMessageAsync(client1); await AssertMessageAsync(client2); } }
public async Task InvokeAllAsync_DoesNotWriteTo_DisconnectedConnections_Output() { using (var client1 = new TestClient()) using (var client2 = new TestClient()) { var manager = new OrleansHubLifetimeManager <MyHub>(new LoggerFactory().CreateLogger <OrleansHubLifetimeManager <MyHub> >(), _fixture.ClientProvider); var connection1 = HubConnectionContextUtils.Create(client1.Connection); var connection2 = HubConnectionContextUtils.Create(client2.Connection); await manager.OnConnectedAsync(connection1); await manager.OnConnectedAsync(connection2); await manager.OnDisconnectedAsync(connection2); await manager.SendAllAsync("Hello", new object[] { "World" }); await AssertMessageAsync(client1); Assert.Null(client2.TryRead()); } }