// Constructor public GC_Echo_Response() { msg_len = MSG_LEN; msg_id = MSG_ID; data = new EchoMsg(); response_code = (EResponseCode)0; }
// Verify msg type: EchoMsg private static void Verify_EchoMsg() { EchoMsg stSrc = new EchoMsg(); // Make object rand stSrc.protocol_version = "test"; stSrc.int_param = 76; stSrc.char_array = "test"; byte[] src_bytes = stSrc.ToBytes(); MBinaryReader mbr = new MBinaryReader(src_bytes); EchoMsg stDst = new EchoMsg(); stDst.FromBytes(mbr); // Verify object content if (stSrc.int_param != stDst.int_param) { Console.WriteLine("Failed to verify field: int_param"); } if (stSrc.enum_value != stDst.enum_value) { Console.WriteLine("Failed to verify field: enum_value"); } // Compare object by bytes byte[] dst_bytes = stDst.ToBytes(); if (dst_bytes.Length != src_bytes.Length) { Console.WriteLine("Failed to verify field: EchoMsg by bytes length"); } for (int byte_index = 0; byte_index < dst_bytes.Length; ++byte_index) { if (src_bytes[byte_index] != dst_bytes[byte_index]) { Console.WriteLine("Failed to verify field: EchoMsg by bytes length"); } } }
// Constructor public CG_Echo_Request() { msg_len = MSG_LEN; msg_id = MSG_ID; data = new EchoMsg(); }