public void Initialize()
 {
     ModbusMessageImpl messageImpl = new ModbusMessageImpl();
     messageImpl.Initialize(new byte[] {1, 2, 9, 9, 9, 9});
     Assert.AreEqual(1, messageImpl.SlaveAddress);
     Assert.AreEqual(2, messageImpl.FunctionCode);
 }
        public void Initialize(byte[] frame)
        {
            if (frame.Length < MinimumFrameSize)
            {
                throw new FormatException(String.Format("Message frame must contain at least {0} bytes of data.", MinimumFrameSize));
            }

            _messageImpl.Initialize(frame);
            InitializeUnique(frame);
        }
示例#3
0
        public void Initialize(byte[] frame)
        {
            if (frame.Length < MinimumFrameSize)
            {
                string msg = "Message frame must contain at least {MinimumFrameSize} bytes of data.";
                throw new FormatException(msg);
            }

            _messageImpl.Initialize(frame);
            InitializeUnique(frame);
        }
 public void InitializeInvalidFrame()
 {
     ModbusMessageImpl messageImpl = new ModbusMessageImpl();
     messageImpl.Initialize(new byte[] {1});
 }
 public void ChecckInitializeFrameNull()
 {
     ModbusMessageImpl messageImpl = new ModbusMessageImpl();
     messageImpl.Initialize(null);
 }
 public void InitializeInvalidFrame()
 {
     ModbusMessageImpl messageImpl = new ModbusMessageImpl();
     Assert.Throws<FormatException>(() => messageImpl.Initialize(new byte[] {1}));
 }
 public void ChecckInitializeFrameNull()
 {
     ModbusMessageImpl messageImpl = new ModbusMessageImpl();
     Assert.Throws<ArgumentNullException>(() => messageImpl.Initialize(null));
 }