public void TestWriteReadByte()
        {
            NmsStreamMessage streamMessage = factory.CreateStreamMessage();

            byte value = 6;

            streamMessage.WriteByte(value);
            streamMessage.Reset();

            Assert.AreEqual(value, streamMessage.ReadByte(), "Value not as expected");
        }
        private object GetStreamEntryUsingTypeMethod(NmsStreamMessage testMessage, Type type, byte[] destination)
        {
            if (type == typeof(bool))
            {
                return(testMessage.ReadBoolean());
            }
            if (type == typeof(byte))
            {
                return(testMessage.ReadByte());
            }
            if (type == typeof(char))
            {
                return(testMessage.ReadChar());
            }
            if (type == typeof(short))
            {
                return(testMessage.ReadInt16());
            }
            if (type == typeof(int))
            {
                return(testMessage.ReadInt32());
            }
            if (type == typeof(long))
            {
                return(testMessage.ReadInt64());
            }
            if (type == typeof(float))
            {
                return(testMessage.ReadSingle());
            }
            if (type == typeof(double))
            {
                return(testMessage.ReadDouble());
            }
            if (type == typeof(string))
            {
                return(testMessage.ReadString());
            }
            if (type == typeof(byte[]))
            {
                return(testMessage.ReadBytes(destination));
            }

            throw new Exception("Unexpected entry type class");
        }
Example #3
0
 public byte ReadByte()
 {
     return(message.ReadByte());
 }