コード例 #1
0
        public void RectangleTypeConverterConstructor()
        {
            tlog.Debug(tag, $"RectangleTypeConverterConstructor START");

            var testingTarget = new RectangleTypeConverter();

            Assert.IsNotNull(testingTarget, "Can't create success object RectangleTypeConverter.");


            Assert.IsNotNull(testingTarget.ConvertFromInvariantString("1,2,3,4"), "Should not be null");
            Assert.IsNotNull(testingTarget.ConvertToString(new Rectangle(1, 2, 3, 4)), "Should not be null");
            Assert.IsNull(testingTarget.ConvertToString(null), "Should be null");

            Assert.Throws <InvalidOperationException>(() => testingTarget.ConvertFromInvariantString(null));

            tlog.Debug(tag, $"RectangleTypeConverterConstructor END");
        }
コード例 #2
0
 public override object ConvertFrom(object o)
 {
     return(_converter.ConvertFromInvariantString(o as string));
 }