public void ConvertTo_MinValue()
 {
     Assert.AreEqual(String.Empty, converter.ConvertTo(null,
                                                       CultureInfo.InvariantCulture, DateTimeOffset.MinValue, typeof(string)), "#A1");
     Assert.AreEqual(String.Empty, converter.ConvertTo(null,
                                                       CultureInfo.CurrentCulture, DateTimeOffset.MinValue, typeof(string)), "#A2");
     Assert.AreEqual(String.Empty, converter.ConvertTo(DateTimeOffset.MinValue,
                                                       typeof(string)), "#A3");
 }
Exemple #2
0
        /// <summary>
        /// Extends ConvertTo so that methods that return a specific type object given a Type parameter can be
        /// used as generic method and casting is not required.
        /// <example>
        /// typeconverter.ConvertTo&lt;int&gt;(value);
        /// </example>
        /// </summary>
        public static T ConvertTo <T>(this DateTimeOffsetConverter typeconverter, Object value)
        {
            if (typeconverter == null)
            {
                throw new ArgumentNullException("typeconverter");
            }

            return((T)typeconverter.ConvertTo(value, typeof(T)));
        }
Exemple #3
0
        /// <summary>
        /// Extends ConvertTo so that methods that return a specific type object given a Type parameter can be
        /// used as generic method and casting is not required.
        /// <example>
        /// datetimeoffsetconverter.ConvertTo&lt;int&gt;(context, culture, value);
        /// </example>
        /// </summary>
        public static T ConvertTo <T>(this DateTimeOffsetConverter datetimeoffsetconverter, ITypeDescriptorContext context, System.Globalization.CultureInfo culture, Object value)
        {
            if (datetimeoffsetconverter == null)
            {
                throw new ArgumentNullException("datetimeoffsetconverter");
            }

            return((T)datetimeoffsetconverter.ConvertTo(context, culture, value, typeof(T)));
        }