コード例 #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;
 }