public void Unsubscribe_IRouterOutputHelper_Unsubscribe_True()
        {
            var mockOutputGateway = new Mock <IOutputGateway <byte[]> >();

            _subject.Unsubscribe(SubscriptionKeyMessageFactory.CreateFromType(typeof(IMessage)).ToSubscriptorKey(), _identification, mockOutputGateway.Object);

            _mockRouterOutputHelper.Verify(x => x.Unsubscribe(It.IsAny <SubscriptionKey>(), _identification, It.IsAny <IOutputGateway <byte[]> >()));
        }
 public void SetUp()
 {
     _identification = new Identification {
         Id = "Test", Type = "Test_Type"
     };
     _senderMessageFake  = new Mock <IOutputGateway <byte[]> >();
     _senderIMessage     = new Mock <IOutputGateway <byte[]> >();
     _senderIMessageFake = new Mock <IOutputGateway <byte[]> >();
     _subscriptionKey    = SubscriptionKeyMessageFactory.CreateFromType(typeof(MessageFake)).ToSubscriptorKey();
     _key = string.Format("{0},{1}", typeof(MessageFake).FullName, typeof(MessageFake).Assembly.GetName().Name);
 }
        public void AddSenderBaseMessageTypeTest()
        {
            var senderRepository = new MemoryGatewaysRepository();

            senderRepository.AddSender(_subscriptionKey, _identification, _senderIMessage.Object);
            senderRepository.AddSender(SubscriptionKeyMessageFactory.CreateFromType(typeof(IMessageFake)).ToSubscriptorKey(), _identification, _senderIMessageFake.Object);


            var messageSenders = senderRepository.GetMessageSenders(_key);

            Assert.IsTrue(messageSenders.Count() == 2);
            Assert.IsTrue(messageSenders.Contains(_senderIMessage.Object));
            Assert.IsTrue(messageSenders.Contains(_senderIMessageFake.Object));
        }
        /// <summary>
        /// Sends the subscription message.
        /// </summary>
        private void SendSubscriptionMessage()
        {
            if (Processor is ServiceProcessor)
            {
                var serviceProcessor = Processor as ServiceProcessor;

                var subscriptionMessage = new SubscriptionMessage
                {
                    Service      = (Identification)serviceProcessor.Identification,
                    InputGateway = new EndPointMessage
                    {
                        Type =
                            serviceProcessor.InputGateway.
                            ReceiverEndPoint.Transport,
                        Uri =
                            serviceProcessor.InputGateway.
                            ReceiverEndPoint.Uri.OriginalString
                    },
                    InputControlGateway = new EndPointMessage
                    {
                        Type =
                            InputGateway.ReceiverEndPoint.
                            Transport,
                        Uri =
                            InputGateway.ReceiverEndPoint.Uri.
                            OriginalString
                    },
                    Types = new List <SubscriptionKeyMessage>()
                };

                foreach (var messageType in serviceProcessor.GetMessageTypes())
                {
                    subscriptionMessage.Types.Add(SubscriptionKeyMessageFactory.CreateFromType(messageType));
                }

                Publish(subscriptionMessage);
            }
        }