public void GlobalSetup() { var ninjectSettings = new NinjectSettings { LoadExtensions = false }; var kernelConfiguration = new KernelConfiguration(ninjectSettings); kernelConfiguration.Bind <IWarrior>().To <SpecialNinja>().WhenInjectedExactlyInto <NinjaBarracks>(); kernelConfiguration.Bind <IWarrior>().To <Samurai>().WhenInjectedExactlyInto <Barracks>(); kernelConfiguration.Bind <IWarrior>().To <FootSoldier>().WhenInjectedExactlyInto <Barracks>(); kernelConfiguration.Bind <IWeapon>().To <Shuriken>().WhenInjectedExactlyInto <Barracks>(); kernelConfiguration.Bind <IWeapon>().To <ShortSword>().WhenInjectedExactlyInto <Spartan>(); _injectorFactory = new ExpressionInjectorFactory(); _contextWithParams = CreateContext(kernelConfiguration, kernelConfiguration.BuildReadOnlyKernel(), new List <IParameter> { new ConstructorArgument("height", 34), new PropertyValue("name", "cutter"), new ConstructorArgument("width", 17), new ConstructorArgument("location", "Biutiful") }, typeof(StandardConstructorScorerBenchmark), ninjectSettings); _contextWithoutParams = CreateContext(kernelConfiguration, kernelConfiguration.BuildReadOnlyKernel(), Enumerable.Empty <IParameter>(), typeof(StandardConstructorScorerBenchmark), ninjectSettings); _injectCtor = typeof(NinjaBarracks).GetConstructor(new[] { typeof(IWarrior), typeof(IWeapon) }); _injectCtorDirective = new ConstructorInjectionDirective(_injectCtor, _injectorFactory.Create(_injectCtor)); _defaultCtor = typeof(NinjaBarracks).GetConstructor(new Type[0]); _defaultCtorDirective = new ConstructorInjectionDirective(_defaultCtor, _injectorFactory.Create(_defaultCtor)); _knifeCtor = typeof(Knife).GetConstructor(new[] { typeof(int), typeof(int) }); _knifeCtorDirective = new ConstructorInjectionDirective(_knifeCtor, _injectorFactory.Create(_knifeCtor)); _knifeDefaultsCtor = typeof(Knife).GetConstructor(new[] { typeof(bool), typeof(string) }); _knifeDefaultsCtorDirective = new ConstructorInjectionDirective(_knifeDefaultsCtor, _injectorFactory.Create(_knifeDefaultsCtor)); _spartanNameAndAgeCtor = typeof(Spartan).GetConstructor(new[] { typeof(string), typeof(int) }); _spartanNameAndAgeCtorDirective = new ConstructorInjectionDirective(_spartanNameAndAgeCtor, _injectorFactory.Create(_spartanNameAndAgeCtor)); _spartanHeightAndWeaponCtor = typeof(Spartan).GetConstructor(new[] { typeof(string), typeof(int) }); _spartanHeightAndWeaponCtorDirective = new ConstructorInjectionDirective(_spartanHeightAndWeaponCtor, _injectorFactory.Create(_spartanHeightAndWeaponCtor)); _barracksCtor = typeof(Barracks).GetConstructor(new[] { typeof(IWarrior), typeof(IWeapon) }); _barracksCtorDirective = new ConstructorInjectionDirective(_barracksCtor, _injectorFactory.Create(_barracksCtor)); _monasteryCtor = typeof(Monastery).GetConstructor(new[] { typeof(IWarrior), typeof(IWeapon) }); _monasteryCtorDirective = new ConstructorInjectionDirective(_monasteryCtor, _injectorFactory.Create(_monasteryCtor)); _standardConstructorScorer = new StandardConstructorScorer(ninjectSettings); }
/// <summary> /// Initializes a new instance of the <see cref="MethodReflectionStrategy"/> class. /// </summary> /// <param name="selector">The selector component.</param> /// <param name="injectorFactory">The injector factory component.</param> public MethodReflectionStrategy(ISelector selector, IInjectorFactory injectorFactory) { Ensure.ArgumentNotNull(selector, "selector"); Ensure.ArgumentNotNull(injectorFactory, "injectorFactory"); this.Selector = selector; this.InjectorFactory = injectorFactory; }
/// <summary> /// Initializes a new instance of the <see cref="PropertyReflectionStrategy"/> class. /// </summary> /// <param name="selector">The selector component.</param> /// <param name="injectorFactory">The injector factory component.</param> public PropertyReflectionStrategy(ISelector selector, IInjectorFactory injectorFactory) { Ensure.ArgumentNotNull(selector, "selector"); Ensure.ArgumentNotNull(injectorFactory, "injectorFactory"); Selector = selector; InjectorFactory = injectorFactory; }
/// <summary> /// Initializes a new instance of the <see cref="PropertyReflectionStrategy"/> class. /// </summary> /// <param name="selector">The selector component.</param> /// <param name="injectorFactory">The injector factory component.</param> /// <exception cref="ArgumentNullException"><paramref name="selector"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentNullException"><paramref name="injectorFactory"/> is <see langword="null"/>.</exception> public PropertyReflectionStrategy(ISelector selector, IInjectorFactory injectorFactory) { Ensure.ArgumentNotNull(selector, nameof(selector)); Ensure.ArgumentNotNull(injectorFactory, nameof(injectorFactory)); this.Selector = selector; this.InjectorFactory = injectorFactory; }
/// <summary> /// Initializes a new instance of the <see cref="ConstructorReflectionStrategy"/> class. /// </summary> /// <param name="selector">The selector component.</param> /// <param name="injectorFactory">The injector factory component.</param> /// <exception cref="ArgumentNullException"><paramref name="selector"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentNullException"><paramref name="injectorFactory"/> is <see langword="null"/>.</exception> public ConstructorReflectionStrategy(ISelector selector, IInjectorFactory injectorFactory) { Ensure.ArgumentNotNull(selector, nameof(selector)); Ensure.ArgumentNotNull(injectorFactory, nameof(injectorFactory)); this.selector = selector; this.injectorFactory = injectorFactory; }
/// <summary> /// Initializes a new instance of the <see cref="ConstructorReflectionStrategy"/> class. /// </summary> /// <param name="selector">The selector component.</param> /// <param name="injectorFactory">The injector factory component.</param> /// <param name="settings">The ninject settings.</param> public ConstructorReflectionStrategy(ISelector selector, IInjectorFactory injectorFactory, INinjectSettings settings) { Ensure.ArgumentNotNull(selector, "selector"); Ensure.ArgumentNotNull(injectorFactory, "injectorFactory"); Ensure.ArgumentNotNull(settings, "settings"); this.selector = selector; this.injectorFactory = injectorFactory; this.settings = settings; }
/// <summary> /// Initializes a new instance of the <see cref="PropertyInjectionStrategy"/> class. /// </summary> /// <param name="injectorFactory">The injector factory component.</param> /// <param name="settings">The ninject settings.</param> /// <param name="exceptionFormatter">The <see cref="IExceptionFormatter"/> component.</param> /// <exception cref="ArgumentNullException"><paramref name="injectorFactory"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentNullException"><paramref name="settings"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentNullException"><paramref name="exceptionFormatter"/> is <see langword="null"/>.</exception> public PropertyInjectionStrategy(IInjectorFactory injectorFactory, INinjectSettings settings, IExceptionFormatter exceptionFormatter) { Ensure.ArgumentNotNull(injectorFactory, nameof(injectorFactory)); Ensure.ArgumentNotNull(settings, nameof(settings)); Ensure.ArgumentNotNull(exceptionFormatter, nameof(exceptionFormatter)); this.injectorFactory = injectorFactory; this.settings = settings; this.exceptionFormatter = exceptionFormatter; }
public void SetUp() { factory = new InjectorFactory (); resolver = delegate (IBinding binding){}; }
/// <summary> /// Initializes a new instance of the <see cref="MethodReflectionStrategy"/> class. /// </summary> /// <param name="selector">The selector component.</param> /// <param name="injectorFactory">The injector factory component.</param> public MethodReflectionStrategy(ISelector selector, IInjectorFactory injectorFactory) { this.Selector = selector; this.InjectorFactory = injectorFactory; }
/// <summary> /// Initializes a new instance of the <see cref="ConstructorStrategy"/> class. /// </summary> /// <param name="selector">The selector component.</param> /// <param name="injectorFactory">The injector factory component.</param> public ConstructorStrategy(ISelector selector, IInjectorFactory injectorFactory) { Selector = selector; InjectorFactory = injectorFactory; }
/// <summary> /// Initializes a new instance of the <see cref="PropertyReflectionStrategy"/> class. /// </summary> /// <param name="selector">The selector component.</param> /// <param name="injectorFactory">The injector factory component.</param> public PropertyReflectionStrategy(ISelector selector, IInjectorFactory injectorFactory) { this.Selector = selector; this.InjectorFactory = injectorFactory; }
/// <summary> /// Initializes a new instance of the <see cref="PropertyInjectionStrategy"/> class. /// </summary> /// <param name="injectorFactory">The injector factory component.</param> public PropertyInjectionStrategy(IInjectorFactory injectorFactory) { InjectorFactory = injectorFactory; }
public void SetUp() { factory = new InjectorFactory(); resolver = delegate(IBinding binding){}; }
/// <summary> /// Initializes a new instance of the <see cref="PropertyStrategy"/> class. /// </summary> /// <param name="selector">The selector component.</param> /// <param name="injectorFactory">The injector factory component.</param> public PropertyStrategy(ISelector selector, IInjectorFactory injectorFactory) { Selector = selector; InjectorFactory = injectorFactory; }
/// <summary> /// Initializes a new instance of the <see cref="NewActivationPropertyInjectStrategy"/> class. /// </summary> /// <param name="injectorFactory">The injector factory component.</param> public NewActivationPropertyInjectStrategy(IInjectorFactory injectorFactory) : base(injectorFactory) { }
/// <summary> /// Initializes a new instance of the <see cref="MethodStrategy"/> class. /// </summary> /// <param name="selector">The selector component.</param> /// <param name="injectorFactory">The injector factory component.</param> public MethodStrategy(ISelector selector, IInjectorFactory injectorFactory) { Selector = selector; InjectorFactory = injectorFactory; }
/// <summary> /// /// </summary> /// <param name="selector"></param> /// <param name="injectorFactory"></param> public EventReflectionStrategy( ISelector selector, IInjectorFactory injectorFactory ) { Selector = selector; InjectorFactory = injectorFactory; }
/// <summary> /// Initializes a new instance of the <see cref="ConstructorReflectionStrategy"/> class. /// </summary> /// <param name="selector">The selector component.</param> /// <param name="injectorFactory">The injector factory component.</param> public ConstructorReflectionStrategy(ISelector selector, IInjectorFactory injectorFactory) { this.Selector = selector; this.InjectorFactory = injectorFactory; }
/// <summary> /// Initializes a new instance of the <see cref="PropertyInjectionStrategy"/> class. /// </summary> /// <param name="injectorFactory">The injector factory component.</param> /// <param name="settings">The ninject settings.</param> public PropertyInjectionStrategy(IInjectorFactory injectorFactory, INinjectSettings settings) { this.injectorFactory = injectorFactory; this.settings = settings; }
/// <summary> /// Initializes a new instance of the <see cref="PropertyInjectionStrategy"/> class. /// </summary> /// <param name="injectorFactory">The injector factory component.</param> public PropertyInjectionStrategy(IInjectorFactory injectorFactory) { this.InjectorFactory = injectorFactory; }
/// <summary> /// /// </summary> /// <param name="selector"></param> /// <param name="injectorFactory"></param> public EventReflectionStrategy(ISelector selector, IInjectorFactory injectorFactory) { Selector = selector; InjectorFactory = injectorFactory; }
public Injector() { _factory = new InjectorFactory(); _disposed = new List <IDisposable>(1000); _deconstructed = new List <DeconstructBucket>(1000); }
/// <summary> /// Initializes a new instance of the <see cref="MockProvider"/> class. /// </summary> /// <param name="injectorFactory">The injector factory component.</param> public MockProvider(IInjectorFactory injectorFactory) { InjectorFactory = injectorFactory; }
/// <summary> /// Initializes a new instance of the <see cref="PropertyReflectionStrategy"/> class. /// </summary> /// <param name="selector">The selector component.</param> /// <param name="injectorFactory">The injector factory component.</param> public PropertyReflectionStrategy(ISelector selector, IInjectorFactory injectorFactory) { Selector = selector; InjectorFactory = injectorFactory; }