public void ResolveInSameSession() {
     var context = GetMockContext();
     var m = new PerWebSessionLifestyleManager {ContextProvider = () => context};
     var kernel = new DefaultKernel();
     var model = new ComponentModel("bla", typeof (object), typeof (object));
     var activator = kernel.CreateComponentActivator(model);
     m.Init(activator, kernel, model);
     var creationContext = new CreationContext(new DefaultHandler(model), kernel.ReleasePolicy, typeof (object), null, null);
     var instance = m.Resolve(creationContext);
     Assert.IsNotNull(instance);
     var instance2 = m.Resolve(creationContext);
     Assert.AreSame(instance, instance2);
 }
 public void ResolveInDifferentSessions() {
     var context = GetMockContext();
     var m = new PerWebSessionLifestyleManager {ContextProvider = () => context};
     var kernel = new DefaultKernel();
     var model = new ComponentModel(new ComponentName("bla", true), new List<Type> { typeof(object) }, typeof(object), null);
     var activator = kernel.CreateComponentActivator(model);
     m.Init(activator, kernel, model);
     var creationContext = new Func<CreationContext>(() => new CreationContext(new DefaultHandler(model), kernel.ReleasePolicy, typeof (object), null, null, null));
     var instance = m.Resolve(creationContext(), kernel.ReleasePolicy);
     Assert.IsNotNull(instance);
     context.Session.Abandon();
     var instance2 = m.Resolve(creationContext(), kernel.ReleasePolicy);
     Assert.AreNotSame(instance, instance2);
 }