Exemplo n.º 1
0
        public async void ConnectionSubscriptionRemovedOnAbnormalDisconnect()
        {
            RedisBackplane backplane = null;

            using (var server = new SimpleMorseLServer <TestHub>((collection, builder) =>
            {
                collection.AddSingleton <IBackplane, RedisBackplane>();
                collection.Configure <ConfigurationOptions>(options =>
                {
                    options.EndPoints.Add(REDIS_URI);
                });
            }, (builder, provider) =>
            {
                backplane = (RedisBackplane)provider.GetRequiredService <IBackplane>();
            }, logger: _logger))
            {
                await server.Start(_context.PortPool);

                var client = new Client.Connection(server.Uri, logger: _logger);
                await client.StartAsync();

                client.KillConnection();

                await Task.Delay(2000);

                Assert.DoesNotContain(client.ConnectionId, backplane.Connections.Keys);
            }
        }