Example #1
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);
        }
Example #2
0
        public void ExtensionCanAddPolicy()
        {
            var       spy       = new SpyStrategy();
            SpyPolicy spyPolicy = new SpyPolicy();

            SpyExtension extension =
                new SpyExtension(spy, Stage.PreCreation, spyPolicy, typeof(SpyPolicy));

            IUnityContainer container = new UnityContainer()
                                        .AddExtension(extension);

            container.Resolve <object>();

            Assert.IsTrue(spyPolicy.WasSpiedOn);
        }
Example #3
0
        public void ExtensionCanAddPolicy()
        {
            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.True(spyPolicy.WasSpiedOn);
        }