/src/UnitTests/Finders/MethodFinderTests.cs
http://github.com/philiplaureano/LinFu · C# · 29 lines · 26 code · 3 blank · 0 comment · 1 complexity · 53e4436419c30caa7ed429f1b3ea5ef6 MD5 · raw file
- using System.Linq;
- using System.Reflection;
- using LinFu.IoC;
- using LinFu.IoC.Configuration;
- using LinFu.IoC.Configuration.Interfaces;
- using Xunit;
- using SampleLibrary.IOC;
- namespace LinFu.UnitTests.Finders
- {
- public class MethodFinderTests
- {
- [Fact]
- public void ShouldFindGenericMethod()
- {
- var container = new ServiceContainer();
- container.LoadFromBaseDirectory("*.dll");
- var context = new MethodFinderContext(new[] {typeof(object)}, new object[0], typeof(void));
- var methods =
- typeof(SampleClassWithGenericMethod).GetMethods(BindingFlags.Public | BindingFlags.Instance);
- var finder = container.GetService<IMethodFinder<MethodInfo>>();
- var result = finder.GetBestMatch(methods, context);
- Assert.True(result.IsGenericMethod);
- Assert.True(result.GetGenericArguments().Count() == 1);
- }
- }
- }