public virtual void FrameTypeDecode() { byte[] data = new byte[14]; data[0] = 4; // name of the field is 4 bytes long data[1] = 116; // t data[2] = 101; // e data[3] = 115; // s data[4] = 116; // t data[5] = 3; // data type code is 3 - String data[6] = 0; // first byte of unsigned integer for length data[7] = 0; // second byte of unsigned integer for length data[8] = 0; // third byte of unsigned integer for length data[9] = 4; // fourth byte of unsigned integer for length data[10] = 97; // a data[11] = 98; // b data[12] = 99; // c data[13] = 100; // d object value = datatype.Decode(data); Assert.True(value is DataFrame); DataFrame frame = (DataFrame)value; Assert.True(frame.Contains("test")); Assert.True(frame.Size == 1); DataField field = frame.Field[0]; // get the first field Assert.NotNull(field); Assert.True(field.Type == 3); object fieldvalue = field.ObjectValue; Assert.NotNull(fieldvalue); Assert.True(fieldvalue is string); string stringvalue = (string)fieldvalue; Assert.True(stringvalue.Equals("abcd")); }