public void GlobalSetup()
        {
            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSignalRCore();

            var provider = serviceCollection.BuildServiceProvider();

            var serviceScopeFactory = provider.GetService <IServiceScopeFactory>();

            _dispatcher = new DefaultHubDispatcher <TestHub>(
                serviceScopeFactory,
                new HubContext <TestHub>(new DefaultHubLifetimeManager <TestHub>(NullLogger <DefaultHubLifetimeManager <TestHub> > .Instance)),
                enableDetailedErrors: false,
                new Logger <DefaultHubDispatcher <TestHub> >(NullLoggerFactory.Instance));

            var pair       = DuplexPipe.CreateConnectionPair(PipeOptions.Default, PipeOptions.Default);
            var connection = new DefaultConnectionContext(Guid.NewGuid().ToString(), pair.Application, pair.Transport);

            var contextOptions = new HubConnectionContextOptions()
            {
                KeepAliveInterval = TimeSpan.Zero,
            };

            _connectionContext = new NoErrorHubConnectionContext(connection, contextOptions, NullLoggerFactory.Instance);

            _connectionContext.Protocol = new FakeHubProtocol();
        }
Exemple #2
0
 // ReSharper disable once SuggestBaseTypeForParameter
 public SimpleInjectorScopeHubDispatcher(Container container, DefaultHubDispatcher <THub> decorated)
 {
     this.container = container;
     this.decorated = decorated;
 }