public void TwoConsecutiveCallsWhichReturnsMessageBuffersShouldNotBeSame() { var message = new KeyboardEventMessage(1, 0, 1, 0); var messageBuffer1 = message.ToBytes(); var messageBuffer2 = message.ToBytes(); Assert.AreNotSame(messageBuffer1, messageBuffer2); }
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); }
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"); } }