public IServiceLocator GetContainer(DotlessConfiguration configuration) { Container = new PandoraContainer(); Container.Register(pandora => RegisterServices(pandora, configuration)); return new CommonServiceLocatorAdapter(Container); }
public IServiceLocator GetContainer(DotlessConfiguration configuration) { Container = new PandoraContainer(); Container.Register(pandora => RegisterServices(pandora, configuration)); return(new CommonServiceLocatorAdapter(Container)); }
public void CanRegisterOnContainerWithoutStore() { container.Register(p => p.Service <IService>() .Implementor <ClassWithNoDependencies>()); var service = container.Resolve <IService>(); Assert.IsType <ClassWithNoDependencies>(service); }
public void RetrievalByNameThrowsExceptionWhenNameNotRegistered() { var store = new ComponentStore(); var container = new PandoraContainer(store); //To make it lookup something container.Register(p => p.Service<ClassWithNoDependencies>() .Implementor<ClassWithNoDependencies>()); Assert.Throws<ServiceNotFoundException>(() => container.Resolve<ClassWithNoDependencies>("test")); }
public void RetrievalByNameThrowsExceptionWhenNameNotRegistered() { var store = new ComponentStore(); var container = new PandoraContainer(store); //To make it lookup something container.Register(p => p.Service <ClassWithNoDependencies>() .Implementor <ClassWithNoDependencies>()); Assert.Throws <ServiceNotFoundException>(() => container.Resolve <ClassWithNoDependencies>("test")); }
private PandoraContainer CreateContainer(DotlessConfiguration configuration) { var container = new PandoraContainer(); container.Register(p => { p.Service<ILessSource>() .Implementor(configuration.LessSource); p.Service<ICache>() .Implementor<CssCache>(); p.Service<IRequest>() .Implementor<Request>(); p.Service<IResponse>() .Implementor<CssResponse>(); if (configuration.CacheEnabled) { p.Service<ILessEngine>() .Implementor<AspCacheDecorator>(); } }); return RegisterCoreServices(container, configuration); }
private PandoraContainer RegisterCoreServices(PandoraContainer container, DotlessConfiguration configuration) { container.Register(p => { if (configuration.MinifyOutput) { p.Service<ILessEngine>() .Implementor<MinifierDecorator>(); } p.Service<ILessEngine>() .Implementor<ExtensibleEngine>(); p.Service<ILessSource>() .Implementor<FileSource>(); }); return container; }