public async void ServiceLifetimeManagerIgnoreBlazorHubProtocolTest(string functionName, Type type) { var blazorDetector = new DefaultBlazorDetector(); var protocolResolver = new DefaultHubProtocolResolver(new IHubProtocol[] { new JsonHubProtocol(), new MessagePackHubProtocol(), new CustomHubProtocol(), }, NullLogger <DefaultHubProtocolResolver> .Instance); IOptions <HubOptions> globalHubOptions = Options.Create(new HubOptions() { SupportedProtocols = new List <string>() { "json", "messagepack", MockProtocol, "json" } }); IOptions <HubOptions <TestHub> > localHubOptions = Options.Create(new HubOptions <TestHub>() { SupportedProtocols = new List <string>() { "json", "messagepack", MockProtocol } }); var serviceConnectionManager = new TestServiceConnectionManager <TestHub>(); var serviceLifetimeManager = new ServiceLifetimeManager <TestHub>(serviceConnectionManager, new ClientConnectionManager(), protocolResolver, Logger, Marker, globalHubOptions, localHubOptions, blazorDetector); await InvokeMethod(serviceLifetimeManager, functionName); Assert.Equal(1, serviceConnectionManager.GetCallCount(type)); VerifyServiceMessage(functionName, serviceConnectionManager.ServiceMessage); Assert.Equal(2, (serviceConnectionManager.ServiceMessage as MulticastDataMessage).Payloads.Count); Assert.True(blazorDetector.IsBlazor(nameof(TestHub))); }
public async void ServiceLifetimeManagerOnlyBlazorHubProtocolTest(string functionName, Type type) { var serviceConnectionManager = new TestServiceConnectionManager <TestHub>(); var blazorDetector = new DefaultBlazorDetector(); var serviceLifetimeManager = MockLifetimeManager(serviceConnectionManager, null, blazorDetector); await InvokeMethod(serviceLifetimeManager, functionName); Assert.Equal(1, serviceConnectionManager.GetCallCount(type)); VerifyServiceMessage(functionName, serviceConnectionManager.ServiceMessage); Assert.Equal(1, (serviceConnectionManager.ServiceMessage as MulticastDataMessage).Payloads.Count); Assert.True(blazorDetector.IsBlazor(nameof(TestHub))); }
public async void ServiceLifetimeManagerTest(string functionName, Type type) { var serviceConnectionManager = new TestServiceConnectionManager <TestHub>(); var blazorDetector = new DefaultBlazorDetector(); var serviceLifetimeManager = new ServiceLifetimeManager <TestHub>(serviceConnectionManager, new ClientConnectionManager(), HubProtocolResolver, Logger, Marker, _globalHubOptions, _localHubOptions, blazorDetector); await InvokeMethod(serviceLifetimeManager, functionName); Assert.Equal(1, serviceConnectionManager.GetCallCount(type)); VerifyServiceMessage(functionName, serviceConnectionManager.ServiceMessage); Assert.Equal(2, (serviceConnectionManager.ServiceMessage as MulticastDataMessage).Payloads.Count); Assert.False(blazorDetector.IsBlazor(nameof(TestHub))); }