Пример #1
0
        /// <summary>
        /// Called to cancel a remote waiting operation on the recipient connection.
        /// </summary>
        /// <param name="id">Id of the waiting operation to cancel.</param>
        public void CancelWaitHandle(ushort id)
        {
            RpcWaitHandle call_wait_handle;

            // Try to get the wait.  If the Id does not exist, the wait operation has already been completed or removed.
            if (LocalWaitHandles.TryRemove(id, out call_wait_handle))
            {
                var frame = new MqFrame(new byte[4], MqFrameType.Last, Session.Config);
                frame.Write(0, Id);
                frame.Write(1, (byte)RpcCallMessageType.MethodCancel);
                frame.Write(2, id);

                Session.Send(frame);
            }
        }
Пример #2
0
        public void Frame_reads_bool()
        {
            _actualFrame = new MqFrame(new byte[1], MqFrameType.Last, _config);
            _actualFrame.Write(0, true);

            Assert.Equal(true, _actualFrame.ReadBoolean(0));
        }
Пример #3
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);
        }
Пример #4
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);
        }
Пример #5
0
        public void Frame_reads_ushort_position()
        {
            var value = (ushort)55231;

            _actualFrame = new MqFrame(new byte[3], MqFrameType.Last, _config);
            _actualFrame.Write(1, value);

            Assert.Equal(value, _actualFrame.ReadUInt16(1));
        }
Пример #6
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);
        }
Пример #7
0
        public void Frame_reads_ulong_position()
        {
            var value = (ulong)18146744003702551615;

            _actualFrame = new MqFrame(new byte[9], MqFrameType.Last, _config);
            _actualFrame.Write(1, value);

            Assert.Equal(value, _actualFrame.ReadUInt64(1));
        }
Пример #8
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);
        }
Пример #9
0
        public void Frame_reads_uint_position()
        {
            var value = (uint)4244962215;

            _actualFrame = new MqFrame(new byte[5], MqFrameType.Last, _config);
            _actualFrame.Write(1, value);

            Assert.Equal(value, _actualFrame.ReadUInt32(1));
        }
Пример #10
0
        public void Frame_reads_char_position()
        {
            var value = (char)'D';

            _actualFrame = new MqFrame(new byte[2], MqFrameType.Last, _config);
            _actualFrame.Write(1, value);

            Assert.Equal(value, _actualFrame.ReadChar(1));
        }
Пример #11
0
        public void Frame_reads_sbyte_position()
        {
            var value = (sbyte)101;

            _actualFrame = new MqFrame(new byte[2], MqFrameType.Last, _config);
            _actualFrame.Write(1, value);

            Assert.Equal(value, _actualFrame.ReadSByte(1));
        }
Пример #12
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);
        }
Пример #13
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);
        }
Пример #14
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);
        }
Пример #15
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);
        }
Пример #16
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);
        }
Пример #17
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);
        }
Пример #18
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);
        }
Пример #19
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);
        }
Пример #20
0
        public void Frame_reads_long_position()
        {
            var value = (long)4244962215;

            _actualFrame = new MqFrame(new byte[9], MqFrameType.Last, _config);
            _actualFrame.Write(1, value);

            Assert.Equal(value, _actualFrame.ReadInt64(1));
        }
Пример #21
0
        public void Frame_reads_short()
        {
            var value = (short)24157;

            _actualFrame = new MqFrame(new byte[2], MqFrameType.Last, _config);
            _actualFrame.Write(0, value);

            Assert.Equal(value, _actualFrame.ReadInt16(0));
        }
Пример #22
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);
        }
Пример #23
0
        public void Frame_reads_int_position()
        {
            var value = (int)1234567890;

            _actualFrame = new MqFrame(new byte[5], MqFrameType.Last, _config);
            _actualFrame.Write(1, value);

            Assert.Equal(value, _actualFrame.ReadInt32(1));
        }
Пример #24
0
        public void Frame_reads_decimal_position()
        {
            var value = (decimal)9123456789123456789.9123456789123456789;

            _actualFrame = new MqFrame(new byte[17], MqFrameType.Last, _config);
            _actualFrame.Write(1, value);

            Assert.Equal(value, _actualFrame.ReadDecimal(1));
        }
Пример #25
0
        public void Frame_reads_double_position()
        {
            var value = (double)12345.67891;

            _actualFrame = new MqFrame(new byte[9], MqFrameType.Last, _config);
            _actualFrame.Write(1, value);

            Assert.Equal(value, _actualFrame.ReadDouble(1));
        }
Пример #26
0
        public void Frame_reads_float_position()
        {
            var value = (float)123.456;

            _actualFrame = new MqFrame(new byte[5], MqFrameType.Last, _config);
            _actualFrame.Write(1, value);

            Assert.Equal(value, _actualFrame.ReadSingle(1));
        }
Пример #27
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);
        }
Пример #28
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);
        }
Пример #29
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);
        }
Пример #30
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);
        }