Ejemplo n.º 1
0
        public void GetHandlersGetsAllHandlers()
        {
            var container = GetContainer();
            var sut       = new DomainEventBus(container);

            Assert.That(sut.GetHandlers <Event1>().Count, Is.EqualTo(2));
        }
Ejemplo n.º 2
0
        public void GetHandlersHasCorrectPriortyOrder()
        {
            var container = GetContainer();
            var utilities = new DomainEventBus(container);
            var sut       = utilities.GetHandlers <Event2>();

            Assert.That(sut.Count, Is.EqualTo(4));

            Assert.That(sut[0].GetType(), Is.EqualTo(typeof(Event2Handler2)), "Negative priority should be first");
            Assert.That(sut[1].GetType(), Is.EqualTo(typeof(Event2Handler3)), "Zero priority should be second");
            Assert.That(sut[2].GetType(), Is.EqualTo(typeof(Event2Handler1)), "Positive priority should be third");
            Assert.That(sut[3].GetType(), Is.EqualTo(typeof(Event2Handler4)), "Default priority (100) should be last");
        }