Esempio n. 1
0
 /// <summary>
 ///
 /// </summary>
 public void Ninject()
 {
     var ninjectLoader     = new ModuleLoader(null);
     var resolver          = new StandardBindingResolver();
     var bindingResolver   = new OpenGenericBindingResolver();
     var cache             = new Cache(null, null);
     var pipeline          = new Pipeline(null, null);
     var activationCache   = new ActivationCache(null);
     var gccp              = new GarbageCollectionCachePruner();
     var acs               = new ActivationCacheStrategy(null);
     var pis               = new PropertyInjectionStrategy(null);
     var rif               = new ReflectionInjectorFactory();
     var mis               = new MethodInjectionStrategy();
     var initStrategy      = new InitializableStrategy();
     var startableStrategy = new StartableStrategy();
     var bas               = new BindingActionStrategy();
     var ds                        = new DisposableStrategy();
     var planner                   = new Planner(null);
     var crs                       = new ConstructorReflectionStrategy(null, null);
     var selector                  = new Selector(null, null);
     var scs                       = new StandardConstructorScorer();
     var sih                       = new StandardInjectionHeuristic();
     var prs                       = new PropertyReflectionStrategy(null, null);
     var mrs                       = new MethodReflectionStrategy(null, null);
     var dvbr                      = new DefaultValueBindingResolver();
     var selfBindingResolver       = new SelfBindingResolver(null);
     var bindingPrecedenceComparer = new BindingPrecedenceComparer();
 }
        public void ZeroConstructorsOnValueType()
        {
            MockBuilderContext context = new MockBuilderContext();
            ConstructorReflectionStrategy <InjectionConstructorAttribute, DependencyAttribute> strategy =
                new ConstructorReflectionStrategy <InjectionConstructorAttribute, DependencyAttribute>();

            context.Strategies.Add(strategy);

            context.ExecuteBuildUp(typeof(ZeroStruct), null);

            Assert.IsNull(context.Policies.Get <ICreationPolicy>(typeof(ZeroStruct)));
        }
        public void OneDecoratedConstructor()
        {
            MockBuilderContext context = new MockBuilderContext();
            ConstructorReflectionStrategy <InjectionConstructorAttribute, DependencyAttribute> strategy =
                new ConstructorReflectionStrategy <InjectionConstructorAttribute, DependencyAttribute>();

            context.Strategies.Add(strategy);

            context.ExecuteBuildUp(typeof(Decorated), null);

            ICreationPolicy policy    = context.Policies.Get <ICreationPolicy>(typeof(Decorated));
            Decorated       decorated = AssertHelper.IsType <Decorated>(policy.Create(context, typeof(Decorated)));

            Assert.IsTrue(decorated.Constructor__Called);
        }
        public void ZeroConstructorsOnReferenceType()
        {
            MockBuilderContext context = new MockBuilderContext();
            ConstructorReflectionStrategy <InjectionConstructorAttribute, DependencyAttribute> strategy =
                new ConstructorReflectionStrategy <InjectionConstructorAttribute, DependencyAttribute>();

            context.Strategies.Add(strategy);

            context.ExecuteBuildUp(typeof(ZeroClass), null);

            ICreationPolicy policy = context.Policies.Get <ICreationPolicy>(typeof(ZeroClass));

            Assert.IsNotNull(policy);
            AssertHelper.IsType <ZeroClass>(policy.Create(context, typeof(ZeroClass)));
        }
        public void MultipleDecoratedConstructors()
        {
            MockBuilderContext context = new MockBuilderContext();
            ConstructorReflectionStrategy <InjectionConstructorAttribute, DependencyAttribute> strategy =
                new ConstructorReflectionStrategy <InjectionConstructorAttribute, DependencyAttribute>();

            context.Strategies.Add(strategy);

            context.ExecuteBuildUp(typeof(MultiDecorated), null);
        }