public void ConvertFrom_Throws()
        {
            MarginsConverter mc      = new MarginsConverter();
            CultureInfo      culture = CultureInfo.InvariantCulture;

            // try once with then once without context
            for (var context = new MyTypeDescriptorContext(); context != null; context = null)
            {
                Assert.Throws <NotSupportedException>(() => mc.ConvertFrom(context, null, null));
                Assert.Throws <NotSupportedException>(() => mc.ConvertFrom(context, culture, null));
                Assert.Throws <NotSupportedException>(() => mc.ConvertFrom(context, culture, Guid.NewGuid()));
                AssertExtensions.Throws <ArgumentException, Exception>(() => mc.ConvertFrom(context, null, "wrong string format"));
                AssertExtensions.Throws <ArgumentException, Exception>(() => mc.ConvertFrom(context, culture, "wrong string format"));
            }
        }
        public void ConvertFrom()
        {
            MarginsConverter mc      = new MarginsConverter();
            CultureInfo      culture = CultureInfo.InvariantCulture;

            // try once with then once without context
            for (var context = new MyTypeDescriptorContext(); context != null; context = null)
            {
                object result;
                Assert.Equal(',', culture.TextInfo.ListSeparator[0]);
                AssertExtensions.Throws <ArgumentException, Exception>(() => mc.ConvertFrom(context, culture, "1;2;3;4"));
                result = mc.ConvertFrom(context, culture, "1,2,3,4");
                Assert.IsType <Margins>(result);
                Margins margins = result as Margins;
                Assert.Equal(1, margins.Left);
                Assert.Equal(2, margins.Right);
                Assert.Equal(3, margins.Top);
                Assert.Equal(4, margins.Bottom);
            }
        }