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

            streamMessage.WriteBoolean(true);

            streamMessage.ClearBody();

            streamMessage.WriteBoolean(false);
            streamMessage.Reset();

            // check we get only the value added after the clear
            Assert.False(streamMessage.ReadBoolean(), "expected value added after the clear");

            Assert.Throws <MessageEOFException>(() => streamMessage.ReadBoolean(), "Expected exception to be thrown");
        }
        public void TestWriteReadBoolean()
        {
            NmsStreamMessage streamMessage = factory.CreateStreamMessage();
            bool             value         = true;

            streamMessage.WriteBoolean(value);
            streamMessage.Reset();

            Assert.AreEqual(value, streamMessage.ReadBoolean(), "Value not as expected");
        }
        public void TestWriteBooleanReadLegal()
        {
            NmsStreamMessage streamMessage = factory.CreateStreamMessage();

            bool value = true;

            streamMessage.WriteBoolean(value);
            streamMessage.Reset();

            AssertGetStreamEntryEquals <bool>(streamMessage, true, value);
            AssertGetStreamEntryEquals <string>(streamMessage, true, value.ToString());
        }
        public void TestSetBooleanGetIllegal()
        {
            NmsStreamMessage streamMessage = factory.CreateStreamMessage();

            bool value = true;

            streamMessage.WriteBoolean(value);
            streamMessage.Reset();

            AssertGetStreamEntryThrowsMessageFormatException <byte>(streamMessage);
            AssertGetStreamEntryThrowsMessageFormatException <short>(streamMessage);
            AssertGetStreamEntryThrowsMessageFormatException <char>(streamMessage);
            AssertGetStreamEntryThrowsMessageFormatException <int>(streamMessage);
            AssertGetStreamEntryThrowsMessageFormatException <long>(streamMessage);
            AssertGetStreamEntryThrowsMessageFormatException <float>(streamMessage);
            AssertGetStreamEntryThrowsMessageFormatException <double>(streamMessage);
            AssertGetStreamEntryThrowsMessageFormatException <byte[]>(streamMessage);
        }
Пример #5
0
 public void WriteBoolean(bool value)
 {
     message.WriteBoolean(value);
 }