public void SolveTypeArguments(ClassType t, string methodName, Type connectedType, int parameterIndex) { Type methodDeclaringType = t == ClassType.Plain ? typeof(C) : typeof(D <>); MethodBase m = methodDeclaringType.GetMethod(methodName); TypeHandle[] typeReferences = new TypeHandle[1]; Assume.That(m, Is.Not.Null); Type[] genericTypes = null; GenericsInferenceSolver.SolveTypeArguments(Stencil, m, ref genericTypes, ref typeReferences, connectedType, parameterIndex); Assert.That(genericTypes.Length, Is.EqualTo(1)); Assert.That(typeReferences[0].Resolve(Stencil), Is.EqualTo(typeof(float))); }
public void ConnectingANonGenericParameterDoesntAffectTypeParameters() { Type methodDeclaringType = typeof(C); MethodBase m = methodDeclaringType.GetMethod("I"); TypeHandle[] typeReferences = new TypeHandle[1]; Assume.That(m, Is.Not.Null); Type[] genericTypes = null; GenericsInferenceSolver.SolveTypeArguments(Stencil, m, ref genericTypes, ref typeReferences, typeof(float), 0); GenericsInferenceSolver.SolveTypeArguments(Stencil, m, ref genericTypes, ref typeReferences, typeof(int), 1); Assert.That(genericTypes.Length, Is.EqualTo(1)); Assert.That(typeReferences[0].Resolve(Stencil), Is.EqualTo(typeof(float))); }