using System;
using System.Reflection;
namespace SQLToNeo.Tests{
public class PrivateTestClass
{
public static Object GetField( object instance, String name )
{
Type t = instance.GetType();
FieldInfo f = t.GetField( name, BindingFlags.Instance
| BindingFlags.NonPublic
| BindingFlags.Public );
return f.GetValue( instance );
}
public static Object ExecuteMethod( object instance, String name, params object[] paramList )
{
Type t = instance.GetType();
Type[] paramTypes = new Type[ paramList.Length ];
for ( int i = 0; i < paramList.Length; i++ )
paramTypes[i] = paramList[i].GetType();
MethodInfo m = t.GetMethod( name, BindingFlags.Instance
| BindingFlags.NonPublic
| BindingFlags.Public,
null,
paramTypes,
null );
return m.Invoke( instance, paramList );
}
}
}
|