Skip to content

Instantly share code, notes, and snippets.

@jfromaniello
Created May 6, 2010 19:03
Show Gist options
  • Save jfromaniello/392563 to your computer and use it in GitHub Desktop.
Save jfromaniello/392563 to your computer and use it in GitHub Desktop.
[Test]
public void Can_fluently_wire_events()
{
container.Register(Component.For<SimplePublisher>().PublishEvent(sp => sp.Event += null, "myUniqueEventId"),
Component.For<SimpleListener>().SubscribeEvent("myUniqueEventId", (sl, sender, args) => sl.OnPublishEvent(sender, args) ));
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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment