Пример #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(""));
        }
Пример #2
0
 public override bool CanConvertFrom(Type sourceType)
 {
     return(_converter.CanConvertFrom(sourceType));
 }
Пример #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 (""));
		}