@@ -9,11 +9,13 @@ public class LazyProxyBuilderTests
9
9
{
10
10
public interface IBaseArgument { }
11
11
12
+ public interface IOtherBaseArgument { }
13
+
12
14
public abstract class BaseArgument : IBaseArgument { }
13
15
14
16
public abstract class BaseArgument2 { }
15
17
16
- public struct TestArgument : IBaseArgument { }
18
+ public struct TestArgument : IBaseArgument , IOtherBaseArgument { }
17
19
18
20
// ReSharper disable once MemberCanBePrivate.Global
19
21
public class TestArgument2 : BaseArgument { }
@@ -44,6 +46,10 @@ public interface ITestService : IParentTestService
44
46
string MethodWithDefaultValue ( string arg = "arg" ) ;
45
47
string MethodWithOutValue ( out string arg ) ;
46
48
string MethodWithRefValue ( ref TestArgument arg ) ;
49
+
50
+ void GenericMethod < T > ( )
51
+ where T : IBaseArgument , IOtherBaseArgument { }
52
+
47
53
string GenericMethod < T1 , T2 , T3 > ( string arg )
48
54
where T1 : class , IBaseArgument , new ( )
49
55
where T2 : struct
@@ -76,7 +82,7 @@ public void ProxyMustImplementInterface()
76
82
public void ExceptionMustBeThrownForBuildingProxyByClass ( )
77
83
{
78
84
Assert . Throws < NotSupportedException > (
79
- ( ) => LazyProxyBuilder . GetType < AbstractTestService > ( ) ) ;
85
+ LazyProxyBuilder . GetType < AbstractTestService > ) ;
80
86
}
81
87
82
88
[ Fact ]
@@ -407,5 +413,12 @@ public void GenericInterfaceWithDifferentTypeParametersMustBeCreatedWithoutExcep
407
413
408
414
Assert . Null ( exception ) ;
409
415
}
416
+
417
+ [ Fact ]
418
+ public void GenericMethodWithMultipleInterfaceConstraintsMustBeProxied ( )
419
+ {
420
+ var proxy = LazyProxyBuilder . CreateInstance ( Mock . Of < ITestService > ) ;
421
+ proxy . GenericMethod < TestArgument > ( ) ;
422
+ }
410
423
}
411
424
}
0 commit comments