Example #1
0
 /// <summary>
 /// Inject dependencies into 'this' instance (that is, this test instance).
 /// </summary>
 /// <remarks>
 /// <p>The default implementation populates protected variables if the
 /// <see cref="PopulateProtectedVariables"/> property is set, else
 /// uses autowiring if autowiring is switched on (which it is by default).</p>
 /// <p>You can certainly override this method if you want to totally control
 /// how dependencies are injected into 'this' instance.</p>
 /// </remarks>
 protected virtual void InjectDependencies()
 {
     if (PopulateProtectedVariables)
     {
         if (managedVariableNames == null)
         {
             InitManagedVariableNames();
         }
         InjectProtectedVariables();
     }
     else if (AutowireMode != AutoWiringMode.No)
     {
         IConfigurableListableObjectFactory factory = applicationContext.ObjectFactory;
         ((AbstractObjectFactory)factory).IgnoreDependencyType(typeof(AutoWiringMode));
         factory.AutowireObjectProperties(this, AutowireMode, DependencyCheck);
     }
 }