using System; using System.Reflection; using MbUnit.Framework; namespace MbUnit.ReSharperRunner.MbUnit.Tests { [TestFixture] public class ReflectionUtilityFixture { [Test] public void FindMethodTest1() { Type type = GetType(); MethodInfo mi = type.GetMethod("TestPattern1"); MethodInfo result = ReflectionUtility.FindMethod(type, "TestPattern1"); Assert.AreNotEqual(mi, result); } [Test] public void FindMethodTest2() { Type type = GetType(); MethodInfo mi = type.GetMethod("TestPattern2", new Type[] {typeof(int), typeof(int)}); MethodInfo result = ReflectionUtility.FindMethod(type, "TestPattern2(System.Int32 a, System.Int32 s)"); Assert.AreEqual(mi, result); } [Test] public void FindMethodTest3a() { Type type = GetType(); MethodInfo mi = type.GetMethod("TestPattern2", new Type[] {typeof(int), typeof(string)}); MethodInfo result = ReflectionUtility.FindMethod(type, "TestPattern2(System.Int32 a, System.String b)"); Assert.AreEqual(mi, result); } [Test] public void FindMethodTest3b() { Type type = Type.GetType("MbUnit.ReSharperRunner.MbUnit.ReflectionUtility, MbUnit.ReSharper3", true); MethodInfo mi = type.GetMethod("FindMethod", new Type[] {typeof(Type), typeof(string)}); MethodInfo result = ReflectionUtility.FindMethod( "MbUnit.ReSharperRunner.MbUnit.ReflectionUtility.FindMethod(System.Type a, System.String b)"); Assert.AreEqual(mi, result); } [Test] public void FindMethodTest3c() { Type type = Type.GetType("MbUnit.ReSharperRunner.MbUnit.ReflectionUtility, MbUnit.ReSharper3", true); MethodInfo mi = type.GetMethod("FindMethod", new Type[] {typeof(Type), typeof(string)}); MethodInfo result = ReflectionUtility.FindMethod( "MbUnit.ReSharperRunner.MbUnit.ReflectionUtility.FindMethod(System.Type, System.String)"); Assert.AreEqual(mi, result); } public void TestPattern1(int a, int b) {} public void TestPattern2(int a, String b) {} public void TestPattern2(int a, int c) {} public void TestPattern3() {} } }