public void Returns_same_object_for_different_handlers()
        {
            var assignee = new SimpleSubscriber();
            var handler = new MultiHandler();

            assignee.Subscribe(handler);

            var messageHandlers = assignee.ResolveHandlersFor(typeof(TestMessage));
            var anotherMessageHandlers = assignee.ResolveHandlersFor(typeof(AnotherMessage));

            CollectionAssert.AreEqual(messageHandlers, anotherMessageHandlers);
        }
        public void Subscribe_adds_it_to_the_source_so_it_can_be_resolved()
        {
            var assignee = new SimpleSubscriber();
            var handler = new TestHandler();
            assignee.Subscribe(handler);

            var handlers = assignee.ResolveHandlersFor(typeof(TestMessage));

            Assert.That(handlers, Has.Member(handler));
        }
        public void Unsubscribe_removes_it_from_source_so_it_could_be_resolved()
        {
            var assignee = new SimpleSubscriber();
            var handler = new TestHandler();
            assignee.Subscribe(handler);
            assignee.Unsubscribe(handler);

            var handlers = assignee.ResolveHandlersFor(typeof(TestMessage));

            Assert.That(handlers, Has.No.Member(handler));
        }
        public void Subscribe_will_not_add_same_object_twice()
        {
            var assignee = new SimpleSubscriber();
            var handler = new TestHandler();
            assignee.Subscribe(handler);
            assignee.Subscribe(handler);

            IEnumerable handlers = assignee.ResolveHandlersFor(typeof(TestMessage));

            Assert.That(handlers, Has.Member(handler));
            //Assert.That(handlers.Count(), Is.EqualTo(1));
        }