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]);
            }
        }
 public PrimitiveObject()
 {
     _Int    = TestRandomizer.GetInt();
     _Long   = TestRandomizer.GetLong();
     _Bool   = TestRandomizer.GetBool();
     _Short  = TestRandomizer.GetShort();
     _String = TestRandomizer.GetString();
 }
        public void TestIntArray()
        {
            int[] a =
            {
                TestRandomizer.GetInt(), TestRandomizer.GetInt(), TestRandomizer.GetInt(), TestRandomizer.GetInt(), TestRandomizer.GetInt(),
                TestRandomizer.GetInt()
            };

            string xml = xstream.ToXml(a);

            int[] rev = xstream.FromXml(xml) as int[];

            Assert.IsNotNull(rev);
            Assert.AreEqual(a, rev);
        }
        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);
        }
        public void TestStructArray()
        {
            TestStruct s1 = new TestStruct();

            s1.Int    = TestRandomizer.GetInt();
            s1.String = TestRandomizer.GetString();

            TestStruct[] a = { s1, new TestStruct(), new TestStruct(null) };

            string xml = xstream.ToXml(a);

            TestStruct[] rev = xstream.FromXml(xml) as TestStruct[];

            Assert.IsNotNull(rev);
            Assert.AreEqual(a, rev);
        }
 protected override object GetValue()
 {
     return(TestRandomizer.GetInt());
 }
 public TestObject()
 {
     _Int    = TestRandomizer.GetInt();
     _String = TestRandomizer.GetString();
 }
 public TestStruct(object dummy)
 {
     Int    = TestRandomizer.GetInt();
     String = TestRandomizer.GetString();
 }