public void WriteTest() { var writeParameters = new[] { new WriteParameter("Addr0", 16) }; _ioDevice.Write(writeParameters); var readParameters = new[] { new ReadParameter("Addr0", typeof(Int32)) }; var readResult = _ioDevice.Read(readParameters); Assert.AreEqual(1, readResult.Length); Assert.AreEqual(16, readResult[0]); writeParameters = new[] { new WriteParameter("Addr0", -1) }; _ioDevice.Write(writeParameters); readParameters = new[] { new ReadParameter("Addr0", typeof(Int32)) }; readResult = _ioDevice.Read(readParameters); Assert.AreEqual(1, readResult.Length); Assert.AreEqual(-1, readResult[0]); }
public void ReadTypeMismatchTest() { var writeParameters = new[] { new WriteParameter("Addr0", 16) }; _ioDevice.Write(writeParameters); var readParameters = new[] { new ReadParameter("Addr0", typeof(short)) }; Assert.Throws <Exception>(() => _ioDevice.Read(readParameters)); }