File tree Expand file tree Collapse file tree 4 files changed +42
-1
lines changed
Ninject.Extensions.Interception.Test
Ninject.Extensions.Interception/Advice Expand file tree Collapse file tree 4 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 1+ namespace Ninject . Extensions . Interception . Fakes
2+ {
3+ public interface ISameNameMethod
4+ {
5+ void Foo ( ) ;
6+
7+ void Foo < T > ( ) ;
8+
9+ void Foo < T1 , T2 > ( ) ;
10+ }
11+ }
Original file line number Diff line number Diff line change 1+ namespace Ninject . Extensions . Interception . Fakes
2+ {
3+ public class SameNameMethod : ISameNameMethod
4+ {
5+ public void Foo ( )
6+ {
7+ }
8+
9+ public void Foo < T > ( )
10+ {
11+ }
12+
13+ public void Foo < T1 , T2 > ( )
14+ {
15+ }
16+ }
17+ }
Original file line number Diff line number Diff line change @@ -328,6 +328,18 @@ public void SelfBoundTypesDeclaringInterceptorsOnGenericMethodsAreIntercepted()
328328 }
329329 }
330330
331+ [ Fact ]
332+ public void SameNameMethodAreIntercepted ( )
333+ {
334+ using ( var kernel = CreateDefaultInterceptionKernel ( ) )
335+ {
336+ kernel . Bind < ISameNameMethod > ( ) . To < SameNameMethod > ( ) . Intercept ( ) . With < CountInterceptor > ( ) ;
337+ var obj = kernel . Get < ISameNameMethod > ( ) ;
338+
339+ new Action ( ( ) => obj . Foo < IFoo > ( ) ) . ShouldNotThrow < InvalidOperationException > ( ) ;
340+ }
341+ }
342+
331343 [ Fact ]
332344 public void SelfBoundTypesDeclaringMethodInterceptorsCanBeReleased ( )
333345 {
Original file line number Diff line number Diff line change @@ -150,7 +150,8 @@ private bool MatchesMethodPredicate(IProxyRequest request)
150150 requestMethod = request . Target . GetType ( )
151151 . GetMethods ( BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Instance )
152152 . SingleOrDefault ( mi => mi . Name == requestMethod . Name &&
153- mi . GetParameters ( ) . SequenceEqual ( requestMethod . GetParameters ( ) ) )
153+ mi . GetParameters ( ) . SequenceEqual ( requestMethod . GetParameters ( ) ) &&
154+ mi . GetGenericArguments ( ) . SequenceEqual ( requestMethod . GetGenericArguments ( ) ) )
154155 ?? requestMethod ;
155156 }
156157
You can’t perform that action at this time.
0 commit comments