예제 #1
0
        private void UpdateSpyPolicy(IBuilderContext context)
        {
            SpyPolicy policy = context.Policies.Get <SpyPolicy>(context.BuildKey);

            if (policy != null)
            {
                policy.WasSpiedOn = true;
            }
        }
예제 #2
0
 public void Ext_CanAddPolicy()
 {
     SpyStrategy spy = new SpyStrategy();
     SpyPolicy spyPolicy = new SpyPolicy();
     SpyExtension extension =
         new SpyExtension(spy, UnityBuildStage.PostInitialization, spyPolicy, typeof(SpyPolicy));
     IUnityContainer container = new UnityContainer()
         .AddExtension(extension);
     container.Resolve<object>();
     
     Assert.IsTrue(spyPolicy.WasSpiedOn);
 }