public void TestSerializeAndDeserialize() { string str_to_check = "Test String 1"; RegularData d = new RegularData(Encoding.UTF8.GetBytes(str_to_check)); FingerprintedData p = new FingerprintedData(d); byte[] serializedObj = p.SerializeTo(); Logger.WriteLineIf(LogLevel.Verbose, _log_props, Encoding.UTF8.GetString(serializedObj)); FingerprintedData actual_p = (FingerprintedData)DictionaryData.CreateDictionaryData(serializedObj, new AdrSerializer()); RegularData actual_d = (RegularData)actual_p.InnerData; Assert.AreEqual(str_to_check, Encoding.UTF8.GetString(actual_d.PayLoad)); }
public void TestSerializeAndDeserialize() { string str_to_compare = "Test String 1"; byte[] b = Encoding.UTF8.GetBytes(str_to_compare); RegularData d = new RegularData(b); Brunet.MemBlock mb = Brunet.MemBlock.Reference(d.SerializeTo()); Logger.WriteLineIf(LogLevel.Verbose, _log_props, mb.GetString(Encoding.UTF8)); RegularData d_actual = (RegularData)DictionaryData.CreateDictionaryData(mb, new AdrSerializer()); Assert.AreEqual(str_to_compare, Encoding.UTF8.GetString(d_actual.PayLoad)); }