public void TestStreamSimpleArrayList() { ArrayList list = new ArrayList(5); list.Add(TestRandomizer.GetInt()); list.Add(TestRandomizer.GetString()); list.Add(TestRandomizer.GetDecimal()); list.Add("last"); XStream xs = new XStream(); string xml = xs.ToXml(list); Assert.IsNotNull(xml); Assert.IsTrue(xml.Length > 0); IList rlist = xs.FromXml(xml) as IList; Assert.IsNotNull(rlist); Assert.AreEqual(list.Count, rlist.Count); for (int i = 0; i < list.Count; i++) { Assert.AreEqual(list[i], rlist[i]); } }
protected override object GetValue() { return(TestRandomizer.GetDecimal()); }
public void TestObjectArrayMember() { object[] array = new object[] { TestRandomizer.GetString(), TestRandomizer.GetInt(), TestRandomizer.GetDecimal() }; ArrayHolder ah = new ArrayHolder(); ah.RandomNumber = TestRandomizer.GetInt(); ah.Array = array; string xml = xstream.ToXml(ah); ArrayHolder ahRev = xstream.FromXml(xml) as ArrayHolder; Assert.IsNotNull(ahRev); Assert.AreEqual(ah.RandomNumber, ahRev.RandomNumber); Assert.AreEqual(ah.Array, ahRev.Array); }