AddChild() 공개 메소드

public AddChild ( object child ) : void
child object
리턴 void
예제 #1
0
		public void AddChild ()
		{
			var x = new ArrayExtension ();
			x.AddChild (new object ());
			x.AddChild (5);
			x.AddChild ("test");
		}
예제 #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");
		}
예제 #3
0
			public TestClass ()
			{
				ArrayMember = new ArrayExtension (typeof (int));
				ArrayMember.AddChild (5);
				ArrayMember.AddChild (3);
				ArrayMember.AddChild (-1);
			}
예제 #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");
		}
예제 #5
0
		public void ProvideValueInconsistent ()
		{
			var x = new ArrayExtension (typeof (int));
			x.AddChild (new object ());
			x.ProvideValue (null);
		}
예제 #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");
		}
예제 #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);
		}