Exemple #1
0
        public override IEnumerable <ConvertTest> ConvertToTestData()
        {
            CultureInfo        polandCulture = new CultureInfo("pl-PL");
            DateTimeFormatInfo formatInfo    = CultureInfo.CurrentCulture.DateTimeFormat;
            TimeOnly           timeOnly      = new TimeOnly(10, 30, 50);

            yield return(ConvertTest.Valid(timeOnly, timeOnly.ToString(formatInfo.ShortTimePattern)));

            yield return(ConvertTest.Valid(timeOnly, timeOnly.ToString(polandCulture.DateTimeFormat.ShortTimePattern, polandCulture.DateTimeFormat))
                         .WithRemoteInvokeCulture(polandCulture));

            yield return(ConvertTest.Valid(timeOnly, "10:30", CultureInfo.InvariantCulture));


            yield return(ConvertTest.Valid(TimeOnly.MinValue, string.Empty));

            yield return(ConvertTest.Valid(
                             new TimeOnly(),
                             new InstanceDescriptor(typeof(TimeOnly).GetConstructor(new Type[] { typeof(long) }), new object[] { (long)0 })
                             ));

            yield return(ConvertTest.Valid(
                             timeOnly,
                             new InstanceDescriptor(
                                 typeof(TimeOnly).GetConstructor(new Type[] { typeof(int), typeof(int), typeof(int), typeof(int), typeof(int) }),
                                 new object[] { 10, 30, 50, 0, 0 }
                                 )
                             ));

            yield return(ConvertTest.CantConvertTo(new TimeOnly(), typeof(TimeOnly)));

            yield return(ConvertTest.CantConvertTo(new TimeOnly(), typeof(int)));
        }
        public override IEnumerable <ConvertTest> ConvertFromTestData()
        {
            yield return(ConvertTest.Valid(string.Empty, CultureInfo.InvariantCulture, CultureInfo.InvariantCulture));

            yield return(ConvertTest.Valid("nl-BE", new CultureInfo("nl-BE"), CultureInfo.InvariantCulture));

            yield return(ConvertTest.Valid("(Default)", CultureInfo.InvariantCulture, CultureInfo.InvariantCulture));

            CultureInfo culture = null;

            try
            {
                culture = new CultureInfo("nl--B");
            }
            catch { }

            if (culture != null)
            {
                yield return(ConvertTest.Valid("nl-B", new CultureInfo("nl--B"), CultureInfo.InvariantCulture));

                yield return(ConvertTest.Valid("nl-B", new CultureInfo("nl--B"), new CultureInfo("en-US")));
            }
            if (PlatformDetection.IsNotBrowser)
            {
                yield return(ConvertTest.Valid("Afrikaans", new CultureInfo("af")));
            }

            yield return(ConvertTest.CantConvertFrom(CultureInfo.CurrentCulture));

            yield return(ConvertTest.CantConvertFrom(1));

            yield return(ConvertTest.CantConvertFrom(new object()));
        }
        public override IEnumerable <ConvertTest> ConvertFromTestData()
        {
            yield return(ConvertTest.Valid("1", (ushort)1));

            yield return(ConvertTest.Valid("#2", (ushort)2));

            yield return(ConvertTest.Valid(" #2 ", (ushort)2));

            yield return(ConvertTest.Valid("0x3", (ushort)3));

            yield return(ConvertTest.Valid("0X3", (ushort)3));

            yield return(ConvertTest.Valid(" 0X3 ", (ushort)3));

            yield return(ConvertTest.Valid("&h4", (ushort)4));

            yield return(ConvertTest.Valid("&H4", (ushort)4));

            yield return(ConvertTest.Valid(" &H4 ", (ushort)4));

            yield return(ConvertTest.Valid("+5", (ushort)5));

            yield return(ConvertTest.Valid(" +5 ", (ushort)5));

            yield return(ConvertTest.Valid("!1", (ushort)1, new CustomPositiveSymbolCulture()));

            yield return(ConvertTest.Throws <ArgumentException, Exception>("-1"));

            yield return(ConvertTest.Throws <ArgumentException, Exception>("65536"));

            foreach (ConvertTest test in base.ConvertFromTestData())
            {
                yield return(test);
            }
        }
Exemple #4
0
        public override IEnumerable <ConvertTest> ConvertFromTestData()
        {
            yield return(ConvertTest.Valid("1", (short)1));

            yield return(ConvertTest.Valid(" -1 ", (short)-1));

            yield return(ConvertTest.Valid("#2", (short)2));

            yield return(ConvertTest.Valid(" #2 ", (short)2));

            yield return(ConvertTest.Valid("0x3", (short)3));

            yield return(ConvertTest.Valid("0X3", (short)3));

            yield return(ConvertTest.Valid(" 0X3 ", (short)3));

            yield return(ConvertTest.Valid("&h4", (short)4));

            yield return(ConvertTest.Valid("&H4", (short)4));

            yield return(ConvertTest.Valid(" &H4 ", (short)4));

            yield return(ConvertTest.Valid("+5", (short)5));

            yield return(ConvertTest.Valid(" +5 ", (short)5));

            yield return(ConvertTest.Throws <ArgumentException, Exception>("32768"));

            yield return(ConvertTest.Throws <ArgumentException, Exception>("-32769"));

            foreach (ConvertTest test in base.ConvertFromTestData())
            {
                yield return(test);
            }
        }
        public override IEnumerable <ConvertTest> ConvertToTestData()
        {
            var component = new TestComponent();

            // No Context.
            yield return(ConvertTest.Valid(null, "(none)").WithInvariantRemoteInvokeCulture());;
            yield return(ConvertTest.Valid(null, "(none)").WithContext(null).WithInvariantRemoteInvokeCulture());;
            yield return(ConvertTest.Valid(string.Empty, string.Empty).WithContext(null));

            // IReferenceCollection.
            var referenceService = new TestReferenceService();

            referenceService.AddReference("reference name", component);
            var contextWithReferenceService = new TestTypeDescriptorContext(referenceService);

            yield return(ConvertTest.Valid(component, "reference name").WithContext(contextWithReferenceService));

            yield return(ConvertTest.Valid(new Component(), string.Empty).WithContext(contextWithReferenceService));

            // IContainer.
            var container = new Container();

            container.Add(component, "reference name");
            var contextWithContainer = new TestTypeDescriptorContext {
                Container = container
            };

            yield return(ConvertTest.Valid(component, "reference name").WithContext(contextWithContainer));

            yield return(ConvertTest.Valid(new Component(), string.Empty).WithContext(contextWithContainer));

            yield return(ConvertTest.CantConvertTo(1, typeof(int)));
        }
        public override IEnumerable <ConvertTest> ConvertToTestData()
        {
            CultureInfo        polandCulture = new CultureInfo("pl-PL");
            DateTimeFormatInfo formatInfo    = CultureInfo.CurrentCulture.DateTimeFormat;
            DateOnly           dateOnly      = new DateOnly(1998, 12, 5);

            yield return(ConvertTest.Valid(dateOnly, dateOnly.ToString(formatInfo.ShortDatePattern)));

            yield return(ConvertTest.Valid(dateOnly, dateOnly.ToString(polandCulture.DateTimeFormat.ShortDatePattern, polandCulture.DateTimeFormat))
                         .WithRemoteInvokeCulture(polandCulture));

            yield return(ConvertTest.Valid(dateOnly, "1998-12-05", CultureInfo.InvariantCulture)
                         .WithRemoteInvokeCulture(polandCulture));

            yield return(ConvertTest.Valid(DateOnly.MinValue, string.Empty));

            yield return(ConvertTest.Valid(
                             dateOnly,
                             new InstanceDescriptor(
                                 typeof(DateOnly).GetConstructor(new Type[] { typeof(int), typeof(int), typeof(int) }),
                                 new object[] { 1998, 12, 5 }
                                 )
                             ));

            yield return(ConvertTest.CantConvertTo(new DateOnly(), typeof(DateOnly)));

            yield return(ConvertTest.CantConvertTo(new DateOnly(), typeof(int)));
        }
        public override IEnumerable <ConvertTest> ConvertFromTestData()
        {
            yield return(ConvertTest.Valid("1", (decimal)1));

            yield return(ConvertTest.Valid(1.1.ToString(), 1.1m));

            yield return(ConvertTest.Valid(" -1 ", (decimal) - 1));

            yield return(ConvertTest.Valid("+5", (decimal)5));

            yield return(ConvertTest.Valid(" +5 ", (decimal)5));

            yield return(ConvertTest.Throws <ArgumentException, Exception>("#2"));

            yield return(ConvertTest.Throws <ArgumentException, Exception>(" #2 "));

            yield return(ConvertTest.Throws <ArgumentException, Exception>("0x3"));

            yield return(ConvertTest.Throws <ArgumentException>("0X3"));

            yield return(ConvertTest.Throws <ArgumentException>(" 0X3 "));

            yield return(ConvertTest.Throws <ArgumentException>("&h4"));

            yield return(ConvertTest.Throws <ArgumentException>("&H4"));

            yield return(ConvertTest.Throws <ArgumentException>(" &H4 "));

            foreach (ConvertTest test in base.ConvertFromTestData())
            {
                yield return(test);
            }
        }
        public override IEnumerable <ConvertTest> ConvertFromTestData()
        {
            yield return(ConvertTest.Valid("1", (long)1));

            yield return(ConvertTest.Valid(" -1 ", (long)-1));

            yield return(ConvertTest.Valid("#2", (long)2));

            yield return(ConvertTest.Valid(" #2 ", (long)2));

            yield return(ConvertTest.Valid("0x3", (long)3));

            yield return(ConvertTest.Valid("0X3", (long)3));

            yield return(ConvertTest.Valid(" 0X3 ", (long)3));

            yield return(ConvertTest.Valid("&h4", (long)4));

            yield return(ConvertTest.Valid("&H4", (long)4));

            yield return(ConvertTest.Valid(" &H4 ", (long)4));

            yield return(ConvertTest.Valid("+5", (long)5));

            yield return(ConvertTest.Valid(" +5 ", (long)5));

            yield return(ConvertTest.Throws <ArgumentException, Exception>("9223372036854775808"));

            yield return(ConvertTest.Throws <ArgumentException, Exception>("-9223372036854775809"));

            foreach (ConvertTest test in base.ConvertFromTestData())
            {
                yield return(test);
            }
        }
Exemple #9
0
        public override IEnumerable <ConvertTest> ConvertFromTestData()
        {
            yield return(ConvertTest.Valid("1", (Int128)1));

            yield return(ConvertTest.Valid(" -1 ", (Int128)(-1)));

            yield return(ConvertTest.Valid("#2", (Int128)2));

            yield return(ConvertTest.Valid(" #2 ", (Int128)2));

            yield return(ConvertTest.Valid("0x3", (Int128)3));

            yield return(ConvertTest.Valid("0X3", (Int128)3));

            yield return(ConvertTest.Valid(" 0X3 ", (Int128)3));

            yield return(ConvertTest.Valid("&h4", (Int128)4));

            yield return(ConvertTest.Valid("&H4", (Int128)4));

            yield return(ConvertTest.Valid(" &H4 ", (Int128)4));

            yield return(ConvertTest.Valid("+5", (Int128)5));

            yield return(ConvertTest.Valid(" +5 ", (Int128)5));

            yield return(ConvertTest.Throws <ArgumentException, Exception>("170141183460469231731687303715884105728"));

            yield return(ConvertTest.Throws <ArgumentException, Exception>("-170141183460469231731687303715884105729"));

            foreach (ConvertTest test in base.ConvertFromTestData())
            {
                yield return(test);
            }
        }
Exemple #10
0
        public override IEnumerable <ConvertTest> ConvertFromTestData()
        {
            yield return(ConvertTest.Valid("1", (UInt128)1));

            yield return(ConvertTest.Valid("#2", (UInt128)2));

            yield return(ConvertTest.Valid(" #2 ", (UInt128)2));

            yield return(ConvertTest.Valid("0x3", (UInt128)3));

            yield return(ConvertTest.Valid("0X3", (UInt128)3));

            yield return(ConvertTest.Valid(" 0X3 ", (UInt128)3));

            yield return(ConvertTest.Valid("&h4", (UInt128)4));

            yield return(ConvertTest.Valid("&H4", (UInt128)4));

            yield return(ConvertTest.Valid(" &H4 ", (UInt128)4));

            yield return(ConvertTest.Valid("+5", (UInt128)5));

            yield return(ConvertTest.Valid(" +5 ", (UInt128)5));

            yield return(ConvertTest.Valid("!1", (UInt128)1, new CustomPositiveSymbolCulture()));

            yield return(ConvertTest.Throws <ArgumentException, Exception>("-1"));

            yield return(ConvertTest.Throws <ArgumentException, Exception>("340282366920938463463374607431768211456"));

            foreach (ConvertTest test in base.ConvertFromTestData())
            {
                yield return(test);
            }
        }
        public override IEnumerable <ConvertTest> ConvertFromTestData()
        {
            yield return(ConvertTest.Valid("1", 1));

            yield return(ConvertTest.Valid(" -1 ", -1));

            yield return(ConvertTest.Valid("#2", 2));

            yield return(ConvertTest.Valid(" #2 ", 2));

            yield return(ConvertTest.Valid("0x3", 3));

            yield return(ConvertTest.Valid("0X3", 3));

            yield return(ConvertTest.Valid(" 0X3 ", 3));

            yield return(ConvertTest.Valid("&h4", 4));

            yield return(ConvertTest.Valid("&H4", 4));

            yield return(ConvertTest.Valid(" &H4 ", 4));

            yield return(ConvertTest.Valid("+5", 5));

            yield return(ConvertTest.Valid(" +5 ", 5));

            yield return(ConvertTest.Throws <ArgumentException, Exception>("2147483648"));

            yield return(ConvertTest.Throws <ArgumentException, Exception>("-2147483649"));

            foreach (ConvertTest test in base.ConvertFromTestData())
            {
                yield return(test);
            }
        }
        public override IEnumerable <ConvertTest> ConvertToTestData()
        {
            yield return(ConvertTest.Valid((short)-1, "-1"));

            yield return(ConvertTest.Valid((short)2, (short)2, CultureInfo.InvariantCulture));

            yield return(ConvertTest.Valid((short)3, (float)3.0));
        }
Exemple #13
0
        public override IEnumerable <ConvertTest> ConvertToTestData()
        {
            yield return(ConvertTest.Valid((UInt128)1, "1"));

            yield return(ConvertTest.CantConvertTo((UInt128)3, typeof(InstanceDescriptor)));

            yield return(ConvertTest.CantConvertTo((UInt128)3, typeof(object)));
        }
Exemple #14
0
        public override IEnumerable <ConvertTest> ConvertToTestData()
        {
            yield return(ConvertTest.Valid((Int128)(-1), "-1"));

            yield return(ConvertTest.Valid((Int128)(-1), "?1", new CustomPositiveSymbolCulture()));

            yield return(ConvertTest.CantConvertTo((Int128)3, typeof(InstanceDescriptor)));

            yield return(ConvertTest.CantConvertTo((Int128)3, typeof(object)));
        }
Exemple #15
0
        public override IEnumerable <ConvertTest> ConvertToTestData()
        {
            yield return(ConvertTest.Valid(true, Boolean.TrueString));

            yield return(ConvertTest.Valid(1, "1"));

            yield return(ConvertTest.CantConvertTo(true, typeof(bool)));

            yield return(ConvertTest.CantConvertTo(true, typeof(InstanceDescriptor)));

            yield return(ConvertTest.CantConvertTo(true, typeof(object)));
        }
Exemple #16
0
        public override IEnumerable <ConvertTest> ConvertToTestData()
        {
            yield return(ConvertTest.Valid(new int[] { 1, 2 }, "Int32[] Array").WithInvariantRemoteInvokeCulture());

            yield return(ConvertTest.Valid(1, "1"));

            yield return(ConvertTest.CantConvertTo(new int[] { 1, 2 }, typeof(int[])));

            yield return(ConvertTest.CantConvertTo(new int[] { 1, 2 }, typeof(InstanceDescriptor)));

            yield return(ConvertTest.CantConvertTo(new int[] { 1, 2 }, typeof(object)));
        }
        public override IEnumerable <ConvertTest> ConvertToTestData()
        {
            yield return(ConvertTest.Valid((ushort)1, "1"));

            yield return(ConvertTest.Valid((ushort)2, (ushort)2, CultureInfo.InvariantCulture));

            yield return(ConvertTest.Valid((ushort)3, (float)3.0));

            yield return(ConvertTest.CantConvertTo((ushort)3, typeof(InstanceDescriptor)));

            yield return(ConvertTest.CantConvertTo((ushort)3, typeof(object)));
        }
Exemple #18
0
        public override IEnumerable <ConvertTest> ConvertFromTestData()
        {
            yield return(ConvertTest.Valid("false  ", false));

            yield return(ConvertTest.Valid("true", true, CultureInfo.InvariantCulture));

            yield return(ConvertTest.Throws <FormatException>("1"));

            yield return(ConvertTest.CantConvertFrom(1));

            yield return(ConvertTest.CantConvertFrom(null));
        }
Exemple #19
0
        public override IEnumerable <ConvertTest> ConvertToTestData()
        {
            yield return(ConvertTest.Valid(new CustomCollection(), "(Collection)").WithInvariantRemoteInvokeCulture());

            yield return(ConvertTest.Valid(1, "1"));

            yield return(ConvertTest.CantConvertTo(new CustomCollection(), typeof(CustomCollection)));

            yield return(ConvertTest.CantConvertTo(new CustomCollection(), typeof(InstanceDescriptor)));

            yield return(ConvertTest.CantConvertTo(new CustomCollection(), typeof(object)));
        }
Exemple #20
0
        public override IEnumerable <ConvertTest> ConvertFromTestData()
        {
            yield return(ConvertTest.Valid("string", "string"));

            yield return(ConvertTest.Valid(string.Empty, string.Empty));

            yield return(ConvertTest.Valid(null, string.Empty));

            yield return(ConvertTest.CantConvertFrom(1));

            yield return(ConvertTest.CantConvertFrom(new object()));
        }
Exemple #21
0
        public override IEnumerable <ConvertTest> ConvertToTestData()
        {
            yield return(ConvertTest.Valid((short)-1, "-1"));

            yield return(ConvertTest.Valid((short)2, (short)2, CultureInfo.InvariantCulture));

            yield return(ConvertTest.Valid((short)3, (float)3.0));

            yield return(ConvertTest.Valid((short)-1, "?1", new CustomPositiveSymbolCulture()));

            yield return(ConvertTest.CantConvertTo((short)3, typeof(InstanceDescriptor)));

            yield return(ConvertTest.CantConvertTo((short)3, typeof(object)));
        }
        public override IEnumerable <ConvertTest> ConvertToTestData()
        {
            yield return(ConvertTest.Valid('a', "a"));

            yield return(ConvertTest.Valid('\u20AC', "\u20AC", CultureInfo.InvariantCulture));

            yield return(ConvertTest.Valid('\0', string.Empty));

            yield return(ConvertTest.CantConvertTo('a', typeof(char)));

            yield return(ConvertTest.CantConvertTo('a', typeof(InstanceDescriptor)));

            yield return(ConvertTest.CantConvertTo('a', typeof(object)));
        }
        public override IEnumerable <ConvertTest> ConvertFromTestData()
        {
            yield return(ConvertTest.Valid("  a  ", 'a'));

            yield return(ConvertTest.Valid("    ", '\0'));

            yield return(ConvertTest.Valid("", '\0'));

            yield return(ConvertTest.Throws <FormatException>("aa"));

            yield return(ConvertTest.CantConvertFrom(1));

            yield return(ConvertTest.CantConvertFrom(null));
        }
Exemple #24
0
        public override IEnumerable <ConvertTest> ConvertFromTestData()
        {
            yield return(ConvertTest.Valid(" {30da92c0-23e8-42a0-ae7c-734a0e5d2782}", new Guid(0x30da92c0, 0x23e8, 0x42a0, 0xae, 0x7c, 0x73, 0x4a, 0x0e, 0x5d, 0x27, 0x82)));

            yield return(ConvertTest.Valid("{30da92c0-23e8-42a0-ae7c-734a0e5d2782}", new Guid(0x30da92c0, 0x23e8, 0x42a0, 0xae, 0x7c, 0x73, 0x4a, 0x0e, 0x5d, 0x27, 0x82)));

            yield return(ConvertTest.Valid(" \t\r\n {30da92c0-23e8-42a0-ae7c-734a0e5d2782} \t\r\n ", new Guid(0x30da92c0, 0x23e8, 0x42a0, 0xae, 0x7c, 0x73, 0x4a, 0x0e, 0x5d, 0x27, 0x82)));

            yield return(ConvertTest.Throws <FormatException>(""));

            yield return(ConvertTest.Throws <FormatException>("invalid"));

            yield return(ConvertTest.CantConvertFrom(1));

            yield return(ConvertTest.CantConvertFrom(new object()));
        }
        public override IEnumerable <ConvertTest> ConvertFromTestData()
        {
            yield return(ConvertTest.Valid("  1000.00:00:00  ", new TimeSpan(1000, 0, 0, 0, 0), CultureInfo.InvariantCulture));

            yield return(ConvertTest.Valid("1000", new TimeSpan(1000, 0, 0, 0, 0)));

            yield return(ConvertTest.Throws <FormatException>("invalid"));

            yield return(ConvertTest.Throws <FormatException>("  "));

            yield return(ConvertTest.Throws <FormatException>(string.Empty));

            yield return(ConvertTest.CantConvertFrom(1));

            yield return(ConvertTest.CantConvertFrom(new object()));
        }
        public override IEnumerable <ConvertTest> ConvertToTestData()
        {
            var timeSpan = new TimeSpan(1000, 0, 0, 0, 0);

            yield return(ConvertTest.Valid(timeSpan, timeSpan.ToString()));

            yield return(ConvertTest.Valid(
                             timeSpan,
                             new InstanceDescriptor(
                                 typeof(TimeSpan).GetMethod(nameof(TimeSpan.Parse), new Type[] { typeof(string) }),
                                 new object[] { timeSpan.ToString() }
                                 )
                             ));

            yield return(ConvertTest.CantConvertTo(new TimeSpan(1000, 0, 0, 0, 0), typeof(object)));
        }
Exemple #27
0
        public override IEnumerable <ConvertTest> ConvertToTestData()
        {
            const string GuidString = "30da92c0-23e8-42a0-ae7c-734a0e5d2782";

            yield return(ConvertTest.Valid(new Guid(0x30da92c0, 0x23e8, 0x42a0, 0xae, 0x7c, 0x73, 0x4a, 0x0e, 0x5d, 0x27, 0x82), GuidString));

            yield return(ConvertTest.Valid(
                             new Guid(0x30da92c0, 0x23e8, 0x42a0, 0xae, 0x7c, 0x73, 0x4a, 0x0e, 0x5d, 0x27, 0x82),
                             new InstanceDescriptor(
                                 typeof(Guid).GetConstructor(new Type[] { typeof(string) }),
                                 new object[] { GuidString }
                                 )
                             ));

            yield return(ConvertTest.CantConvertTo(new Guid(), typeof(Guid)));

            yield return(ConvertTest.CantConvertTo(new Guid(), typeof(int)));
        }
        public override IEnumerable <ConvertTest> ConvertFromTestData()
        {
            // This does actually succeed despite CanConvertFrom returning false.
            ConvertTest noContext = ConvertTest.Valid("reference name", null).WithContext(null);

            noContext.CanConvert = false;
            yield return(noContext);

            // No IReferenceService or IContainer.
            yield return(ConvertTest.Valid("", null));

            yield return(ConvertTest.Valid("   ", null));

            yield return(ConvertTest.Valid("(none)", null).WithInvariantRemoteInvokeCulture());

            yield return(ConvertTest.Valid("nothing", null));

            // IReferenceService.
            var component        = new TestComponent();
            var referenceService = new TestReferenceService();

            referenceService.AddReference("reference name", component);
            var contextWithReferenceCollection = new TestTypeDescriptorContext(referenceService);

            yield return(ConvertTest.Valid("reference name", component).WithContext(contextWithReferenceCollection));

            yield return(ConvertTest.Valid("no such reference", null).WithContext(contextWithReferenceCollection));

            // IContainer.
            var container = new Container();

            container.Add(component, "reference name");
            var contextWithContainer = new TestTypeDescriptorContext {
                Container = container
            };

            yield return(ConvertTest.Valid("reference name", component).WithContext(contextWithContainer));

            yield return(ConvertTest.Valid("no such reference", null).WithContext(contextWithContainer));

            yield return(ConvertTest.CantConvertFrom(1));

            yield return(ConvertTest.CantConvertFrom(new object()));
        }
        public override IEnumerable <ConvertTest> ConvertToTestData()
        {
            yield return(ConvertTest.Valid((decimal) - 1, "-1"));

            yield return(ConvertTest.Valid(1.1m, 1.1m.ToString()));

            yield return(ConvertTest.Valid(3.3m, (float)3.3));

            yield return(ConvertTest.Valid((decimal) - 1, "?1", new CustomPositiveSymbolCulture()));

            yield return(ConvertTest.Valid((decimal)3, new InstanceDescriptor(
                                               typeof(decimal).GetConstructor(new Type[] { typeof(int[]) }),
                                               new object[] { new int[] { 3, 0, 0, 0 } }
                                               )));

            yield return(ConvertTest.CantConvertTo((decimal)3, typeof(decimal)));

            yield return(ConvertTest.CantConvertTo((decimal)3, typeof(object)));
        }
        public override IEnumerable <ConvertTest> ConvertFromTestData()
        {
            DateTime date = new DateTime(1998, 12, 5);

            yield return(ConvertTest.Valid("", DateTime.MinValue));

            yield return(ConvertTest.Valid("    ", DateTime.MinValue));

            yield return(ConvertTest.Valid(date.ToString(), date));

            yield return(ConvertTest.Valid(date.ToString(CultureInfo.InvariantCulture.DateTimeFormat), date, CultureInfo.InvariantCulture));

            yield return(ConvertTest.Valid(" " + date.ToString(CultureInfo.InvariantCulture.DateTimeFormat) + " ", date, CultureInfo.InvariantCulture));

            yield return(ConvertTest.Throws <FormatException>("invalid"));

            yield return(ConvertTest.CantConvertFrom(new object()));

            yield return(ConvertTest.CantConvertFrom(1));
        }