public void SendDefaultMessage()
        {
            string path = MQUtil.CreateQueueName();
            Thingy body = new Thingy();

            body.MyProperty1 = 42;
            body.MyProperty2 = "Something";
            body.MyProperty3 = "Something else";
            Message m1 = new Message(body);

            Assert.IsNull(m1.Formatter);

            MessageQueue q = MQUtil.GetQueue(path, new XmlMessageFormatter());

            q.Send(m1);

            Message m2 = q.Receive();

            m2.Formatter = new XmlMessageFormatter(new Type[] { typeof(Thingy) });
            Assert.IsNotNull(m2.Formatter);
            Assert.AreEqual(typeof(XmlMessageFormatter), m2.Formatter.GetType());
            Thingy body2 = (Thingy)m2.Formatter.Read(m2);

            Assert.AreEqual(body.MyProperty1, body2.MyProperty1);
            Assert.AreEqual(body.MyProperty2, body2.MyProperty2);
            Assert.AreEqual(body.MyProperty3, body2.MyProperty3);
        }
        public void SendBinaryMessage()
        {
            Thingy body = new Thingy();

            body.MyProperty1 = 42;
            body.MyProperty2 = "Something";
            body.MyProperty3 = "Something else";
            Message m1 = new Message(body);

            m1.Formatter = new BinaryMessageFormatter();

            MessageQueue q = MQUtil.GetQueue();

            q.Send(m1);

            Message m2 = q.Receive();

            m2.Formatter = new BinaryMessageFormatter();
            Assert.IsNotNull(m2.Formatter);
            Assert.AreEqual(typeof(BinaryMessageFormatter), m2.Formatter.GetType());
            Thingy body2 = (Thingy)m2.Formatter.Read(m2);

            Assert.AreEqual(body.MyProperty1, body2.MyProperty1);
            Assert.AreEqual(body.MyProperty2, body2.MyProperty2);
            Assert.AreEqual(body.MyProperty3, body2.MyProperty3);
        }
        public void SendBinaryObject()
        {
            Thingy body = new Thingy();

            body.MyProperty1 = 42;
            body.MyProperty2 = "Something";
            body.MyProperty3 = "Something else";

            MessageQueue q = MQUtil.GetQueue();

            q.Formatter = new BinaryMessageFormatter();

            q.Send(body);

            Message m2    = q.Receive();
            Thingy  body2 = (Thingy)m2.Body;

            Assert.AreEqual(typeof(BinaryMessageFormatter), m2.Formatter.GetType());
            Assert.AreEqual(body.MyProperty1, body2.MyProperty1);
            Assert.AreEqual(body.MyProperty2, body2.MyProperty2);
            Assert.AreEqual(body.MyProperty3, body2.MyProperty3);
            Assert.AreEqual(768, m2.BodyType);
        }
		public void SendDefaultMessage ()
		{
			string path = MQUtil.CreateQueueName ();
			Thingy body = new Thingy ();
			body.MyProperty1 = 42;
			body.MyProperty2 = "Something";
			body.MyProperty3 = "Something else";
			Message m1 = new Message (body);
			Assert.IsNull (m1.Formatter);

			MessageQueue q = MQUtil.GetQueue (path, new XmlMessageFormatter ());

			q.Send (m1);

			Message m2 = q.Receive ();
			m2.Formatter = new XmlMessageFormatter (new Type[] { typeof (Thingy) });
			Assert.IsNotNull (m2.Formatter);
			Assert.AreEqual (typeof (XmlMessageFormatter), m2.Formatter.GetType ());
			Thingy body2 = (Thingy) m2.Formatter.Read (m2);

			Assert.AreEqual (body.MyProperty1, body2.MyProperty1);
			Assert.AreEqual (body.MyProperty2, body2.MyProperty2);
			Assert.AreEqual (body.MyProperty3, body2.MyProperty3);
		}			  
		public void SendBinaryMessage ()
		{
			Thingy body = new Thingy ();
			body.MyProperty1 = 42;
			body.MyProperty2 = "Something";
			body.MyProperty3 = "Something else";
			Message m1 = new Message (body);
			m1.Formatter = new BinaryMessageFormatter ();

			MessageQueue q = MQUtil.GetQueue ();

			q.Send (m1);

			Message m2 = q.Receive ();
			m2.Formatter = new BinaryMessageFormatter ();
			Assert.IsNotNull (m2.Formatter);
			Assert.AreEqual (typeof (BinaryMessageFormatter), m2.Formatter.GetType ());
			Thingy body2 = (Thingy) m2.Formatter.Read (m2);

			Assert.AreEqual (body.MyProperty1, body2.MyProperty1);
			Assert.AreEqual (body.MyProperty2, body2.MyProperty2);
			Assert.AreEqual (body.MyProperty3, body2.MyProperty3);
		}
		public void SendBinaryObject ()
		{
			Thingy body = new Thingy ();
			body.MyProperty1 = 42;
			body.MyProperty2 = "Something";
			body.MyProperty3 = "Something else";

			MessageQueue q = MQUtil.GetQueue ();

			q.Formatter = new BinaryMessageFormatter ();

			q.Send (body);
		   
			Message m2 = q.Receive ();
			Thingy body2 = (Thingy) m2.Body;

			Assert.AreEqual (typeof (BinaryMessageFormatter), m2.Formatter.GetType ());
			Assert.AreEqual (body.MyProperty1, body2.MyProperty1);
			Assert.AreEqual (body.MyProperty2, body2.MyProperty2);
			Assert.AreEqual (body.MyProperty3, body2.MyProperty3);
			Assert.AreEqual (768, m2.BodyType);
		}