public void ConvertFrom_TypeError () { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter (); object o; o = cv.ConvertFrom (null, null, 59); Assert.IsNull (o, "A1"); }
public void CanConvertTo () { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter (); Assert.IsTrue (cv.CanConvertTo (null, typeof (string)), "A1"); Assert.IsFalse (cv.CanConvertTo (null, typeof (TimeSpan)), "A2"); Assert.IsFalse (cv.CanConvertTo (null, typeof (int)), "A3"); Assert.IsFalse (cv.CanConvertTo (null, typeof (object)), "A4"); }
public void ConvertFrom () { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter (); object o; CommaDelimitedStringCollection col; o = cv.ConvertFrom (null, null, "hi,bye"); Assert.AreEqual (typeof (CommaDelimitedStringCollection), o.GetType(), "A1"); col = (CommaDelimitedStringCollection)o; Assert.AreEqual (2, col.Count, "A2"); Assert.AreEqual ("hi", col[0], "A3"); Assert.AreEqual ("bye", col[1], "A4"); col = (CommaDelimitedStringCollection)cv.ConvertFrom (null, null, "hi, bye"); Assert.AreEqual (2, col.Count, "A5"); Assert.AreEqual ("hi", col[0], "A6"); Assert.AreEqual ("bye", col[1], "A7"); }
public void ConvertTo () { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter (); CommaDelimitedStringCollection col = new CommaDelimitedStringCollection(); col.Add ("hi"); col.Add ("bye"); Assert.AreEqual ("hi,bye", cv.ConvertTo (null, null, col, typeof (string)), "A1"); }
public void ConvertTo_TypeError () { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter (); Assert.AreEqual ("59", cv.ConvertTo (null, null, 59, typeof (string)), "A1"); }