public static HubConfiguration GetTestHubConfig(ILoggerFactory loggerFactory, params string[] hubs) { var hubConfig = GetActualHubConfig(loggerFactory); var testHub = new TestHubManager(hubs); hubConfig.Resolver.Register(typeof(IHubManager), () => testHub); return(hubConfig); }
public void TestRunAzureSignalRWithAppNameEqualToHubNameThrows() { var hubConfig = GetEmptyHubConfig(); var hubName = "hub"; var testHub = new TestHubManager(hubName); hubConfig.Resolver.Register(typeof(IHubManager), () => testHub); var ex = Assert.Throws <ArgumentException>(() => WebApp.Start(ServiceUrl, app => app.RunAzureSignalR(hubName, ConnectionString, hubConfig))); Assert.Equal("App name should not be the same as hub name.", ex.Message); }
private static HubConfiguration GetEmptyHubConfig() { var hubConfig = new HubConfiguration(); // Resolver is shared in GloblHost, use a new one instead hubConfig.Resolver = new DefaultDependencyResolver(); var testHub = new TestHubManager(); hubConfig.Resolver.Register(typeof(IHubManager), () => testHub); return(hubConfig); }
public void TestRunAzureSignalRWithAppNameEqualToHubNameThrows() { using (StartVerifiableLog(out var loggerFactory, LogLevel.Debug)) { var hubConfig = Utility.GetTestHubConfig(loggerFactory); var hubName = "hub"; var testHub = new TestHubManager(hubName); hubConfig.Resolver.Register(typeof(IHubManager), () => testHub); var ex = Assert.Throws <ArgumentException>(() => WebApp.Start(ServiceUrl, app => app.RunAzureSignalR(hubName, ConnectionString, hubConfig))); Assert.Equal("App name should not be the same as hub name.", ex.Message); } }
public void TestRunAzureSignalRWithAppNameEqualToHubNameThrows() { var hubConfig = new HubConfiguration(); // Resolver is shared in GloblHost, use a new one instead hubConfig.Resolver = new DefaultDependencyResolver(); var hubName = "hub"; var testHub = new TestHubManager(hubName); hubConfig.Resolver.Register(typeof(IHubManager), () => testHub); var ex = Assert.Throws <ArgumentException>(() => WebApp.Start(ServiceUrl, app => app.RunAzureSignalR(hubName, ConnectionString, hubConfig))); Assert.Equal("App name should not be the same as hub name.", ex.Message); }