Exemple #1
0
 protected Hub()
 {
     Clients = new HubConnectionContext();
     Clients.All = new NullClientProxy();
     Clients.Others = new NullClientProxy();
     Clients.Caller = new NullClientProxy();
 }
        public void Clients_ReturnsHubContextsClients()
        {
            Mock<IHubContext> mockContext = new Mock<IHubContext>();
            IHubConnectionContext clients = new HubConnectionContext();
            mockContext.Setup(mock => mock.Clients).Returns(clients);
            var controller = new HubContextController(mockContext.Object);

            Assert.Same(clients, controller.Clients);
        }
Exemple #3
0
 protected Hub()
 {
     Clients = new HubConnectionContext
         {
             All = new NullClientProxy(),
             Others = new NullClientProxy(),
             Caller = new NullClientProxy()
         };
 }
        public TestableHub(HubConnectionContext clients)
        {
            var mockCookies = new Mock<IRequestCookieCollection>();

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

            Context = new HubCallerContext(mockRequest.Object, ConnectionId);

            Clients = clients;
        }
        public TestableLoadHub()
        {
            const string connectionId = "1234";
            const string hubName = "LoadHub";
            var resolver = new DefaultDependencyResolver();
            Config = resolver.Resolve<IConfigurationManager>();

            var mockConnection = new Mock<IConnection>();
            var mockUser = new Mock<IPrincipal>();
            var mockHubPipelineInvoker = new Mock<IHubPipelineInvoker>();

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

            var tracker = new StateChangeTracker();

            Clients = new HubConnectionContext(mockHubPipelineInvoker.Object, mockConnection.Object, hubName, connectionId, tracker);
            Context = new HubCallerContext(mockRequest.Object, connectionId);
        }
Exemple #6
0
 protected Hub()
 {
     Clients = new HubConnectionContext();
 }
        public void Start(HubConnectionContext clients)
        {
            Clients = clients;

            cpuCounter = new PerformanceCounter
            {
                CategoryName = "Processor",
                CounterName = "% Processor Time",
                InstanceName = "_Total"
            };

            _timer = new Timer(UpdateCpuUsage, null, _updateInterval, _updateInterval);
        }
 public void GroupThrowsNullExceptionWhenGroupNameIsNull()
 {
     var hubConContext = new HubConnectionContext();
     Assert.Throws<ArgumentException>(() => hubConContext.Group(null));
 }
 public void ClientThrowsNullExceptionWhenClientIdIsNull()
 {
     var hubConContext = new HubConnectionContext();
     Assert.Throws<ArgumentException>(() => hubConContext.Client(null));
 }
Exemple #10
0
 public FileSystemHubTest(IEnvironment environment, ITracer tracer, HubCallerContext context,
     IGroupManager group, HubConnectionContext clients) : base(environment, tracer)
 {
     Context = context;
     Groups = group;
     Clients = clients;
 }
Exemple #11
0
 protected HubBase()
 {
     HubClients = new HubConnectionContext();
 }
 public PerguntasHubMock(HubConnectionContext clientsMock, dynamic allMock)
 {
     this.Clients = clientsMock;
     this.Clients.All = allMock;
 }
Exemple #13
0
 protected HubBase()
 {
     HubClients = new HubConnectionContext();
 }