Esempio n. 1
0
        public void ConvertFrom()
        {
            RectConverter r = new RectConverter();

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

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

            or = r.ConvertFrom("Empty");
            Assert.AreEqual(typeof(Rect), or.GetType());
            Assert.IsTrue(((Rect)or).IsEmpty);
        }
Esempio n. 2
0
 public void ConvertFromInvalidSource()
 {
     new Action(() => _converter.ConvertFrom(null)).ShouldThrow <NotSupportedException>().WithMessage("*null*");
     new Action(() => _converter.ConvertFrom(new object())).ShouldThrow <NotSupportedException>().WithMessage($"*{typeof(object)}*");
 }
Esempio n. 3
0
        public void ConvertFrom_negative()
        {
            RectConverter r = new RectConverter();

            r.ConvertFrom("1, 2, -4, -5");
        }
Esempio n. 4
0
        public void ConvertFrom_size()
        {
            RectConverter r = new RectConverter();

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