public void TestWriteReadLong() { NmsStreamMessage streamMessage = factory.CreateStreamMessage(); long value = long.MaxValue; streamMessage.WriteInt64(value); streamMessage.Reset(); Assert.AreEqual(value, streamMessage.ReadInt64(), "Value not as expected"); }
public void TestResetAppliesCorrectState() { NmsStreamMessage streamMessage = factory.CreateStreamMessage(); streamMessage.WriteDouble(24.5); streamMessage.WriteInt64(311); streamMessage.Reset(); Assert.True(streamMessage.IsReadOnlyBody); Assert.AreEqual(streamMessage.ReadDouble(), 24.5); Assert.AreEqual(streamMessage.ReadInt64(), 311); Assert.Throws <MessageNotWriteableException>(() => streamMessage.WriteInt32(33)); }
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"); }
public long ReadInt64() { return(message.ReadInt64()); }