/src/UnitTests/Finders/MethodFinderTests.cs
C# | 29 lines | 26 code | 3 blank | 0 comment | 1 complexity | 53e4436419c30caa7ed429f1b3ea5ef6 MD5 | raw file
1using System.Linq; 2using System.Reflection; 3using LinFu.IoC; 4using LinFu.IoC.Configuration; 5using LinFu.IoC.Configuration.Interfaces; 6using Xunit; 7using SampleLibrary.IOC; 8 9namespace LinFu.UnitTests.Finders 10{ 11 public class MethodFinderTests 12 { 13 [Fact] 14 public void ShouldFindGenericMethod() 15 { 16 var container = new ServiceContainer(); 17 container.LoadFromBaseDirectory("*.dll"); 18 19 var context = new MethodFinderContext(new[] {typeof(object)}, new object[0], typeof(void)); 20 var methods = 21 typeof(SampleClassWithGenericMethod).GetMethods(BindingFlags.Public | BindingFlags.Instance); 22 var finder = container.GetService<IMethodFinder<MethodInfo>>(); 23 var result = finder.GetBestMatch(methods, context); 24 25 Assert.True(result.IsGenericMethod); 26 Assert.True(result.GetGenericArguments().Count() == 1); 27 } 28 } 29}