コード例 #1
0
        public void TwoConsecutiveCallsWhichReturnsMessageBuffersShouldNotBeSame()
        {
            var message = new KeyboardEventMessage(1, 0, 1, 0);

            var messageBuffer1 = message.ToBytes();
            var messageBuffer2 = message.ToBytes();

            Assert.AreNotSame(messageBuffer1, messageBuffer2);
        }
コード例 #2
0
        public void SendKeyEvent(ushort code, bool alt, bool control, bool shift)
        {
            var eventMessage = new KeyboardEventMessage(code,
                (byte) (alt ? 1 : 0),
                (byte) (control ? 1 : 0),
                (byte) (shift ? 1 : 0)
                );
            var messageRdap = new RdapMessage(RdapMessageType.KeyboardEventMessage, eventMessage.ToBytes());
            var dataToSend = messageRdap.ToBytes();

            if (subscriber != null)
                subscriber.Send(dataToSend, 0, dataToSend.Length);
        }
コード例 #3
0
        public void ShouldAbleToBytesFromRetriveVariables()
        {
            var message = new KeyboardEventMessage(1, 0, 1, 0);
            var messageBuffer = new byte[] { 1, 0, 0, 1, 0 };
            var messageBufferToCompare = message.ToBytes();

            Assert.AreEqual(messageBuffer.Length, messageBufferToCompare.Length);

            for (var i = 0; i < messageBuffer.Length; i++)
            {
                if (messageBuffer[i] != messageBufferToCompare[i])
                    Assert.Fail("Message contents is not same");
            }
        }