Example #1
0
		public void TestSerializeGenListClassListNested ()
		{
			GenListClass<GenListClass<GenNestedClass<int, int>.InnerClass<string>>> genlist =
				new GenListClass<GenListClass<GenNestedClass<int, int>.InnerClass<string>>> ();
			Serialize (genlist);
			Assert.AreEqual (Infoset ("<GenListClassOfGenListClassOfInnerClassOfInt32Int32String xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><somelist></somelist></GenListClassOfGenListClassOfInnerClassOfInt32Int32String>"), WriterText);

			GenListClass<GenNestedClass<int, int>.InnerClass<string>> inlist1 =
				new GenListClass<GenNestedClass<int, int>.InnerClass<string>> ();
			GenNestedClass<int, int>.InnerClass<string> inval1 = new GenNestedClass<int, int>.InnerClass<string> ();
			inval1.inner = 1;
			inval1.something = "ONE";
			inlist1.somelist.Add (inval1);
			GenNestedClass<int, int>.InnerClass<string> inval2 = new GenNestedClass<int, int>.InnerClass<string> ();
			inval2.inner = 2;
			inval2.something = "TWO";
			inlist1.somelist.Add (inval2);
			GenListClass<GenNestedClass<int, int>.InnerClass<string>> inlist2 =
				new GenListClass<GenNestedClass<int, int>.InnerClass<string>> ();
			GenNestedClass<int, int>.InnerClass<string> inval3 = new GenNestedClass<int, int>.InnerClass<string> ();
			inval3.inner = 30;
			inval3.something = "THIRTY";
			inlist2.somelist.Add (inval3);
			genlist.somelist.Add (inlist1);
			genlist.somelist.Add (inlist2);

			Serialize (genlist);
			Assert.AreEqual (Infoset ("<GenListClassOfGenListClassOfInnerClassOfInt32Int32String xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><somelist><GenListClassOfInnerClassOfInt32Int32String><somelist><InnerClassOfInt32Int32String><inner>1</inner><something>ONE</something></InnerClassOfInt32Int32String><InnerClassOfInt32Int32String><inner>2</inner><something>TWO</something></InnerClassOfInt32Int32String></somelist></GenListClassOfInnerClassOfInt32Int32String><GenListClassOfInnerClassOfInt32Int32String><somelist><InnerClassOfInt32Int32String><inner>30</inner><something>THIRTY</something></InnerClassOfInt32Int32String></somelist></GenListClassOfInnerClassOfInt32Int32String></somelist></GenListClassOfGenListClassOfInnerClassOfInt32Int32String>"), WriterText);
		}
Example #2
0
		public void TestSerializeGenNestedClass ()
		{
			GenNestedClass<string, int>.InnerClass<bool> nested =
				new GenNestedClass<string, int>.InnerClass<bool> ();
			Serialize (nested);
			Assert.AreEqual (Infoset ("<InnerClassOfStringInt32Boolean xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><inner>0</inner><something>false</something></InnerClassOfStringInt32Boolean>"), WriterText);

			nested.inner = 5;
			nested.something = true;

			Serialize (nested);
			Assert.AreEqual (Infoset ("<InnerClassOfStringInt32Boolean xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><inner>5</inner><something>true</something></InnerClassOfStringInt32Boolean>"), WriterText);
		}