public void ConstructStatusCheckTest()
        {
            ISerialPort port = mock.Object;

            SerialCommand command  = new SerialCommand(port);
            string        expected = "0";

            string actual = command.StatusCheck();

            Assert.Equal(expected, actual);
        }
        public void HandleExceptionOnSendTimeoutTest()
        {
            mock.Setup(sp => sp.Send(It.Is <string>(s => s.Equals("0"))));
            mock.Setup(sp => sp.Read()).Throws(new TimeoutException());
            ISerialPort port = mock.Object;

            SerialCommand command  = new SerialCommand(port);
            string        response = "";
            string        expected = "0";

            if (command.Send(command.StatusCheck()))
            {
                response = command.Read();
            }

            Assert.False(command.ValidateResponse(expected, response));
        }
        public void SendSuccessfulStatusCheckTest()
        {
            string expected = "0";

            mock.Setup(sp => sp.Send(It.Is <string>(s => s.Equals("0"))));
            mock.Setup(sp => sp.Read()).Returns(expected);
            ISerialPort port = mock.Object;

            SerialCommand command  = new SerialCommand(port);
            string        response = "";

            if (command.Send(command.StatusCheck()))
            {
                response = command.Read();
            }

            Assert.True(command.ValidateResponse(expected, response));
        }