public void ParseData2Test()
        {
            PlcMemoryReadData_Accessor target = new PlcMemoryReadData_Accessor();
            target.ParseData(GetPass2Message());

            Assert.AreEqual<string>("HelloPlc", target.Data);
        }
        public void ParseErrorCodeTest()
        {
            PlcMemoryReadData_Accessor target = new PlcMemoryReadData_Accessor();

            Assert.IsFalse(target.IsError);

            target.ParseErrorCode(GetErrorMessage());

            Assert.IsTrue(target.IsError);
            Assert.AreEqual<int>(128, target.ErrorCode);
        }
        public void ParseIds1Test()
        {
            PlcMemoryReadData_Accessor target = new PlcMemoryReadData_Accessor();
            target.ParseIds(GetPass2Message());

            Assert.AreEqual<int>(31, target.StationNo);
            Assert.AreEqual<int>(254, target.PcNo);
        }
 public void ParseMessageThrowsFormatException1Test()
 {
     PlcMemoryReadData_Accessor target = new PlcMemoryReadData_Accessor();
     target.ParseMessage(GetShortMessage());
 }
 public void ParseMessageThrowsFormatException3Test()
 {
     PlcMemoryReadData_Accessor target = new PlcMemoryReadData_Accessor();
     target.ParseMessage(GetWrongEndCtrlCharMessage());
 }
 public void ParseMessageThrowsArgumentNullExceptionTest()
 {
     PlcMemoryReadData_Accessor target = new PlcMemoryReadData_Accessor();
     target.ParseMessage(GetNullMessage());
 }
 public void ParseMessageThrowsArgumentExceptionTest()
 {
     PlcMemoryReadData_Accessor target = new PlcMemoryReadData_Accessor();
     target.ParseMessage(GetWrongChecksumMessage());
 }
        public void ParseMessagePass2Test()
        {
            PlcMemoryReadData_Accessor target = new PlcMemoryReadData_Accessor();
            target.ParseMessage(GetPass2Message());

            Assert.AreEqual<int>(31, target.StationNo);
            Assert.AreEqual<int>(254, target.PcNo);
            Assert.AreEqual<string>("HelloPlc", target.Data);
            Assert.IsFalse(target.IsError);
            Assert.AreEqual<int>(0, target.ErrorCode);
        }
        public void ParseMessageErrorTest()
        {
            PlcMemoryReadData_Accessor target = new PlcMemoryReadData_Accessor();
            target.ParseMessage(GetErrorMessage());

            Assert.AreEqual<int>(0, target.StationNo);
            Assert.AreEqual<int>(255, target.PcNo);
            Assert.IsNull(target.Data);
            Assert.IsTrue(target.IsError);
            Assert.AreEqual<int>(128, target.ErrorCode);
        }
        public void ParseIds2Test()
        {
            PlcMemoryReadData_Accessor target = new PlcMemoryReadData_Accessor();
            target.ParseIds(GetErrorMessage());

            Assert.AreEqual<int>(0, target.StationNo);
            Assert.AreEqual<int>(255, target.PcNo);
        }