コード例 #1
0
        public void ParseData2Test()
        {
            PlcMemoryReadData_Accessor target = new PlcMemoryReadData_Accessor();
            target.ParseData(GetPass2Message());

            Assert.AreEqual<string>("HelloPlc", target.Data);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public void ParseIds1Test()
        {
            PlcMemoryReadData_Accessor target = new PlcMemoryReadData_Accessor();
            target.ParseIds(GetPass2Message());

            Assert.AreEqual<int>(31, target.StationNo);
            Assert.AreEqual<int>(254, target.PcNo);
        }
コード例 #4
0
 public void ParseMessageThrowsFormatException1Test()
 {
     PlcMemoryReadData_Accessor target = new PlcMemoryReadData_Accessor();
     target.ParseMessage(GetShortMessage());
 }
コード例 #5
0
 public void ParseMessageThrowsFormatException3Test()
 {
     PlcMemoryReadData_Accessor target = new PlcMemoryReadData_Accessor();
     target.ParseMessage(GetWrongEndCtrlCharMessage());
 }
コード例 #6
0
 public void ParseMessageThrowsArgumentNullExceptionTest()
 {
     PlcMemoryReadData_Accessor target = new PlcMemoryReadData_Accessor();
     target.ParseMessage(GetNullMessage());
 }
コード例 #7
0
 public void ParseMessageThrowsArgumentExceptionTest()
 {
     PlcMemoryReadData_Accessor target = new PlcMemoryReadData_Accessor();
     target.ParseMessage(GetWrongChecksumMessage());
 }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        public void ParseIds2Test()
        {
            PlcMemoryReadData_Accessor target = new PlcMemoryReadData_Accessor();
            target.ParseIds(GetErrorMessage());

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