Пример #1
0
        public void TestRequestLvdTnew()
        {
            byte[] expected = ValueHelper.StrToToHexByte("fe 46 41 53 13 03 e8 00 00 00 01 48 01 00 00 00 00 1a ef");

            ISensorAdapter sa = new VoltageSensorAdapter();
            var            s  = new Sensor()
            {
                ModuleNo    = 1000,
                ChannelNo   = 1,
                ProductCode = "FS-LFV-VM5P5"
            };
            int err;
            var r = this.GetSensorAcqResult();

            r.Sensor = s;
            sa.Request(ref r);
            var actual = r.Request;

            if (actual.Length == expected.Length)
            {
                bool result = false;
                for (int i = 0; i < expected.Length; i++)
                {
                    result = actual[i] == expected[i];
                    if (!result)
                    {
                        break;
                    }
                }
                Assert.IsTrue(result);
            }
            else
            {
                Assert.Fail();
            }
        }
Пример #2
0
        public void TestRequest()
        {
            string         str = "fe 46 41 53 13 1b 76 00 00 00 01 41 0a 00 00 00 00 9e ef";
            ISensorAdapter sa  = new VoltageSensorAdapter();
            Sensor         s   = new Sensor()
            {
                ModuleNo    = 7030,
                ChannelNo   = 10,
                ProductCode = "FS-LF10"
            };

            byte[] expected = ValueHelper.StrToToHexByte(str);
            int    err;
            var    r = this.GetSensorAcqResult();

            r.Sensor = s;
            sa.Request(ref r);
            byte[] buff = r.Request;
            if (buff.Length == expected.Length)
            {
                bool result = false;
                for (int i = 0; i < expected.Length; i++)
                {
                    result = buff[i] == expected[i];
                    if (!result)
                    {
                        break;
                    }
                }
                Assert.IsTrue(result);
            }
            else
            {
                Assert.Fail();
            }
        }