public ServiceConnectionTests(ITestOutputHelper output) : base(output) { var hubConfig = new HubConfiguration(); var protectedData = new EmptyProtectedData(); var transport = new AzureTransportManager(hubConfig.Resolver); hubConfig.Resolver.Register(typeof(IProtectedData), () => protectedData); hubConfig.Resolver.Register(typeof(ITransportManager), () => transport); _clientConnectionManager = new TestConnectionManager(); }
public ClientConnectionManagerTests() { var hubConfig = new HubConfiguration(); var protectedData = new EmptyProtectedData(); var transport = new AzureTransportManager(hubConfig.Resolver); hubConfig.Resolver.Register(typeof(IProtectedData), () => protectedData); hubConfig.Resolver.Register(typeof(ITransportManager), () => transport); _clientConnectionManager = new ClientConnectionManager(hubConfig); }
private static void RegisterServiceObjects(HubConfiguration configuration, ServiceOptions options, string applicationName, IReadOnlyList <string> hubs) { // TODO: Using IOptions looks wierd, thinking of a way removing it // share the same object all through var serviceOptions = Options.Create(options); // For safety, ALWAYS register abstract classes or interfaces // Some third-party DI frameworks such as Ninject, implicit self-binding concrete types: // https://github.com/ninject/ninject/wiki/dependency-injection-with-ninject#skipping-the-type-binding-bit--implicit-self-binding-of-concrete-types configuration.Resolver.Register(typeof(IOptions <ServiceOptions>), () => serviceOptions); var serviceProtocol = new ServiceProtocol(); configuration.Resolver.Register(typeof(IServiceProtocol), () => serviceProtocol); var provider = new EmptyProtectedData(); configuration.Resolver.Register(typeof(IProtectedData), () => provider); var endpoint = new ServiceEndpointProvider(serviceOptions.Value); configuration.Resolver.Register(typeof(IServiceEndpointProvider), () => endpoint); var scm = new ServiceConnectionManager(applicationName, hubs); configuration.Resolver.Register(typeof(IServiceConnectionManager), () => scm); var ccm = new ClientConnectionManager(configuration); configuration.Resolver.Register(typeof(IClientConnectionManager), () => ccm); var atm = new AzureTransportManager(configuration.Resolver); configuration.Resolver.Register(typeof(ITransportManager), () => atm); var parser = new SignalRMessageParser(hubs, configuration.Resolver); configuration.Resolver.Register(typeof(IMessageParser), () => parser); var smb = new ServiceMessageBus(configuration.Resolver); configuration.Resolver.Register(typeof(IMessageBus), () => smb); }