Ejemplo n.º 1
0
		public void TestTypeConverter ()
		{
			var converter = new LayoutOptionsConverter ();
			Assert.True (converter.CanConvertFrom (typeof(string)));
			Assert.AreEqual (LayoutOptions.Center, converter.ConvertFromInvariantString ("LayoutOptions.Center"));
			Assert.AreEqual (LayoutOptions.Center, converter.ConvertFromInvariantString ("Center"));
			Assert.AreNotEqual (LayoutOptions.CenterAndExpand, converter.ConvertFromInvariantString ("Center"));
			Assert.Throws<InvalidOperationException> (() => converter.ConvertFromInvariantString ("foo"));
			Assert.Throws<InvalidOperationException> (() => converter.ConvertFromInvariantString ("foo.bar"));
			Assert.Throws<InvalidOperationException> (() => converter.ConvertFromInvariantString ("foo.bar.baz"));
		}
Ejemplo n.º 2
0
        public void TestTypeConverter()
        {
            var converter = new LayoutOptionsConverter();

            Assert.True(converter.CanConvertFrom(typeof(string)));
            Assert.AreEqual(LayoutOptions.Center, converter.ConvertFromInvariantString("LayoutOptions.Center"));
            Assert.AreEqual(LayoutOptions.Center, converter.ConvertFromInvariantString("Center"));
            Assert.AreNotEqual(LayoutOptions.CenterAndExpand, converter.ConvertFromInvariantString("Center"));
            Assert.Throws <InvalidOperationException>(() => converter.ConvertFromInvariantString("foo"));
            Assert.Throws <InvalidOperationException>(() => converter.ConvertFromInvariantString("foo.bar"));
            Assert.Throws <InvalidOperationException>(() => converter.ConvertFromInvariantString("foo.bar.baz"));
        }
Ejemplo n.º 3
0
 public override bool CanConvertFrom(Type sourceType)
 {
     return(_converter.CanConvertFrom(sourceType));
 }