public void Adding_then_removing_instance_will_result_in_no_subscriptions()
 {
     var strategy = new FlatQueueStrategy(new EndpointRouter(),
                                          testQueueEndPoint.Uri);
     SubscriptionTest.Test(Transport, strategy,
                           testQueueEndPoint, queue.Send, subscriptions.GetMessageEnumerator2);
 }
 public void Moving_to_subscription_queue_does_nothing()
 {
     var queueStrategy = new FlatQueueStrategy(TestQueueUri);
     queue.Send(new TestMessage {Name = "ayende"});
     Message msg = queue.Peek();
     Assert.Equal(1, queue.GetCount());
     queueStrategy.MoveToSubscriptionQueue(queue, msg);
     Assert.Equal(1, queue.GetCount());
 }
 public void Moving_to_errors_queue_removes_message_from_subscriptions_queue()
 {
     var queueStrategy = new FlatQueueStrategy(TestQueueUri);
     queue.Send(new TestMessage {Name = "ayende"});
     Message msg = queue.Peek();
     Assert.Equal(1, queue.GetCount());
     queueStrategy.MoveToErrorsQueue(queue, msg);
     Assert.Equal(0, queue.GetCount());
 }
        public void Moving_to_subscription_queue_removes_message_from_root_queue()
        {
            var queueStrategy = new FlatQueueStrategy(new EndpointRouter(), testQueueEndPoint.Uri);
			openedQueue.Send(new Message(new TestMessage { Name = "ayende" }));
            Message msg = openedQueue.Peek(TimeSpan.FromSeconds(30));
            Assert.Equal(1, openedQueue.GetMessageCount());
            string msgId;
            queueStrategy.TryMoveMessage(openedQueue, msg, SubQueue.Subscriptions,out msgId);
            Assert.Equal(0, openedQueue.GetMessageCount());
        }
 public void Can_start_bus()
 {
     var address = Dns.GetHostAddresses(Environment.MachineName)
         .First(x => x.ToString().Contains(":") == false);
     var endpoint = new Uri("msmq://" + address + "/test_queue");
     var flatQueueStrategy = new FlatQueueStrategy(new EndpointRouter(),
                                                   endpoint);
     flatQueueStrategy.InitializeQueue(new Endpoint
     {
         Uri = endpoint
     }, QueueType.Standard);
 }
		public void Moving_to_errors_queue_directly_move_message_to_errors()
		{
			var queueStrategy = new FlatQueueStrategy(new EndpointRouter(), testQueueEndPoint.Uri);
			openedQueue.Send(new Message(new TestMessage { Name = "ayende" }));
			Message msg = openedQueue.Receive();
			queueStrategy.SendToErrorQueue(openedQueue, msg);

			using(var errQueue = new MessageQueue(testQueuePath +"#errors"))
			{
				var message = errQueue.Peek(TimeSpan.FromMilliseconds(250));
				Assert.NotNull(message);
			}
		}
			public void When_bitconverter_offset_in_GetTimeoutMessages_is_16()
			{
				var queueStrategy = new FlatQueueStrategy(new EndpointRouter(), testQueueEndPoint.Uri);
				var dateToMatch = DateTime.Now;

				// Create the message
				var message = new Message("Wes");
				// Set the extension
				var bytes = new List<byte>();
				bytes.AddRange(Guid.NewGuid().ToByteArray());
				bytes.AddRange(BitConverter.GetBytes(dateToMatch.ToBinary()));
				message.Extension = bytes.ToArray();

				// Send the message
				openedQueue.OpenSiblngQueue(SubQueue.Timeout, QueueAccessMode.Send).Send(message);

				// Call the GetTimeoutMessages method to verify dates
				var messageList = new List<TimeoutInfo>(queueStrategy.GetTimeoutMessages(openedQueue));

				// Check that the dates are the same
				Assert.Equal(messageList[0].Time, dateToMatch);
			}
 private IMessageAction[] DefaultMessageActions(Uri endpoint)
 {
     var qs = new FlatQueueStrategy(endpoint);
     return new IMessageAction[]
     {
         new AdministrativeAction(),
         new DiscardAction(qs),
         new ErrorAction(5, qs),
         new ErrorDescriptionAction(qs),
         new ShutDownAction(),
         new TimeoutAction(qs)
     };
 }
 private static IMsmqTransportAction[] DefaultTransportActions(Uri endpoint)
 {
     var qs = new FlatQueueStrategy(new EndpointRouter(),endpoint);
     return new IMsmqTransportAction[]
     {
         new AdministrativeAction(),
         new ErrorAction(5, qs),
         new ShutDownAction(),
         new TimeoutAction(qs)
     };
 }