public ProvideValue ( IServiceProvider provider ) : object | ||
provider | IServiceProvider | |
Résultat | object |
public void ProvideValueEmpty () { var x = new ArrayExtension (typeof (int)); x.ProvideValue (null); // allowed. }
public void ProvideValueWithoutType () { var x = new ArrayExtension (); x.ProvideValue (null); // Type must be set first. }
public void ProvideValueInconsistent () { var x = new ArrayExtension (typeof (int)); x.AddChild (new object ()); x.ProvideValue (null); }
public void ProvideValueInconsistent3 () { var x = new ArrayExtension (new int [] {1, 3}); x.AddText ("test"); 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); }