Ejemplo n.º 1
0
        public void ConvertFrom_negative()
        {
            Int32RectConverter r  = new Int32RectConverter();
            object             or = r.ConvertFrom("1, 2, -4, -5");

            Assert.AreEqual(typeof(Int32Rect), or.GetType());
            Assert.AreEqual(new Int32Rect(1, 2, -4, -5), or);
        }
Ejemplo n.º 2
0
        public void CanConvertTo()
        {
            Int32RectConverter r = new Int32RectConverter();

            Assert.IsTrue(r.CanConvertTo(typeof(string)));
            Assert.IsFalse(r.CanConvertTo(typeof(Int32Rect)));
            Assert.IsFalse(r.CanConvertTo(typeof(Size)));
        }
Ejemplo n.º 3
0
        public void ConvertTo()
        {
            Int32RectConverter r = new Int32RectConverter();

            Int32Rect rect = new Int32Rect(0, 0, 1, 2);

            object o = r.ConvertTo(rect, typeof(string));

            Assert.AreEqual(typeof(string), o.GetType());
            Assert.AreEqual("0,0,1,2", (string)o);
        }
        public void ConvertTo()
        {
            Int32RectConverter r = new Int32RectConverter();

            Int32Rect rect = new Int32Rect(0, 0, 1, 2);

            object o = r.ConvertTo(null, CultureInfo.InvariantCulture, rect, typeof(string));

            Assert.AreEqual(typeof(string), o.GetType());
            Assert.AreEqual("0,0,1,2", (string)o);
        }
Ejemplo n.º 5
0
        public void ConvertFrom()
        {
            Int32RectConverter r = new Int32RectConverter();

            object or = r.ConvertFrom("1, 2, 3, 4");

            Assert.AreEqual(typeof(Int32Rect), or.GetType());
            Assert.AreEqual(new Int32Rect(1, 2, 3, 4), or);

            or = r.ConvertFrom("Empty");
            Assert.AreEqual(typeof(Int32Rect), or.GetType());
            Assert.IsTrue(((Int32Rect)or).IsEmpty);
        }
Ejemplo n.º 6
0
        public void ConvertFrom_size()
        {
            Int32RectConverter r = new Int32RectConverter();

            r.ConvertFrom(new Size(10, 20));
        }