public void Create_Hub_StartsScope()
 {
     var container = new ServiceContainer();
     container.EnableSignalR();
     container.Register<SampleHub>();
     var activator = new LightInjectHubActivator(container);
     var hubDescriptor = new HubDescriptor { HubType = typeof(SampleHub) };
     using (activator.Create(hubDescriptor))
     {
         Assert.IsNotNull(container.ScopeManagerProvider.GetScopeManager().CurrentScope);
     }                       
 }
        public void Create_Hub_ReturnsHubProxy()
        {                                    
            var container = new ServiceContainer();
            container.EnableSignalR();
            container.Register<SampleHub>(new PerScopeLifetime());
            var activator = new LightInjectHubActivator(container);                     
            var hubDescriptor = new HubDescriptor { HubType = typeof(SampleHub) };
            
            var hub = activator.Create(hubDescriptor);

            Assert.IsInstanceOfType(hub, typeof(IProxy));
        }
        public void Dispose_Hub_ClosesScope()
        {
            var container = new ServiceContainer();
            container.EnableSignalR();
            container.Register<SampleHub>();
            var activator = new LightInjectHubActivator(container);
            var hubDescriptor = new HubDescriptor { HubType = typeof(SampleHub) };

            var hub = activator.Create(hubDescriptor);

            hub.Dispose();

            Assert.IsNull(container.ScopeManagerProvider.GetScopeManager().CurrentScope);
        }
Beispiel #4
0
        public void Create_Hub_ReturnsHubProxy()
        {
            var container = new ServiceContainer();

            container.EnableSignalR();
            container.Register <SampleHub>(new PerScopeLifetime());
            var activator     = new LightInjectHubActivator(container);
            var hubDescriptor = new HubDescriptor {
                HubType = typeof(SampleHub)
            };

            var hub = activator.Create(hubDescriptor);

            Assert.IsInstanceOfType(hub, typeof(IProxy));
        }
Beispiel #5
0
        public void Create_Hub_StartsScope()
        {
            var container = new ServiceContainer();

            container.EnableSignalR();
            container.Register <SampleHub>();
            var activator     = new LightInjectHubActivator(container);
            var hubDescriptor = new HubDescriptor {
                HubType = typeof(SampleHub)
            };

            using (activator.Create(hubDescriptor))
            {
                Assert.IsNotNull(container.ScopeManagerProvider.GetScopeManager().CurrentScope);
            }
        }
Beispiel #6
0
        public void Dispose_Hub_ClosesScope()
        {
            var container = new ServiceContainer();

            container.EnableSignalR();
            container.Register <SampleHub>();
            var activator     = new LightInjectHubActivator(container);
            var hubDescriptor = new HubDescriptor {
                HubType = typeof(SampleHub)
            };

            var hub = activator.Create(hubDescriptor);

            hub.Dispose();

            Assert.IsNull(container.ScopeManagerProvider.GetScopeManager().CurrentScope);
        }