Ejemplo n.º 1
0
        public static void ConvertTo_WithContext()
        {
            RemoteInvoke(() =>
            {
                CultureInfo.CurrentCulture = new CultureInfo("pl-PL");

                Assert.Throws <ArgumentNullException>(
                    () => TypeConverterTests.s_converter.ConvertTo(TypeConverterTests.s_context, null, TypeConverterTests.c_conversionInputValue, null));

                Assert.Throws <NotSupportedException>(
                    () => TypeConverterTests.s_converter.ConvertTo(TypeConverterTests.s_context, null, TypeConverterTests.c_conversionInputValue, typeof(int)));

                object o = TypeConverterTests.s_converter.ConvertTo(
                    TypeConverterTests.s_context, null, TypeConverterTests.c_conversionInputValue, typeof(string));
                TypeConverterTests.VerifyConversionToString(o);

                o = TypeConverterTests.s_converter.ConvertTo(
                    TypeConverterTests.s_context, CultureInfo.CurrentCulture, TypeConverterTests.c_conversionInputValue, typeof(string));
                TypeConverterTests.VerifyConversionToString(o);

                o = TypeConverterTests.s_converter.ConvertTo(
                    TypeConverterTests.s_context, CultureInfo.InvariantCulture, TypeConverterTests.c_conversionInputValue, typeof(string));
                TypeConverterTests.VerifyConversionToString(o);

                string s = TypeConverterTests.s_converter.ConvertTo(
                    TypeConverterTests.s_context, CultureInfo.InvariantCulture, new FormattableClass(), typeof(string)) as string;
                Assert.NotNull(s);
                Assert.Equal(FormattableClass.Token, s);
                return(SuccessExitCode);
            }).Dispose();
        }
Ejemplo n.º 2
0
        public static void ConvertToString_WithContext()
        {
            object o = TypeConverterTests.s_converter.ConvertToString(
                TypeConverterTests.s_context, null, TypeConverterTests.c_conversionInputValue);

            TypeConverterTests.VerifyConversionToString(o);
        }
Ejemplo n.º 3
0
        public static void ConvertToInvariantString()
        {
            object o = TypeConverterTests.s_converter.ConvertToInvariantString(
                TypeConverterTests.c_conversionInputValue);

            TypeConverterTests.VerifyConversionToString(o);
        }
Ejemplo n.º 4
0
        public static void ConvertTo_string()
        {
            object o = TypeConverterTests.s_converter.ConvertTo(TypeConverterTests.c_conversionInputValue, typeof(string));

            TypeConverterTests.VerifyConversionToString(o);
        }