public void Write(byte[] data)
 {
     if (monitor != null)
     {
         monitor('>', data, data.Length);
     }
     serialProcess.Write(data);
 }
示例#2
0
        public void EofExceptionOnWriteTest()
        {
            var ss = new SerialSettings("COM99");

            using (var sp = new SerialProcess(ss))
            {
                Process.GetProcessById(sp.Pid).Kill();
                Assert.Throws <EndOfStreamException>(() =>
                {
                    sp.Write(new byte[0]);
                });
            }
        }
示例#3
0
        public void SerialExceptionOnWriteTest()
        {
            var ss = new SerialSettings("COM0");

            using (var sp = new SerialProcess(ss))
            {
                //stdout pipe remains open even after process exited
                //exception wont happend in stdout.writeline but
                //in detection of ! in beggining of stdin.readline
                Assert.Throws <SerialException>(() =>
                {
                    //write zero bytes is a good ping
                    sp.Write(new byte[0]);
                });
            }
        }