/// but it should reveal basic nesting issues.
/// </summary>
@Test
public void DeserializeNestedContainers()
{
OSD theSD = null;
OSDArray array = null;
OSDMap map = null;
OSD tempSD = null;
String testSD = "<?xml version='1.0' encoding='UTF-8'?> \n" +
"<llsd> \n" +
"<array> \n" +
"<map> \n" +
"<key>Map One</key> \n" +
"<map> \n" +
"<key>Array One</key> \n" +
"<array> \n" +
"<integer>1</integer> \n" +
"<integer>2</integer> \n" +
"</array> \n" +
"</map> \n" +
"</map> \n" +
"<array> \n" +
"<string>A</string> \n" +
"<string>B</string> \n" +
"<array> \n" +
"<integer>1</integer> \n" +
"<integer>4</integer> \n" +
"<integer>9</integer> \n" +
"</array> \n" +
"</array> \n" +
"</array> \n" +
"</llsd>";
//Deserialize the string
byte[] bytes = Utils.stringToBytes(testSD);
theSD =XmlLLSDOSDParser.DeserializeLLSDXml(bytes);
Assert.assertTrue(theSD instanceof OSDArray);
array = (OSDArray)theSD;
Assert.assertEquals(2, array.count());
//The first element of top level array, a map
Assert.assertEquals(OSDType.Map, array.get(0).getType());
map = (OSDMap)array.get(0);
//First nested map
tempSD = map.get("Map One");
Assert.assertNotNull(tempSD);
Assert.assertEquals(OSDType.Map, tempSD.getType());
map = (OSDMap)tempSD;
//First nested array
tempSD = map.get("Array One");
Assert.assertNotNull(tempSD);
Assert.assertEquals(OSDType.Array, tempSD.getType());
array = (OSDArray)tempSD;
Assert.assertEquals(2, array.count());
array = (OSDArray)theSD;
//Second element of top level array, an array
tempSD = array.get(1);
Assert.assertEquals(OSDType.Array, tempSD.getType());
array = (OSDArray)tempSD;
Assert.assertEquals(3, array.count());
//Nested array
tempSD = array.get(2);
Assert.assertEquals(OSDType.Array, tempSD.getType());
array = (OSDArray)tempSD;
Assert.assertEquals(3, array.count());
}