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