Пример #1
0
        public void ConsumerWritePacketHeaderTestMethod()
        {
            HeaderReaderTest _reader = new HeaderReaderTest(m_StartPosition);
            PacketHeader     _header = PacketHeader.GetConsumerPacketHeader(_reader);

            Assert.IsNotNull(_header);
            _header.WritePacketHeader();
        }
Пример #2
0
        public void ConsumerPacketHeaderTestMethod()
        {
            HeaderReaderTest _reader = new HeaderReaderTest(m_StartPosition);
            PacketHeader     _header = PacketHeader.GetConsumerPacketHeader(_reader);

            Assert.IsNotNull(_header);
            Assert.AreEqual <byte>((byte)((byte)m_StartPosition + 0), _header.ProtocolVersion);
            Assert.AreEqual <byte>((byte)((byte)m_StartPosition + 1), _header.NetworkMessageFlags);
            Assert.AreEqual <UInt32>((UInt32)m_StartPosition + 18, _header.SecurityTokenId);
            Assert.AreEqual <byte>((byte)((byte)m_StartPosition + 22), _header.NonceLength);
            Assert.AreEqual <Guid>(CommonDefinitions.TestGuid, _header.PublisherId);
        }
Пример #3
0
 public void GetConsumerPacketHeaderTestMethod()
 {
     using (MemoryStream _stream = new MemoryStream(new ArraySegment <byte>(CommonDefinitions.GetTestBinaryArrayVariant(), 0, 27).ToArray <byte>()))
         using (PacketReader _reader = new PacketReader(_stream))
         {
             PacketHeader _header = PacketHeader.GetConsumerPacketHeader(_reader);
             Assert.IsNotNull(_header);
             Assert.AreEqual <Guid>(CommonDefinitions.TestGuid, _header.PublisherId);
             Assert.AreEqual <Byte>(110, _header.ProtocolVersion);
             Assert.AreEqual <Byte>(0, _header.NetworkMessageFlags);
             Assert.AreEqual <UInt32>(0, _header.SecurityTokenId);
             Assert.AreEqual <Byte>(1, _header.NonceLength);
             CollectionAssert.AreEqual(new byte[] { 0xcc }, _header.Nonce);
             Assert.AreEqual <Byte>(1, _header.MessageCount);
             CollectionAssert.AreEqual(new UInt16[] { CommonDefinitions.DataSetId }, _header.DataSetWriterIds);
         }
 }