public void DataMap_FullCycle_UnionArray() { NestedTypes n; Dictionary <string, object> data = new Dictionary <string, object>() { { "unionArray", new List <object>() { new Dictionary <string, object>() { { "bytes", "\u0000\u0001\u0002\u0003" } } } } }; n = new NestedTypes(data); Assert.IsTrue(n.hasUnionArray); Assert.AreEqual(NestedTypes.UnionArray.Member.Bytes, n.unionArray[0].member); CollectionAssert.AreEqual(expectedBytes, n.unionArray[0].asBytes.GetBytes()); NestedTypes reclaimed = new NestedTypes(n.Data()); Assert.IsTrue(reclaimed.hasUnionArray); Assert.AreEqual(NestedTypes.UnionArray.Member.Bytes, reclaimed.unionArray[0].member); CollectionAssert.AreEqual(expectedBytes, reclaimed.unionArray[0].asBytes.GetBytes()); }
public void DataMap_FullCycle_UnionMap() { NestedTypes n; Dictionary <string, object> data = new Dictionary <string, object>() { { "unionMap", new Dictionary <string, object>() { { "one", new Dictionary <string, object>() { { "int", expectedInt } } } } } }; n = new NestedTypes(data); Assert.IsTrue(n.hasUnionMap); Assert.AreEqual(NestedTypes.UnionMap.Member.Int, n.unionMap["one"].member); Assert.AreEqual(expectedInt, n.unionMap["one"].asInt); NestedTypes reclaimed = new NestedTypes(n.Data()); Assert.IsTrue(reclaimed.hasUnionMap); Assert.AreEqual(NestedTypes.UnionMap.Member.Int, reclaimed.unionMap["one"].member); Assert.AreEqual(expectedInt, reclaimed.unionMap["one"].asInt); }
public void DataMap_FullCycle_EnumMap() { NestedTypes n; Dictionary <string, object> data = new Dictionary <string, object>() { { "enumMap", new Dictionary <string, object>() { { "one", "SYMBOL_1" } } } }; n = new NestedTypes(data); Assert.IsTrue(n.hasEnumMap); Assert.AreEqual(expectedEnum, n.enumMap["one"].symbol); NestedTypes reclaimed = new NestedTypes(n.Data()); Assert.IsTrue(reclaimed.hasEnumMap); Assert.AreEqual(expectedEnum, reclaimed.enumMap["one"].symbol); }
public void DataMap_FullCycle_BytesMap() { NestedTypes n; Dictionary <string, object> data = new Dictionary <string, object>() { { "bytesMap", new Dictionary <string, object>() { { "one", "\u0000\u0001\u0002\u0003" } } } }; n = new NestedTypes(data); Assert.IsTrue(n.hasBytesMap); CollectionAssert.AreEqual(expectedBytes, n.bytesMap["one"].GetBytes()); NestedTypes reclaimed = new NestedTypes(n.Data()); Assert.IsTrue(reclaimed.hasBytesMap); CollectionAssert.AreEqual(expectedBytes, reclaimed.bytesMap["one"].GetBytes()); }