Apache.NMS.ActiveMQ.Test.Commands.ActiveMQStreamMessageTest.TestReadByte C# (CSharp) Method

TestReadByte() private method

private TestReadByte ( ) : void
return void
        public void TestReadByte()
        {
            ActiveMQStreamMessage msg = new ActiveMQStreamMessage();

            byte test = (byte)4;
            msg.WriteByte(test);
            msg.Reset();
            Assert.IsTrue(msg.ReadByte() == test);
            msg.Reset();
            Assert.IsTrue(msg.ReadInt16() == test);
            msg.Reset();
            Assert.IsTrue(msg.ReadInt32() == test);
            msg.Reset();
            Assert.IsTrue(msg.ReadInt64() == test);
            msg.Reset();
            Assert.IsTrue(msg.ReadString() == (test).ToString());

            msg.Reset();
            try
            {
                msg.ReadBoolean();
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }

            msg.Reset();
            try
            {
                msg.ReadSingle();
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }

            msg.Reset();
            try
            {
                msg.ReadDouble();
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }

            msg.Reset();
            try
            {
                msg.ReadChar();
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }

            msg.Reset();
            try
            {
                msg.ReadBytes(new byte[1]);
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }
        }