public void PrebuiltInstance(IContainerAdapter adapter) { var instance = new IndependentService(); adapter.RegisterInstance<IService>(instance); var resolved = adapter.Resolve<IService>(); Assert.Same(instance, resolved); }
public void ConstructorDependencyUsingInstance(IContainerAdapter adapter) { var instance = new IndependentService(); adapter.RegisterInstance<IService>(instance); adapter.RegisterType<ServiceWithSimpleConstructorDependency>(); var dependent = adapter.Resolve<ServiceWithSimpleConstructorDependency>(); Assert.Same(instance, dependent.Service); }
public void PrebuiltInstance(IFrameworkAdapter framework) { var instance = new IndependentService(); framework.Register <IService>(instance); var resolved = framework.Resolve <IService>(); Assert.Same(instance, resolved); }
public void PrebuiltInstance(IContainerAdapter adapter) { var instance = new IndependentService(); adapter.RegisterInstance <IService>(instance); var resolved = adapter.Resolve <IService>(); Assert.Same(instance, resolved); }
public void ConstructorDependencyUsingInstance(IFrameworkAdapter framework) { var instance = new IndependentService(); framework.Register <IService>(instance); framework.Register <ServiceWithSimpleConstructorDependency>(); var dependent = framework.Resolve <ServiceWithSimpleConstructorDependency>(); Assert.Same(instance, dependent.Service); }
public void ConstructorDependencyUsingInstance(IContainerAdapter adapter) { var instance = new IndependentService(); adapter.RegisterInstance <IService>(instance); adapter.RegisterType <ServiceWithSimpleConstructorDependency>(); var dependent = adapter.Resolve <ServiceWithSimpleConstructorDependency>(); Assert.Same(instance, dependent.Service); }
public void FactoryWithParameterForSubdependency(IContainerAdapter adapter) { adapter.RegisterType<ServiceWithSimpleConstructorDependency>(); adapter.RegisterType<ServiceWithDependencyOnServiceWithOtherDependency>(); var service = new IndependentService(); var func = adapter.Resolve<Func<IService, ServiceWithDependencyOnServiceWithOtherDependency>>(); Assert.NotNull(func); var result = func(service); Assert.NotNull(result); Assert.Same(service, result.Service.Service); }
public void FactoryWithParameterForSubdependency(IContainerAdapter adapter) { adapter.RegisterType <ServiceWithSimpleConstructorDependency>(); adapter.RegisterType <ServiceWithDependencyOnServiceWithOtherDependency>(); var service = new IndependentService(); var func = adapter.Resolve <Func <IService, ServiceWithDependencyOnServiceWithOtherDependency> >(); Assert.NotNull(func); var result = func(service); Assert.NotNull(result); Assert.Same(service, result.Service.Service); }
public DependentService2(IndependentService independentService) { this.IndependentService = independentService; }