Created
May 6, 2010 17:09
-
-
Save kkozmic/392401 to your computer and use it in GitHub Desktop.
Suggested fluent API for Windsor's EventWiringFacility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void Can_fluently_wire_events() | |
{ | |
container.Register(Component.For<SimplePublisher>().PublishEvent("Event", "myUniqueEventId"), | |
Component.For<SimpleListener>().SubscribeEvent("myUniqueEventId", "OnEvent")); | |
var publisher = container.Resolve<SimplePublisher>(); | |
var listener = container.Resolve<SimpleListener>(); | |
Assert.IsFalse(listener.Listened); | |
publisher.Trigger(); | |
Assert.IsTrue(listener.Listened); | |
Assert.AreSame(publisher, listener.Sender); | |
} |
Yes, I'm adding expression based API as well.
And I'm refactoring internals of the facility as well to support this decoupled structure. How do you use the facility Henry? You can send me an email if you don't want to discuss this in public. I could use some real scenario.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have something similar for the stronghold internal projects, but I still not very satisfied with this approach (strings...).
Also, we'll need to do a heavy refactoring on the facility, to support the subscribe event approach.