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); }
public void ConvertFromInvalidSource() { new Action(() => _converter.ConvertFrom(null)).ShouldThrow <NotSupportedException>().WithMessage("*null*"); new Action(() => _converter.ConvertFrom(new object())).ShouldThrow <NotSupportedException>().WithMessage($"*{typeof(object)}*"); }
public void ConvertFrom_negative() { RectConverter r = new RectConverter(); r.ConvertFrom("1, 2, -4, -5"); }
public void ConvertFrom_size() { RectConverter r = new RectConverter(); r.ConvertFrom(new Size(10, 20)); }