public void CanInjectInstanceThroughFluentConfiguration() { var instance = new ClassWithNoDependencies(); store.Register(p => p.Service<IService>("test") .Instance(instance)); //TODO: Maybe clean this up. Too much implementation detail var execute = store.GetRegistrationsForService(typeof(IService)).First().Lifestyle.Execute(null); Assert.Same(instance, execute); }
public void CanInsertInstanceWithoutName() { var store = new ComponentStore(); var instance = new ClassWithNoDependencies(); store.AddInstance<IService>(instance); var container = new PandoraContainer(store); var service = container.Resolve<IService>(); Assert.Same(instance, service); }
public void CanInsertInstanceWithoutName() { var store = new ComponentStore(); var instance = new ClassWithNoDependencies(); store.AddInstance <IService>(instance); var container = new PandoraContainer(store); var service = container.Resolve <IService>(); Assert.Same(instance, service); }
public void CanInjectInstanceThroughFluentConfiguration() { var instance = new ClassWithNoDependencies(); store.Register(p => p.Service <IService>("test") .Instance(instance)); //TODO: Maybe clean this up. Too much implementation detail var execute = store.GetRegistrationsForService(typeof(IService)).First().Lifestyle.Execute(null); Assert.Same(instance, execute); }
public ClassWithDependencies(ClassWithNoDependencies dependency) { Dependency = dependency; }
public ClassWithDependencies(ClassWithNoDependencies dependency) { Dependency = dependency ?? throw new ArgumentNullException(nameof(dependency)); }