Example #1
0
        public void CanDefineConfigurationsForEventWiringFacility()
        {
            EmailListener listener = _container.Resolve <EmailListener>();

            Assert.IsNotNull(listener);
            Assert.IsNull(listener.Message);

            ISender sender = _container.Resolve <ISender>(typeof(EmailSender).FullName);

            Assert.IsNotNull(sender);

            sender.Send("Events are alive!");
            Assert.AreEqual("Events are alive!", listener.Message);
        }
Example #2
0
        public void CanDefineConfigurationsForEventWiringFacilityWithDynamicListeners()
        {
            foreach (string s in new string[] { "a", "b" })
            {
                EmailListener listener = _container.Resolve <EmailListener>("someListener." + s);
                Assert.IsNotNull(listener);
                Assert.IsNull(listener.Message);

                ISender sender = _container.Resolve <ISender>("somePublisher." + s);
                Assert.IsNotNull(sender);

                sender.Send("Events are alive!");
                Assert.AreEqual("Events are alive!", listener.Message);
            }
        }