public void BasicTextStartStopCommandProcessorTest()
 {
     var processor = new BasicTextSynchronousCommandProcessor();
     try
     {
         processor.StartProcessing();
         Assert.IsTrue(processor.IsProcessingMessages);
     }
     finally
     {
         processor.StopProcessing();
         Assert.IsFalse(processor.IsProcessingMessages);
     }
 }
        public void TextEchoCommandTest()
        {
            var payload = new byte[] {0x01, 0x02, 0x03, 0x04, 0x05};

            var processor = new BasicTextSynchronousCommandProcessor();
            try
            {
                processor.StartProcessing();
                Assert.IsTrue(processor.IsProcessingMessages);

                var command = new BasicTextCommands.EchoCommand {Payload = payload};
                BasicTextCommands.EchoResponse response = processor.SendCommandWithResponse(command);
                Assert.IsNotNull(response, "SendCommand did not return a response.");
                Assert.IsInstanceOfType(response, typeof (BasicTextCommands.EchoResponse));
                Assert.IsTrue(BufferCompare(response.Payload, payload), "Response payload did not match the command payload.");
            }
            finally
            {
                processor.StopProcessing();
                Assert.IsFalse(processor.IsProcessingMessages);
            }
        }