From 90c59169a7fff74dd4bc0dfb9fdee4ab39bb9043 Mon Sep 17 00:00:00 2001 From: NTaylorMullen Date: Fri, 19 Apr 2013 12:26:17 -0700 Subject: [PATCH] Added a test to verify that dispose is calling stop on a connection and it's then aborting the active connection. #1844 --- .../Client/ConnectionFacts.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/Microsoft.AspNet.SignalR.FunctionalTests/Client/ConnectionFacts.cs b/tests/Microsoft.AspNet.SignalR.FunctionalTests/Client/ConnectionFacts.cs index a057957649..b264c36efa 100644 --- a/tests/Microsoft.AspNet.SignalR.FunctionalTests/Client/ConnectionFacts.cs +++ b/tests/Microsoft.AspNet.SignalR.FunctionalTests/Client/ConnectionFacts.cs @@ -11,6 +11,30 @@ namespace Microsoft.AspNet.SignalR.Tests { public class ConnectionFacts : HostedTest { + [Theory] + [InlineData(HostType.Memory, TransportType.ServerSentEvents)] + [InlineData(HostType.Memory, TransportType.LongPolling)] + [InlineData(HostType.IISExpress, TransportType.LongPolling)] + [InlineData(HostType.IISExpress, TransportType.ServerSentEvents)] + [InlineData(HostType.IISExpress, TransportType.Websockets)] + public void ConnectionDisposeTriggersStop(HostType hostType, TransportType transportType) + { + using (var host = CreateHost(hostType, transportType)) + { + host.Initialize(); + var connection = CreateConnection(host,"/signalr"); + + using (connection) + { + connection.Start(host.Transport).Wait(); + Assert.Equal(connection.State, Client.ConnectionState.Connected); + } + + Assert.Equal(connection.State, Client.ConnectionState.Disconnected); + } + } + + [Theory] [InlineData(HostType.IISExpress, TransportType.LongPolling)] [InlineData(HostType.IISExpress, TransportType.ServerSentEvents)]