Пример #1
0
        private MockStrategyChain GetStrategies()
        {
            MockStrategyChain chain = new MockStrategyChain();

            chain.Add(new LifetimeStrategy());
            chain.Add(new SleepingStrategy());
            chain.Add(new NewObjectStrategy());
            return(chain);
        }
Пример #2
0
        private BuilderContext GetContext(IUnityContainer container, NamedTypeBuildKey buildKey)
        {
            var strategies = new MockStrategyChain();

            strategies.Add(new ReturnContainerStrategy(container));
            PolicyList persistentPolicies = new PolicyList();
            PolicyList transientPolicies  = new PolicyList(persistentPolicies);

            return(new BuilderContext(new UnityContainer(), strategies, null, persistentPolicies, transientPolicies, buildKey, null));
        }
Пример #3
0
 private void FillStrategyChain(MockStrategyChain chain, int index)
 {
     lock (_lockObject)
     {
         if (_innerChain != null)
         {
             _innerChain.FillStrategyChain(chain, index);
         }
         chain.AddRange(_stages[index]);
     }
 }
Пример #4
0
        /// <summary>
        /// Makes a strategy chain based on this instance.
        /// </summary>
        /// <returns>A new <see cref="MockStrategyChain"/>.</returns>
        public IStrategyChain MakeStrategyChain()
        {
            lock (_lockObject)
            {
                var result = new MockStrategyChain();

                for (int index = 0; index < _stages.Length; ++index)
                {
                    FillStrategyChain(result, index);
                }

                return(result);
            }
        }
Пример #5
0
 public BuilderOnThread(MockStrategyChain strategies, IPolicyList policies)
 {
     this.strategies = strategies;
     this.policies   = policies;
 }