public void ProducerMessageHeaderTestMethod1()
 {
     byte[] _output = null;
     using (MemoryStream _outputStream = new MemoryStream())
         using (HeaderBinaryWriter _writer = new HeaderBinaryWriter(_outputStream))
         {
             MessageHeader _header = MessageHeader.GetProducerMessageHeader
                                         (_writer, FieldEncodingEnum.VariantFieldEncoding, MessageLengthFieldTypeEnum.TwoBytes, MessageTypeEnum.DataDeltaFrame, new ConfigurationVersionDataType()
             {
                 MajorVersion = 7, MinorVersion = 8
             });
             Assert.IsNotNull(_header);
             //Default values
             Assert.AreEqual <ushort>(1, _header.EncodingFlags);
             Assert.AreEqual <MessageTypeEnum>(MessageTypeEnum.DataDeltaFrame, _header.MessageType);
             Assert.AreEqual <ushort>(0, _header.MessageSequenceNumber);
             Assert.AreEqual <ushort>(7, _header.ConfigurationVersion.MajorVersion);
             Assert.AreEqual <ushort>(8, _header.ConfigurationVersion.MinorVersion);
             SetupProducerHeaderFields(_header);
             _header.Synchronize();
             _writer.Flush();
             _output = _outputStream.ToArray();
         }
     Assert.AreEqual <int>(18, _output.Length);
     byte[] _expected = new byte[] {
         0x02,                                           //MessageType
         0x01,                                           //EncodingFlags
         0x12, 0x00,                                     // MessageLength
         0x08, 0x00,                                     //MessageSequenceNumber
         0x06, 0x07,                                     //ConfigurationVersion
         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //TimeStamp
         0x10, 0x00                                      // FieldCount
     };
     CollectionAssert.AreEqual(_expected, _output);
 }
Exemplo n.º 2
0
 public void ProducerMessageHeaderTestMethod1()
 {
     byte[] _output = null;
       using (MemoryStream _outputStream = new MemoryStream())
       using (HeaderBinaryWriter _writer = new HeaderBinaryWriter(_outputStream))
       {
     MessageHeader _header = MessageHeader.GetProducerMessageHeader
       (_writer, FieldEncodingEnum.VariantFieldEncoding, MessageLengthFieldTypeEnum.TwoBytes, MessageTypeEnum.DataDeltaFrame, new ConfigurationVersionDataType() { MajorVersion = 7, MinorVersion = 8 });
     Assert.IsNotNull(_header);
     //Default values
     Assert.AreEqual<ushort>(1, _header.EncodingFlags);
     Assert.AreEqual<MessageTypeEnum>(MessageTypeEnum.DataDeltaFrame, _header.MessageType);
     Assert.AreEqual<ushort>(0, _header.MessageSequenceNumber);
     Assert.AreEqual<ushort>(7, _header.ConfigurationVersion.MajorVersion);
     Assert.AreEqual<ushort>(8, _header.ConfigurationVersion.MinorVersion);
     SetupProducerHeaderFields(_header);
     _header.Synchronize();
     _writer.Flush();
     _output = _outputStream.ToArray();
       }
       Assert.AreEqual<int>(18, _output.Length);
       byte[] _expected = new byte[] {
     0x02, //MessageType
     0x01, //EncodingFlags
     0x12, 0x00, // MessageLength
     0x08, 0x00, //MessageSequenceNumber
     0x06, 0x07, //ConfigurationVersion
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //TimeStamp
     0x10, 0x00 // FieldCount
       };
       CollectionAssert.AreEqual(_expected, _output);
 }
        public void ProducerMessageLengthTestMethod1()
        {
            string m_Date = System.DateTime.Today.ToShortDateString();

            byte[] _output = null;
            using (MemoryStream _outputStream = new MemoryStream())
                using (HeaderBinaryWriter _writer = new HeaderBinaryWriter(_outputStream))
                {
                    MessageHeader _header = MessageHeader.GetProducerMessageHeader
                                                (_writer, FieldEncodingEnum.VariantFieldEncoding, MessageLengthFieldTypeEnum.TwoBytes, MessageTypeEnum.DataDeltaFrame, new ConfigurationVersionDataType()
                    {
                        MajorVersion = 7, MinorVersion = 8
                    });
                    Assert.IsNotNull(_header);
                    SetupProducerHeaderFields(_header);
                    _writer.Write(UInt32.MaxValue);
                    _writer.Write(UInt32.MaxValue);
                    _writer.Write(UInt32.MaxValue);
                    _writer.Write(UInt32.MaxValue);
                    _writer.Write(UInt32.MaxValue);
                    _writer.Write(UInt32.MaxValue);
                    _writer.Write(UInt32.MaxValue);
                    _writer.Write(UInt32.MaxValue);
                    _writer.Write(UInt32.MaxValue);
                    _writer.Write(UInt32.MaxValue);
                    _header.Synchronize();
                    _writer.Flush();
                    _output = _outputStream.ToArray();
                }
            Assert.AreEqual <int>(58, _output.Length);
            byte[] _expected = new byte[] {
                0x02,                                           //MessageType
                0x01,                                           //EncodingFlags
                0x3A, 0x00,                                     // MessageLength
                0x08, 0x00,                                     // MessageSequenceNumber
                0x06, 0x07,                                     // ConfigurationVersion
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //TimeStamp
                0x10, 0x00,                                     // FieldCount
                0xFF, 0xFF, 0xFF, 0xFF,
                0xFF, 0xFF, 0xFF, 0xFF,
                0xFF, 0xFF, 0xFF, 0xFF,
                0xFF, 0xFF, 0xFF, 0xFF,
                0xFF, 0xFF, 0xFF, 0xFF,
                0xFF, 0xFF, 0xFF, 0xFF,
                0xFF, 0xFF, 0xFF, 0xFF,
                0xFF, 0xFF, 0xFF, 0xFF,
                0xFF, 0xFF, 0xFF, 0xFF,
                0xFF, 0xFF, 0xFF, 0xFF
            };
            CollectionAssert.AreEqual(_expected, _output);
        }
Exemplo n.º 4
0
 public void ProducerMessageLengthTestMethod1()
 {
     string m_Date = System.DateTime.Today.ToShortDateString();
       byte[] _output = null;
       using (MemoryStream _outputStream = new MemoryStream())
       using (HeaderBinaryWriter _writer = new HeaderBinaryWriter(_outputStream))
       {
     MessageHeader _header = MessageHeader.GetProducerMessageHeader
       (_writer, FieldEncodingEnum.VariantFieldEncoding, MessageLengthFieldTypeEnum.TwoBytes, MessageTypeEnum.DataDeltaFrame, new ConfigurationVersionDataType() { MajorVersion = 7, MinorVersion = 8 });
     Assert.IsNotNull(_header);
     SetupProducerHeaderFields(_header);
     _writer.Write(UInt32.MaxValue);
     _writer.Write(UInt32.MaxValue);
     _writer.Write(UInt32.MaxValue);
     _writer.Write(UInt32.MaxValue);
     _writer.Write(UInt32.MaxValue);
     _writer.Write(UInt32.MaxValue);
     _writer.Write(UInt32.MaxValue);
     _writer.Write(UInt32.MaxValue);
     _writer.Write(UInt32.MaxValue);
     _writer.Write(UInt32.MaxValue);
     _header.Synchronize();
     _writer.Flush();
     _output = _outputStream.ToArray();
       }
       Assert.AreEqual<int>(58, _output.Length);
       byte[] _expected = new byte[] {
     0x02, //MessageType
     0x01, //EncodingFlags
     0x3A, 0x00, // MessageLength
     0x08, 0x00, // MessageSequenceNumber
     0x06, 0x07, // ConfigurationVersion
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //TimeStamp
     0x10, 0x00, // FieldCount
     0xFF, 0xFF, 0xFF, 0xFF,
     0xFF, 0xFF, 0xFF, 0xFF,
     0xFF, 0xFF, 0xFF, 0xFF,
     0xFF, 0xFF, 0xFF, 0xFF,
     0xFF, 0xFF, 0xFF, 0xFF,
     0xFF, 0xFF, 0xFF, 0xFF,
     0xFF, 0xFF, 0xFF, 0xFF,
     0xFF, 0xFF, 0xFF, 0xFF,
     0xFF, 0xFF, 0xFF, 0xFF,
     0xFF, 0xFF, 0xFF, 0xFF
       };
       CollectionAssert.AreEqual(_expected, _output);
 }