/// <summary>
        /// Initializes a new instance of the <see cref="HubConnectionContext"/>.
        /// </summary>
        /// <param name="pipelineInvoker">The pipeline invoker.</param>
        /// <param name="connection">The connection.</param>
        /// <param name="hubName">The hub name.</param>
        /// <param name="connectionId">The connection id.</param>
        /// <param name="state">The connection hub state.</param>
        public HubConnectionContext(IHubPipelineInvoker pipelineInvoker, IConnection connection, string hubName, string connectionId, TrackingDictionary state)
        {
            _send = (signal, invocation, exclude) => pipelineInvoker.Send(new HubOutgoingInvokerContext(connection, signal, invocation, exclude));
            _connectionId = connectionId;
            _hubName = hubName;

            Caller = new StatefulSignalProxy(_send, connectionId, hubName, state);
            All = AllExcept();
            Others = AllExcept(connectionId);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HubConnectionContext"/>.
        /// </summary>
        /// <param name="pipelineInvoker">The pipeline invoker.</param>
        /// <param name="connection">The connection.</param>
        /// <param name="hubName">The hub name.</param>
        /// <param name="connectionId">The connection id.</param>
        /// <param name="state">The connection hub state.</param>
        public HubConnectionContext(IHubPipelineInvoker pipelineInvoker, IConnection connection, string hubName, string connectionId, TrackingDictionary state)
        {
            _send         = (signal, invocation, exclude) => pipelineInvoker.Send(new HubOutgoingInvokerContext(connection, signal, invocation, exclude));
            _connectionId = connectionId;
            _hubName      = hubName;

            Caller = new StatefulSignalProxy(_send, connectionId, hubName, state);
            All    = AllExcept();
            Others = AllExcept(connectionId);
        }
Exemplo n.º 3
0
        public TestableDebugHub(Mock<IContext> mockDbContext)
            : base(mockDbContext.Object)
        {
            const string connectionId = "1234";
            const string hubName = "debug";

            var mockConn = new Mock<IConnection>();
            var mockUser = new Mock<IPrincipal>();
            var mockCookies = new Mock<IRequestCookieCollection>();

            var mockRequest = new Mock<IRequest>();
            mockRequest.Setup(r => r.User).Returns(mockUser.Object);
            mockRequest.Setup(r => r.Cookies).Returns(mockCookies.Object);

            Clients = new ClientProxy(mockConn.Object, hubName);
            Groups = new GroupManager(mockConn.Object, hubName);
            Context = new HubCallerContext(mockRequest.Object, connectionId);

            var trackingDict = new TrackingDictionary();
            Caller = new StatefulSignalProxy(mockConn.Object, connectionId, hubName, trackingDict);
        }