public void InstantiateTest() { IReflector reflector = new Reflector(); string className = "UserTests"; object instantiatedObj = reflector.Instantiate(className); Assert.IsTrue(instantiatedObj != null); }
public void InvokeMethodTest() { IReflector reflector = new Reflector(); string className = "UserTests"; string methodName = "GetUserTest"; object instance = reflector.Instantiate(className); MethodInfo method = instance.GetType().GetMethod(methodName); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); IMethodResult result = reflector.InvokeMethod(className, method); stopwatch.Stop(); Console.WriteLine("Time: " + stopwatch.Elapsed); if (result.Exception != null) Console.WriteLine(result.Exception); Assert.IsTrue(result.Exception == null); }