Beispiel #1
0
        public void Should_Convert_String_To_LongNullable()
        {
            var v1 = ConvertEx.ConvertTo("3", typeof(long?));
            var v2 = ConvertEx.Convert <long?>("3");

            Assert.True(v1 is long l1 && l1 == 3);
            Assert.True(v2 == 3);
        }
Beispiel #2
0
        public void Should_Convert_Int_To_Long()
        {
            var v1 = ConvertEx.ConvertTo(3, typeof(long));
            var v2 = ConvertEx.Convert <long>(3);

            Assert.True(v1 is long l1 && l1 == 3);
            Assert.True(v2 == 3);
        }
Beispiel #3
0
        public void Should_Convert_IntNullable_To_LongNullable()
        {
            int?i = 3;

            var v1 = ConvertEx.ConvertTo(i, typeof(long?));
            var v2 = ConvertEx.Convert <long?>(i);

            Assert.True(v1 is long l1 && l1 == 3);
            Assert.True(v2 == 3);
        }
Beispiel #4
0
 public T Get <T>(object instance, object indexer1, object indexer2, object indexer3)
 {
     return(ConvertEx.Convert <T>(Get(instance, indexer1, indexer2, indexer3)));
 }
Beispiel #5
0
 public T Get <T>(object instance, object[] indexers)
 {
     return(ConvertEx.Convert <T>(Get(instance, indexers)));
 }
Beispiel #6
0
 public T Get <T>(bool allowPrivate = false)
 {
     return(ConvertEx.Convert <T>(Get(null, allowPrivate)));
 }
Beispiel #7
0
 public T Get <T>(object instance)
 {
     return(ConvertEx.Convert <T>(Get(instance)));
 }
Beispiel #8
0
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            var formatProvider = FormatProvider ?? CultureInfo.InvariantCulture;

            return(ConvertEx.Convert(_value, _type, formatProvider));
        }