Esempio n. 1
0
        public void TestPointTypeConverter()
        {
            var converter = new PointTypeConverter();

            Assert.True(converter.CanConvertFrom(typeof(string)));
            Assert.AreEqual(new Point(1, 2), converter.ConvertFromInvariantString("1,2"));
            Assert.AreEqual(new Point(1, 2), converter.ConvertFromInvariantString("1, 2"));
            Assert.AreEqual(new Point(1, 2), converter.ConvertFromInvariantString(" 1 , 2 "));
            Assert.AreEqual(new Point(1.1, 2), converter.ConvertFromInvariantString("1.1,2"));
            Assert.Throws <InvalidOperationException> (() => converter.ConvertFromInvariantString(""));
        }
Esempio n. 2
0
 public override bool CanConvertFrom(Type sourceType)
 {
     return(_converter.CanConvertFrom(sourceType));
 }
Esempio n. 3
0
		public void TestPointTypeConverter ()
		{
			var converter = new PointTypeConverter ();
			Assert.True (converter.CanConvertFrom (typeof(string)));
			Assert.AreEqual (new Point (1, 2), converter.ConvertFromInvariantString ("1,2"));
			Assert.AreEqual (new Point (1, 2), converter.ConvertFromInvariantString ("1, 2"));
			Assert.AreEqual (new Point (1, 2), converter.ConvertFromInvariantString (" 1 , 2 "));
			Assert.AreEqual (new Point (1.1, 2), converter.ConvertFromInvariantString ("1.1,2"));
			Assert.Throws<InvalidOperationException> (()=>converter.ConvertFromInvariantString (""));
		}