コード例 #1
0
        public async Task SendConnectionAsyncWritesToConnectionOutput(bool fromManager)
        {
            var hubProxy = new HubProxy <MyHub>(_fixture.TestCluster.Client);

            using (var manager = CreateNewHubLifetimeManager <MyHub>())
                using (var client = new TestClient())
                {
                    var connection = HubConnectionContextUtils.Create(client.Connection);

                    await manager.OnConnectedAsync(connection).OrTimeout();

                    if (fromManager)
                    {
                        await manager.SendConnectionAsync(connection.ConnectionId, "Hello", new object[] { "World" }).OrTimeout();
                    }
                    else
                    {
                        await hubProxy.SendClientAsync(connection.ConnectionId, "Hello", "World").OrTimeout();
                    }

                    await AssertMessageAsync(client);
                }
        }