public void TestMap() { MPackMap dictionary = new MPackMap { { "array1", MPack.From(new[] { MPack.From("array1_value1"), MPack.From("array1_value2"), MPack.From("array1_value3"), }) }, { "bool1", MPack.From(true) }, { "double1", MPack.From(50.5) }, { "double2", MPack.From(15.2) }, { "int1", MPack.From(50505) }, { "int2", MPack.From(50) }, { 3.14, MPack.From(3.14) }, { 42, MPack.From(42) } }; var bytes = dictionary.EncodeToBytes(); var result = MPack.ParseFromBytes(bytes) as MPackMap; Assert.AreEqual(dictionary, result); }
public byte[] Encode() { MPackMap dictionary = new MPackMap { { "command", Command }, { "key", Key }, { "value", (Value == null) ? "" : Value }, { "serverId", ServerId }, { "version", Version } }; return(dictionary.EncodeToBytes()); }
public void TestMap() { MPackMap dictionary = new MPackMap { { "array1", MPack.From(new[] { MPack.From("array1_value1"), MPack.From("array1_value2"), MPack.From("array1_value3"), }) }, {"bool1", MPack.From(true)}, {"double1", MPack.From(50.5)}, {"double2", MPack.From(15.2)}, {"int1", MPack.From(50505)}, {"int2", MPack.From(50)} }; var bytes = dictionary.EncodeToBytes(); var result = MPack.ParseFromBytes(bytes) as MPackMap; Assert.AreEqual(dictionary, result); }