コード例 #1
0
        public void CallEquatableVP()
        {
            var x   = ValueProperties.All;
            var obj = GenericUtils.Call(typeof(GenericUtilsTest), "EquatableMethod", typeof(IEquatable <>), x);
            var y   = (ValueProperties)obj;

            Assert.Equal(x, y);
        }
コード例 #2
0
        public void CallEquatable()
        {
            var x   = new EquatableType("x");
            var obj = GenericUtils.Call(typeof(GenericUtilsTest), "EquatableMethod", typeof(IEquatable <>), x);

            Assert.IsType(typeof(EquatableType), obj);
            var y = (EquatableType)obj;

            Assert.Equal(x.ID, y.ID);
        }
コード例 #3
0
        public void CallOneArg()
        {
            var x   = new GenericOneArgType <string>("X");
            var obj = GenericUtils.Call(typeof(GenericUtilsTest), "GenericMethodOneArg", typeof(GenericOneArgType <>), x);

            Assert.IsType(typeof(GenericOneArgType <string>), obj);
            var y = (GenericOneArgType <string>)obj;

            Assert.Equal(x.A, y.A);
        }
コード例 #4
0
        public void CallTwoArg()
        {
            var x   = new GenericTwoArgType <string, int>("X", 1);
            var obj = GenericUtils.Call(typeof(GenericUtilsTest), "GenericMethodTwoArg", typeof(GenericTwoArgType <,>), x);

            Assert.IsType(typeof(GenericTwoArgType <string, int>), obj);
            var y = (GenericTwoArgType <string, int>)obj;

            Assert.Equal(x.A, y.A);
            Assert.Equal(x.B, y.B);
        }
コード例 #5
0
ファイル: Proxy.cs プロジェクト: vazapple/OG-DotNet
 private static void CheckEqualityIfAppropriate(object hydratedObject, Type mappedType)
 {
     try
     {
         Console.Error.WriteLine(@"Trying to check equality for {0}", hydratedObject.GetType());
         GenericUtils.Call(typeof(Proxy), "MatchedEquality", typeof(IEquatable <>), hydratedObject);
     }
     catch (ArgumentException e)
     {
         Console.Error.WriteLine(@"Can't check equality for {0} {1}", hydratedObject.GetType(), e.Message);
         return;
     }
     GenericUtils.Call(typeof(Proxy), "CheckEquality", typeof(IEquatable <>), hydratedObject, mappedType);
 }
コード例 #6
0
 private static IEnumerable <LabelledMatrixEntry2D> GetInner(VolatilitySurfaceData volatilitySurfaceData)
 {
     return(GenericUtils.Call <IEnumerable <LabelledMatrixEntry2D> >(typeof(GenericVolatilitySurfaceCell), "GetInner", typeof(VolatilitySurfaceData <,>), volatilitySurfaceData));
 }
コード例 #7
0
ファイル: Pair.cs プロジェクト: vazapple/OG-DotNet
 private static Pair Build(object first, object second)
 {
     return((Pair)GenericUtils.Call(GenericBuildMethod, new[] { GetType(first.GetType()), GetType(second.GetType()) }, first, second));
 }
コード例 #8
0
 private static VolatilitySurfaceData Build(Type xType, Type yType, string definitionName, string specificationName, Currency currency, string interpolatorName, IList <object> xs, IList <object> ys, Dictionary <Tuple <object, object>, double> values)
 {
     return((VolatilitySurfaceData)GenericUtils.Call(GenericBuildMethod, new[] { xType, yType }, new object[] { definitionName, specificationName, currency, interpolatorName, xs, ys, values }));
 }