コード例 #1
0
        public void ReadValueFloatTest()
        {
            TestDataEntity _data = new TestDataEntity()
            {
                Tags = GetData(), TimeStamp = DateTime.Now
            };
            ReadDataEntity _instance = new ReadDataEntity(_data, new Block());
            object         _value    = _instance.ReadValue(2, typeof(float));

            Assert.IsTrue(_value is float);
            Assert.AreEqual <float>(26.9f, (float)_value);
            _value = _instance.ReadValue(3, typeof(float));
            Assert.IsTrue(_value is float);
            Assert.AreEqual <float>(1368f, (float)_value);
        }
コード例 #2
0
 public void ReadValueArgumentOutOfRangeTest()
 {
     TestDataEntity _data = new TestDataEntity()
     {
         Tags = GetData(), TimeStamp = DateTime.Now
     };
     ReadDataEntity _instance = new ReadDataEntity(_data, new Block());
     object         _value    = _instance.ReadValue(8, typeof(float));
 }
コード例 #3
0
 public void ReadValueWrongFormatTest()
 {
     TestDataEntity _data = new TestDataEntity()
     {
         Tags = GetData(), TimeStamp = DateTime.Now
     };
     ReadDataEntity _instance = new ReadDataEntity(_data, new Block());
     object         _value    = _instance.ReadValue(0, typeof(float));
 }
コード例 #4
0
 public void ReadValueShortFormatExceptionTest()
 {
     TestDataEntity _data = new TestDataEntity()
     {
         Tags = GetData(), TimeStamp = DateTime.Now
     };
     ReadDataEntity _instance = new ReadDataEntity(_data, new Block());
     object         _value    = _instance.ReadValue(2, typeof(short));
 }
コード例 #5
0
        public void ReadValueShortOverflowExceptionTest()
        {
            TestDataEntity _data = new TestDataEntity()
            {
                Tags = GetData(), TimeStamp = DateTime.Now
            };

            _data.Tags[7] = "33000";
            ReadDataEntity _instance = new ReadDataEntity(_data, new Block());
            object         _value    = _instance.ReadValue(3, typeof(short));
        }
コード例 #6
0
        public void ReadValueStringTest()
        {
            TestDataEntity _data = new TestDataEntity()
            {
                Tags = GetData(), TimeStamp = DateTime.Now
            };
            ReadDataEntity _instance = new ReadDataEntity(_data, new Block());
            object         _value    = _instance.ReadValue(0, typeof(string));

            Assert.IsTrue(_value is string);
            Assert.AreEqual <string>("09-12-16", (string)_value);
            _value = _instance.ReadValue(1, typeof(string));
            Assert.IsTrue(_value is string);
            Assert.AreEqual <string>("09:24:02", (string)_value);
            _value = _instance.ReadValue(2, typeof(string));
            Assert.IsTrue(_value is string);
            Assert.AreEqual <string>("26.9", (string)_value);
            _value = _instance.ReadValue(3, typeof(string));
            Assert.IsTrue(_value is string);
            Assert.AreEqual <string>("1368", (string)_value);
        }
コード例 #7
0
        public void ReadValueShortTest()
        {
            TestDataEntity _data = new TestDataEntity()
            {
                Tags = GetData(), TimeStamp = DateTime.Now
            };
            ReadDataEntity _instance = new ReadDataEntity(_data, new Block());
            object         _value    = _instance.ReadValue(3, typeof(short));

            Assert.IsTrue(_value is short);
            Assert.AreEqual <long>(1368, (short)_value);
        }