示例#1
0
        public void TestSendIsEncoded(string toEncode, string expectedEncoding)
        {
            _buffer = new byte[toEncode.Length];

            for (int i = 0; i < toEncode.Length; i++)
            {
                _buffer[i] = (byte)toEncode[i];
            }

            _uut.Send(_buffer, toEncode.Length);

            int l = expectedEncoding.Length;

            byte[] expectedBuffer = new byte[l];

            for (int i = 0; i < l; i++)
            {
                expectedBuffer[i] = (byte)expectedEncoding[i];
            }

            _serial.Received(1).Send(Arg.Is <byte[]>(actualBuffer => expectedBuffer.SequenceEqual(actualBuffer)), l);
        }