public void testDictionary()
{
CBORObject beo = CBORObject.NewMap();
beo["zero"] = CBORObject.FromObject(1);
beo["one"] = CBORObject.FromObject("two");
beo["two"] = CBORObject.FromObject(3);
beo["three"] = CBORObject.FromObject("four");
Assert.AreEqual(4, beo.Count);
Assert.AreEqual(1, beo["zero"].AsInt64());
{
string stringTemp = beo["one"].AsString();
Assert.AreEqual(
"two",
stringTemp);
}
Assert.AreEqual(3, beo["two"].AsInt64());
{
string stringTemp = beo["three"].AsString();
Assert.AreEqual(
"four",
stringTemp);
}
byte[] b = EncodingToBytes(beo);
beo = EncodingFromBytes(b);
Assert.AreEqual(4, beo.Count);
Assert.AreEqual(1, beo["zero"].AsInt64());
{
string stringTemp = beo["one"].AsString();
Assert.AreEqual(
"two",
stringTemp);
}
Assert.AreEqual(3, beo["two"].AsInt64());
{
string stringTemp = beo["three"].AsString();
Assert.AreEqual(
"four",
stringTemp);
}
}