public void SetUp()
        {
            _persistance = new Mock<IDeadLetterPersistance>();
            _messageReadyHandler = new Mock<EventHandler<Message>>();

            target = new FailureChannel(_persistance.Object);
            target.MessageReadyForRetry += _messageReadyHandler.Object;
        }
        public static IEventFeedSubscription AsASubscriber(string endpoint, string connectionStringName, Type[] eventTypes, Type[] handlerTypes)
        {
            var handlerCollection = new HandlerCollection();
            handlerCollection.AddRange(handlerTypes);

            var deserializer = new SimpleXmlMessageSerializaion { MessageTypes = eventTypes };

            var subscriberPersistance = new Subscriber.Persistance.SqlPersistance(connectionStringName);

            var failureChannel = new FailureChannel(subscriberPersistance)
            {
                PollingInterval = new TimeSpan(0, 1, 0)
            };

            var processingChannel = new ProcessingChannel(deserializer, handlerCollection);

            var subscription = new EventFeedObserver(new Uri(endpoint), new AtomFormatter(), new FeedChainFactory(), subscriberPersistance)
            {
                PollingInterval = new TimeSpan(0, 1, 0)
            };

            //deadletter messages when they fail
            processingChannel.MessageFailed += (sender, args) => failureChannel.DeadLetter(args.Message, args.Exception);

            //process messages in handlers when they're picked up from the feed
            subscription.EventReceived += processingChannel.ProcessEvent;

            //process failed messages again when they're reader
            failureChannel.MessageReadyForRetry += processingChannel.ProcessEvent;

            //remove failed messages once they're successfully processed
            processingChannel.MessageProcessed += (sender, message) => failureChannel.ClearFailure(message);

            failureChannel.Poll();

            return subscription;
        }