public void GIVE_transactional_producer_AND_no_transaction_WHEN_send_THEN_message_is_on_queue()
        {
            using (var producer = new XmsProducer(address, true))
            {
                var msg = producer.CreateTextMessage();
                msg.Text = "message";
                producer.Send(msg);
            }
            var after = XmsUtilities.GetCurrentQueueDebth(address);

            Assert.That(after, Is.EqualTo(1));
        }
        public void ShouldSendOneMessage()
        {
            using (var producer = new XmsProducer(destination, false))
            {
                var msg = producer.CreateTextMessage();
                msg.Text = "message";
                producer.Send(msg);
            }
            var after = XmsUtilities.GetCurrentQueueDebth(destination);

            Assert.That(after, Is.EqualTo(1));
        }
        public void GIVE_transactional_producer_WHEN_send_and_commited_THEN_message_is_on_queue()
        {
            using(var scope = new TransactionScope(TransactionScopeOption.Required))
            using (var producer = new XmsProducer(address, true))
            {
                var msg = producer.CreateTextMessage();
                msg.Text = "message";
                producer.Send(msg);
                scope.Complete();
            }
            var after = XmsUtilities.GetCurrentQueueDebth(address);

            Assert.That(after, Is.EqualTo(1));
        }
 public void ShouldSend100MessagesSingleThreaded()
 {
     int count = 100;
     var stop = Stopwatch.StartNew();
     using (var producer = new XmsProducer(destination, false))
     {
         foreach (var i in Enumerable.Range(0, count))
         {
             var msg = producer.CreateTextMessage();
             msg.Text = "message";
             producer.Send(msg);
         }
         stop.Stop();
     }
     var after = XmsUtilities.GetCurrentQueueDebth(destination);
     Console.WriteLine("Sent {0} messages single-threaded in {1}", count, stop.Elapsed);
     Assert.That(after, Is.EqualTo(count));
 }