Exemple #1
0
        public void Frame_reads_ascii_text_not_prepended_with_size()
        {
            var value = "abcdefghijklmnopqrstuvwxyz";

            _actualFrame = new MqFrame(new byte[26], MqFrameType.Last, _config);
            _actualFrame.WriteAscii(0, value, false);

            Assert.Equal(value, _actualFrame.ReadAscii(0, _actualFrame.DataLength));
        }
Exemple #2
0
        public void Frame_throws_on_ascii_text_write_when_larger_than_frame()
        {
            var value = "abcdefghijklmnopqrstuvwxyz";

            for (int i = 0; i < 10; i++)
            {
                value += value;
            }
            _actualFrame = new MqFrame(new byte[_config.FrameBufferSize], MqFrameType.Last, _config);

            Assert.Throws <InvalidOperationException>(() => _actualFrame.WriteAscii(0, value, false));
        }
Exemple #3
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);
        }