public void per_request_creates_new_instance_in_between_requests() { InMemoryStore = new InMemoryContextStore(); Resolver.AddDependencyInstance <IContextStore>(InMemoryStore); Resolver.AddDependency <IUnknown, JohnDoe>(DependencyLifetime.PerRequest); var firstInstance = Resolver.Resolve <IUnknown>(); Resolver.HandleIncomingRequestProcessed(); InMemoryStore.Clear(); var secondInstance = Resolver.Resolve <IUnknown>(); firstInstance.ShouldNotBeSameAs(secondInstance); }
public void per_request_creates_new_instance_in_between_requests() { InMemoryStore = new InMemoryContextStore(); Resolver.AddDependencyInstance <IContextStore>(InMemoryStore); Resolver.AddDependency <IUnknown, JohnDoe>(DependencyLifetime.PerRequest); IUnknown firstInstance; IUnknown secondInstance; using (Resolver.CreateRequestScope()) firstInstance = Resolver.Resolve <IUnknown>(); InMemoryStore.Clear(); using (Resolver.CreateRequestScope()) secondInstance = Resolver.Resolve <IUnknown>(); firstInstance.ShouldNotBeSameAs(secondInstance); }
void GivenInMemoryStore() { InMemoryStore = new InMemoryContextStore(); Resolver.AddDependencyInstance <IContextStore>(InMemoryStore); }
public void per_request_creates_new_instance_in_between_requests() { InMemoryStore = new InMemoryContextStore(); Resolver.AddDependencyInstance<IContextStore>(InMemoryStore); Resolver.AddDependency<IUnknown,JohnDoe>(DependencyLifetime.PerRequest); var firstInstance = Resolver.Resolve<IUnknown>(); Resolver.HandleIncomingRequestProcessed(); InMemoryStore.Clear(); var secondInstance = Resolver.Resolve<IUnknown>(); firstInstance.ShouldNotBeTheSameInstanceAs(secondInstance); }
void GivenInMemoryStore() { InMemoryStore = new InMemoryContextStore(); Resolver.AddDependencyInstance<IContextStore>(InMemoryStore); }