protected void AddComponentConfig(String id, IConfiguration component, IConfigurationStore store)
        {
            AssertValidId(id);

            // TODO: Use import collection on type and service attribute (if they exist)

            store.AddComponentConfiguration(id, component);
        }
        public void Wiring_WhenPublisherHasAProxy_ListenerShouldStillGetTheEvents()
        {
            var config = new MutableConfiguration("component");

            config.
            CreateChild("subscribers").
            CreateChild("subscriber").
            Attribute("id", "listener").
            Attribute("event", "Event").
            Attribute("handler", "OnPublish");
            store.AddComponentConfiguration("publisher", config);

            container.AddFacility(new EventWiringFacility());

            // Registers interceptor as component
            container.Register(Component.For <CountingInterceptor>().Named("my.interceptor"));

            container.Register(Component.For <SimpleListener>().Named("listener"));

            // Publisher has a reference to interceptor
            container.Register(
                Component.For <SimplePublisher>().
                Named("publisher").
                Interceptors(new InterceptorReference("my.interceptor")).First);

            // Triggers events
            var publisher = container.Resolve <SimplePublisher>();

            publisher.Trigger();

            var interceptor = container.Resolve <CountingInterceptor>();

            Assert.AreEqual(1, interceptor.InterceptedCallsCount);

            // Assert that event was caught
            var listener = container.Resolve <SimpleListener>();

            Assert.IsTrue(listener.Listened);
            Assert.AreSame(publisher, listener.Sender);
        }
예제 #3
0
		protected static void AddComponentConfig(string id, IConfiguration component, IConfigurationStore store)
		{
			AssertValidId(id);

			// TODO: Use import collection on type and service attribute (if they exist)
			
			store.AddComponentConfiguration( id, component );
		}
예제 #4
0
 public void AddComponentConfiguration(String key, IConfiguration config)
 {
     inner.AddComponentConfiguration(key, config);
     partial.AddComponentConfiguration(key, config);
 }