public void TestWriteReadDouble() { NmsStreamMessage streamMessage = factory.CreateStreamMessage(); double value = double.MaxValue; streamMessage.WriteDouble(value); streamMessage.Reset(); Assert.AreEqual(value, streamMessage.ReadDouble(), "Value not as expected"); }
public void TestWriteDoubleReadLegal() { NmsStreamMessage streamMessage = factory.CreateStreamMessage(); double value = double.MaxValue; streamMessage.WriteDouble(value); streamMessage.Reset(); AssertGetStreamEntryEquals <double>(streamMessage, true, value); AssertGetStreamEntryEquals <string>(streamMessage, true, value.ToString(CultureInfo.InvariantCulture)); }
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)); }
public void TestWriteDoubleReadIllegal() { NmsStreamMessage streamMessage = factory.CreateStreamMessage(); double value = double.MaxValue; streamMessage.WriteDouble(value); streamMessage.Reset(); AssertGetStreamEntryThrowsMessageFormatException <bool>(streamMessage); AssertGetStreamEntryThrowsMessageFormatException <byte>(streamMessage); AssertGetStreamEntryThrowsMessageFormatException <short>(streamMessage); AssertGetStreamEntryThrowsMessageFormatException <char>(streamMessage); AssertGetStreamEntryThrowsMessageFormatException <int>(streamMessage); AssertGetStreamEntryThrowsMessageFormatException <long>(streamMessage); AssertGetStreamEntryThrowsMessageFormatException <float>(streamMessage); AssertGetStreamEntryThrowsMessageFormatException <byte[]>(streamMessage); }
public void WriteDouble(double value) { message.WriteDouble(value); }