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); }
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); }
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); }
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); }
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); }
private static IEnumerable <LabelledMatrixEntry2D> GetInner(VolatilitySurfaceData volatilitySurfaceData) { return(GenericUtils.Call <IEnumerable <LabelledMatrixEntry2D> >(typeof(GenericVolatilitySurfaceCell), "GetInner", typeof(VolatilitySurfaceData <,>), volatilitySurfaceData)); }
private static Pair Build(object first, object second) { return((Pair)GenericUtils.Call(GenericBuildMethod, new[] { GetType(first.GetType()), GetType(second.GetType()) }, first, second)); }
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 })); }