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); }
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 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 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); }