AddChild() public method

public AddChild ( object child ) : void
child object
return void
Ejemplo n.º 1
0
		public void AddChild ()
		{
			var x = new ArrayExtension ();
			x.AddChild (new object ());
			x.AddChild (5);
			x.AddChild ("test");
		}
Ejemplo n.º 2
0
		public void AddInconsistent ()
		{
			var x = new ArrayExtension (typeof (int));
			Assert.AreEqual (typeof (int), x.Type, "#1");
			// adding inconsistent items is not rejected, while calling ProvideValue() results in an error.
			x.AddChild (new object ());
			Assert.AreEqual (typeof (int), x.Type, "#2");
		}
Ejemplo n.º 3
0
			public TestClass ()
			{
				ArrayMember = new ArrayExtension (typeof (int));
				ArrayMember.AddChild (5);
				ArrayMember.AddChild (3);
				ArrayMember.AddChild (-1);
			}
Ejemplo n.º 4
0
		public void AddInconsistent2 ()
		{
			var x = new ArrayExtension (new int [] {1, 3});
			Assert.AreEqual (typeof (int), x.Type, "#1");
			x.AddChild (new object ());
			Assert.AreEqual (typeof (int), x.Type, "#2");
		}
Ejemplo n.º 5
0
		public void ProvideValueInconsistent ()
		{
			var x = new ArrayExtension (typeof (int));
			x.AddChild (new object ());
			x.ProvideValue (null);
		}
Ejemplo n.º 6
0
		public void ProvideValue ()
		{
			var x = new ArrayExtension (new int [] {1, 3});
			x.AddChild (5);
			Assert.AreEqual (3, x.Items.Count);
			var ret = x.ProvideValue (null);
			Assert.IsNotNull (ret, "#1");
			var arr = ret as int [];
			Assert.IsNotNull (arr, "#2");
			Assert.AreEqual (3, arr.Length, "#3");
			Assert.AreEqual (5, arr [2], "#4");
		}
Ejemplo n.º 7
0
		public void ProvideValueInconsistent2 ()
		{
			var x = new ArrayExtension (new int [] {1, 3});
			x.AddChild (new object ());
			x.AddChild (null); // allowed
			Assert.AreEqual (4, x.Items.Count);
			x.ProvideValue (null);
		}