public void HubNamesAreNotCaseSensitive(HostType hostType, TransportType transportType, MessageBusType messageBusType) { using (var host = CreateHost(hostType, transportType)) { host.Initialize(messageBusType: messageBusType); HubConnection hubConnection = CreateHubConnection(host); using (hubConnection) { IHubProxy proxy = hubConnection.CreateHubProxy("chatHub"); var wh = new ManualResetEvent(false); proxy.On("addMessage", data => { Assert.Equal("hello", data); wh.Set(); }); hubConnection.Start(host.Transport).Wait(); proxy.InvokeWithTimeout("Send", "hello"); Assert.True(wh.WaitOne(TimeSpan.FromSeconds(10))); } } }
public void UnableToCreateHubThrowsError(HostType hostType, TransportType transportType) { using (var host = CreateHost(hostType, transportType)) { host.Initialize(); var hubConnection = new HubConnection(host.Url); IHubProxy proxy = hubConnection.CreateHubProxy("MyHub2"); hubConnection.Start(host.Transport).Wait(); var ex = Assert.Throws <AggregateException>(() => proxy.InvokeWithTimeout("Send", "hello")); } }
//[InlineData(HostType.Memory, TransportType.ServerSentEvents, MessageBusType.Fake)] //[InlineData(HostType.Memory, TransportType.ServerSentEvents, MessageBusType.FakeMultiStream)] //[InlineData(HostType.Memory, TransportType.LongPolling, MessageBusType.Default)] //[InlineData(HostType.Memory, TransportType.LongPolling, MessageBusType.Fake)] //[InlineData(HostType.Memory, TransportType.LongPolling, MessageBusType.FakeMultiStream)] public async Task UnableToCreateHubThrowsError(HostType hostType, TransportType transportType, MessageBusType messageBusType) { using (var host = CreateHost(hostType, transportType)) { host.Initialize(messageBusType: messageBusType); HubConnection hubConnection = CreateHubConnection(host); using (hubConnection) { IHubProxy proxy = hubConnection.CreateHubProxy("MyHub2"); await hubConnection.Start(host.Transport); var ex = Assert.Throws <AggregateException>(() => proxy.InvokeWithTimeout("Send", "hello")); } } }
public void EndToEndTest(HostType hostType, TransportType transportType) { using (var host = CreateHost(hostType, transportType)) { host.Initialize(); var hubConnection = new HubConnection(host.Url); IHubProxy proxy = hubConnection.CreateHubProxy("ChatHub"); var wh = new ManualResetEvent(false); proxy.On("addMessage", data => { Assert.Equal("hello", data); wh.Set(); }); hubConnection.Start(host.Transport).Wait(); proxy.InvokeWithTimeout("Send", "hello"); Assert.True(wh.WaitOne(TimeSpan.FromSeconds(5))); } }