Esempio n. 1
0
        /// <summary>
        /// Gets the mock object for type T that would be injected into the constructor function
        /// of the ClassUnderTest
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public T Get <T>() where T : class
        {
            if (!_container.Model.HasDefaultImplementationFor(typeof(T)))
            {
                _container.Inject(_serviceLocator.Service <T>());
            }

            return(_container.GetInstance <T>());
        }
Esempio n. 2
0
 /// <summary>
 ///     Method to specify the exact object that will be used for
 ///     "pluginType."  Useful for stub objects and/or static mocks
 /// </summary>
 /// <param name="pluginType"></param>
 /// <param name="stub"></param>
 public void Inject(Type pluginType, object stub)
 {
     _container.Inject(pluginType, stub);
 }