Exemple #1
0
        public void ShouldReadWhatIsWrittenToGenericHeaderFields()
        {
            encodeHeader.Wrap(aBuff);

            encodeHeader.Version(1);
            encodeHeader.Flags(0);
            encodeHeader.HeaderType(HeaderFlyweight.HDR_TYPE_DATA);
            encodeHeader.FrameLength(8);

            decodeHeader.Wrap(aBuff);
            Assert.That(decodeHeader.Version(), Is.EqualTo((short)1));
            Assert.That(decodeHeader.HeaderType(), Is.EqualTo(HeaderFlyweight.HDR_TYPE_DATA));
            Assert.That(decodeHeader.FrameLength(), Is.EqualTo(8));
        }
Exemple #2
0
        public void ShouldWriteCorrectValuesForGenericHeaderFields()
        {
            encodeHeader.Wrap(aBuff);

            encodeHeader.Version((short)1);
            encodeHeader.Flags(DataHeaderFlyweight.BEGIN_AND_END_FLAGS);
            encodeHeader.HeaderType(HeaderFlyweight.HDR_TYPE_DATA);
            encodeHeader.FrameLength(8);

            // little endian
            Assert.That(buffer[0], Is.EqualTo((byte)0x08));
            Assert.That(buffer[1], Is.EqualTo((byte)0x00));
            Assert.That(buffer[2], Is.EqualTo((byte)0x00));
            Assert.That(buffer[3], Is.EqualTo((byte)0x00));
            Assert.That(buffer[4], Is.EqualTo((byte)0x01));
            Assert.That(buffer[5], Is.EqualTo(unchecked ((byte)0xC0)));
            Assert.That(buffer[6], Is.EqualTo((byte)HeaderFlyweight.HDR_TYPE_DATA));
            Assert.That(buffer[7], Is.EqualTo((byte)0x00));
        }
Exemple #3
0
        public void ShouldWriteCorrectValuesForGenericHeaderFields()
        {
            encodeHeader.Wrap(aBuff);

            encodeHeader.Version((short)1);
            encodeHeader.Flags(DataHeaderFlyweight.BEGIN_AND_END_FLAGS);
            encodeHeader.HeaderType(HeaderFlyweight.HDR_TYPE_DATA);
            encodeHeader.FrameLength(8);

            // little endian
            Assert.AreEqual((byte)0x08, buffer[0]);
            Assert.AreEqual((byte)0x00, buffer[1]);
            Assert.AreEqual((byte)0x00, buffer[2]);
            Assert.AreEqual((byte)0x00, buffer[3]);
            Assert.AreEqual((byte)0x01, buffer[4]);
            Assert.AreEqual((byte)0xC0, buffer[5]);
            Assert.AreEqual((byte)HeaderFlyweight.HDR_TYPE_DATA, buffer[6]);
            Assert.AreEqual((byte)0x00, buffer[7]);
        }