Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        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);
        }