public void FrameBuilder_parses_more_frame()
        {
            _frameBuilder.Write(_moreFrame.RawFrame(), 0, _moreFrame.FrameSize);
            var parsedFrame = _frameBuilder.Frames.Dequeue();

            Utilities.CompareFrame(_moreFrame, parsedFrame);
        }
        public void FrameBuilder_parses_empty_last_frame()
        {
            _frameBuilder.Write(_emptyLastFrame.RawFrame(), 0, _emptyFrame.FrameSize);
            var parsedFrame = _frameBuilder.Frames.Dequeue();

            Utilities.CompareFrame(_emptyLastFrame, parsedFrame);
        }
Exemplo n.º 3
0
        public void Frame_creates_empty_last_frame()
        {
            _expectedBytes = new byte[] { 4 };
            _actualFrame   = new MqFrame(null, MqFrameType.EmptyLast, _config);
            _actualBytes   = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 4
0
        public void Frame_creates_ping_frame()
        {
            _expectedBytes = new byte[] { 6 };
            _actualFrame   = new MqFrame(null, MqFrameType.Ping, _config);
            _actualBytes   = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 5
0
        public void Frame_empty_frame_accepts_empty_array()
        {
            _expectedBytes = new byte[] { 1 };
            _actualFrame   = new MqFrame(new byte[] {}, MqFrameType.Empty, _config);
            _actualBytes   = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 6
0
        public void Frame_creates_last_frame_bytes()
        {
            _expectedBytes = new byte[] { 3, 5, 0, 1, 2, 3, 4, 5 };
            _actualFrame   = new MqFrame(new byte[] { 1, 2, 3, 4, 5 }, MqFrameType.Last, _config);
            _actualBytes   = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 7
0
        public void Frame_creates_command_frame()
        {
            _expectedBytes = new byte[] { 5, 1, 0, 1 };
            _actualFrame   = new MqFrame(new byte[] { 1 }, MqFrameType.Command, _config);
            _actualBytes   = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 8
0
        public void Frame_writes_long_negative()
        {
            _expectedBytes = new byte[] { 3, 8, 0, 78, 130, 11, 74, 196, 22, 222, 238 };
            _actualFrame   = new MqFrame(new byte[8], MqFrameType.Last, _config);
            _actualFrame.Write(0, (long)-1234524215541267890);
            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 9
0
        public void Frame_writes_uint_position()
        {
            _expectedBytes = new byte[] { 3, 4, 0, 167, 251, 4, 253 };
            _actualFrame   = new MqFrame(new byte[4], MqFrameType.Last, _config);
            _actualFrame.Write(0, (uint)4244962215);
            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 10
0
        public void Frame_writes_int_negative()
        {
            _expectedBytes = new byte[] { 3, 4, 0, 46, 253, 105, 182 };
            _actualFrame   = new MqFrame(new byte[4], MqFrameType.Last, _config);
            _actualFrame.Write(0, (int)-1234567890);
            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 11
0
        public void Frame_writes_ushort_position()
        {
            _expectedBytes = new byte[] { 3, 3, 0, 0, 191, 215 };
            _actualFrame   = new MqFrame(new byte[3], MqFrameType.Last, _config);
            _actualFrame.Write(1, (ushort)55231);
            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 12
0
        public void Frame_writes_short_negative()
        {
            _expectedBytes = new byte[] { 3, 2, 0, 163, 161 };
            _actualFrame   = new MqFrame(new byte[2], MqFrameType.Last, _config);
            _actualFrame.Write(0, (short)-24157);
            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 13
0
        public void Frame_writes_byte_position()
        {
            _expectedBytes = new byte[] { 3, 2, 0, 0, 231 };
            _actualFrame   = new MqFrame(new byte[2], MqFrameType.Last, _config);
            _actualFrame.Write(1, (byte)231);
            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 14
0
        public void Frame_writes_bool_false()
        {
            _expectedBytes = new byte[] { 3, 2, 0, 0, 0 };
            _actualFrame   = new MqFrame(new byte[2], MqFrameType.Last, _config);
            _actualFrame.Write(0, false);
            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 15
0
        public void Frame_writes_bool_true()
        {
            _expectedBytes = new byte[] { 3, 1, 0, 1 };
            _actualFrame   = new MqFrame(new byte[1], MqFrameType.Last, _config);
            _actualFrame.Write(0, true);
            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 16
0
        public void Frame_writes_byte_array_offset_length_position()
        {
            _expectedBytes = new byte[] { 3, 3, 0, 0, 3, 4 };
            _actualFrame   = new MqFrame(new byte[3], MqFrameType.Last, _config);
            _actualFrame.Write(1, new byte[] { 1, 2, 3, 4, 241 }, 2, 2);
            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 17
0
        public void Frame_writes_long_position()
        {
            _expectedBytes = new byte[] { 3, 9, 0, 0, 178, 125, 244, 181, 59, 233, 33, 17 };
            _actualFrame   = new MqFrame(new byte[9], MqFrameType.Last, _config);
            _actualFrame.Write(1, (long)1234524215541267890);
            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 18
0
        public void Frame_writes_short_position()
        {
            _expectedBytes = new byte[] { 3, 3, 0, 0, 93, 94 };
            _actualFrame   = new MqFrame(new byte[3], MqFrameType.Last, _config);
            _actualFrame.Write(1, (short)24157);
            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 19
0
        public void Frame_writes_byte_array_full()
        {
            _expectedBytes = new byte[] { 3, 5, 0, 1, 2, 3, 4, 241 };
            _actualFrame   = new MqFrame(new byte[5], MqFrameType.Last, _config);
            _actualFrame.Write(0, new byte[] { 1, 2, 3, 4, 241 }, 0, 5);
            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 20
0
        public void Frame_writes_int_position()
        {
            _expectedBytes = new byte[] { 3, 5, 0, 0, 210, 2, 150, 73 };
            _actualFrame   = new MqFrame(new byte[5], MqFrameType.Last, _config);
            _actualFrame.Write(1, (int)1234567890);
            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 21
0
        public void Frame_writes_sbyte_positive()
        {
            _expectedBytes = new byte[] { 3, 1, 0, 101 };
            _actualFrame   = new MqFrame(new byte[1], MqFrameType.Last, _config);
            _actualFrame.Write(0, (sbyte)101);

            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 22
0
        public void Frame_writes_char()
        {
            _expectedBytes = new byte[] { 3, 1, 0, 68 };
            _actualFrame   = new MqFrame(new byte[1], MqFrameType.Last, _config);
            _actualFrame.Write(0, (char)'D');

            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 23
0
        public void Frame_writes_decimal_position()
        {
            _expectedBytes = new byte[] { 3, 17, 0, 0, 160, 107, 84, 143, 156, 7, 157, 126, 0, 0, 0, 0, 0, 0, 0, 0 };
            _actualFrame   = new MqFrame(new byte[17], MqFrameType.Last, _config);
            _actualFrame.Write(1, (decimal)9123456789123456789.9123456789123456789);

            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 24
0
        public void Frame_writes_double_position()
        {
            _expectedBytes = new byte[] { 3, 9, 0, 0, 119, 219, 133, 230, 214, 28, 200, 64 };
            _actualFrame   = new MqFrame(new byte[9], MqFrameType.Last, _config);
            _actualFrame.Write(1, (double)12345.67891);

            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 25
0
        public void Frame_writes_ulong_position()
        {
            _expectedBytes = new byte[] { 3, 9, 0, 0, 63, 244, 163, 154, 134, 47, 214, 251 };
            _actualFrame   = new MqFrame(new byte[9], MqFrameType.Last, _config);
            _actualFrame.Write(1, (ulong)18146744003702551615);

            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 26
0
        public void Frame_writes_float_position()
        {
            _expectedBytes = new byte[] { 3, 5, 0, 0, 121, 233, 246, 66 };
            _actualFrame   = new MqFrame(new byte[5], MqFrameType.Last, _config);
            _actualFrame.Write(1, (float)123.456);

            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }
Exemplo n.º 27
0
        public void Frame_writes_ascii_text_not_prepended_with_size()
        {
            _expectedBytes = new byte[]
            {
                3, 26, 0,
                97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
                117, 118, 119, 120, 121, 122
            };
            _actualFrame = new MqFrame(new byte[26], MqFrameType.Last, _config);
            _actualFrame.WriteAscii(0, "abcdefghijklmnopqrstuvwxyz", false);

            _actualBytes = _actualFrame.RawFrame();

            Assert.Equal(_expectedBytes, _actualBytes);
        }