Esempio n. 1
0
        public void PropertyInjectionPassesNamedParameterOfTheInstanceTypeBeingInjectedOnto()
        {
            var capturedparameters = Enumerable.Empty<Parameter>();

            var cb = new ContainerBuilder();
            cb.RegisterType<DependsByProp>().SingleInstance().PropertiesAutowired();
            cb.Register((context, parameters) => { capturedparameters = parameters.ToArray(); return new DependsByCtor(null); });

            var c = cb.Build();
            var existingInstance = new DependsByProp();
            c.InjectUnsetProperties(existingInstance);

            var instanceType = capturedparameters.Named<Type>(ResolutionExtensions.PropertyInjectedInstanceTypeNamedParameter);
            Assert.Equal(existingInstance.GetType(), instanceType);
        }
Esempio n. 2
0
 public DependsByCtor(DependsByProp o)
 {
     Dep = o;
 }
Esempio n. 3
0
 public DependsByCtor(DependsByProp o)
 {
     Dep = o;
 }