public void GroupThrowsNullExceptionWhenGroupNameIsNull()
 {
     var serializer = JsonUtility.CreateDefaultSerializer();
     var counters = new SignalRPerformanceCounterManager(new Mock<ILoggerFactory>().Object);
     var connection = new Mock<IConnection>();
     var invoker = new Mock<IHubPipelineInvoker>();
     var hubContext = new HubContext(connection.Object, invoker.Object, "test");
     
     Assert.Throws<ArgumentException>(() => hubContext.Clients.Group(null));
 }
        public void GroupThrowsNullExceptionWhenGroupNameIsNull()
        {
            var serializer = JsonUtility.CreateDefaultSerializer();
            var counters   = new SignalRPerformanceCounterManager(new Mock <ILoggerFactory>().Object);
            var connection = new Mock <IConnection>();
            var invoker    = new Mock <IHubPipelineInvoker>();
            var hubContext = new HubContext(connection.Object, invoker.Object, "test");

            Assert.Throws <ArgumentException>(() => hubContext.Clients.Group(null));
        }
示例#3
0
        public void StreamManagerValidatesScaleoutConfig()
        {
            var perfCounters = new Microsoft.AspNet.SignalR.Infrastructure.PerformanceCounterManager();
            var config       = new ScaleoutConfiguration();

            config.QueueBehavior  = QueuingBehavior.Always;
            config.MaxQueueLength = 0;

            Assert.Throws <InvalidOperationException>(() => new ScaleoutStreamManager((int x, IList <Message> list) => { return(TaskAsyncHelper.Empty); },
                                                                                      (int x, ulong y, ScaleoutMessage msg) => { }, 0, new TraceSource("Stream Manager"), perfCounters, config));
        }
        public void StreamManagerValidatesScaleoutConfig()
        {
            var perfCounters = new Microsoft.AspNet.SignalR.Infrastructure.PerformanceCounterManager();
            var config = new ScaleoutConfiguration();

            config.QueueBehavior = QueuingBehavior.Always;
            config.MaxQueueLength = 0;

            Assert.Throws<InvalidOperationException>(() => new ScaleoutStreamManager((int x, IList<Message> list) => { return TaskAsyncHelper.Empty; },
                (int x, ulong y, ScaleoutMessage msg) => { }, 0, new TraceSource("Stream Manager"), perfCounters, config));
        }
        public void StreamManagerValidatesScaleoutConfig()
        {
            var loggerFactory = new Mock<ILoggerFactory>();
            var perfCounters = new SignalRPerformanceCounterManager(loggerFactory.Object);
            var config = new ScaleoutOptions();

            config.QueueBehavior = QueuingBehavior.Always;
            config.MaxQueueLength = 0;

            Assert.Throws<InvalidOperationException>(() => new ScaleoutStreamManager((int x, IList<Message> list) => { return TaskAsyncHelper.Empty; },
                (int x, ulong y, ScaleoutMessage msg) => { },
                0,
                new Mock<ILogger>().Object,
                perfCounters,
                config));
        }
示例#6
0
        public void StreamManagerValidatesScaleoutConfig()
        {
            var loggerFactory = new Mock <ILoggerFactory>();
            var perfCounters  = new SignalRPerformanceCounterManager(loggerFactory.Object);
            var config        = new ScaleoutOptions();

            config.QueueBehavior  = QueuingBehavior.Always;
            config.MaxQueueLength = 0;

            Assert.Throws <InvalidOperationException>(() => new ScaleoutStreamManager((int x, IList <Message> list) => { return(TaskAsyncHelper.Empty); },
                                                                                      (int x, ulong y, ScaleoutMessage msg) => { },
                                                                                      0,
                                                                                      new Mock <ILogger>().Object,
                                                                                      perfCounters,
                                                                                      config));
        }
示例#7
0
        public IList <string> InstallCounters()
        {
            // Delete any existing counters
            UninstallCounters();

            var counterCreationData = SignalRPerfCounterManager.GetCounterPropertyInfo()
                                      .Select(p =>
            {
                var attribute = SignalRPerfCounterManager.GetPerformanceCounterAttribute(p);
                return(new CounterCreationData(attribute.Name, attribute.Description, attribute.CounterType));
            })
                                      .ToArray();

            var createDataCollection = new CounterCreationDataCollection(counterCreationData);

            PerformanceCounterCategory.Create(SignalRPerfCounterManager.CategoryName,
                                              "SignalR application performance counters",
                                              PerformanceCounterCategoryType.MultiInstance,
                                              createDataCollection);

            return(counterCreationData.Select(c => c.CounterName).ToList());
        }