File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 11using System ;
2+ using System . Runtime . CompilerServices ;
23using Moq ;
34using Unity ;
45using Unity . Exceptions ;
56using Unity . Injection ;
67using Unity . Lifetime ;
78using Xunit ;
89
10+ [ assembly: InternalsVisibleTo ( "LazyProxy.DynamicTypes" ) ]
11+
912namespace LazyProxy . Unity . Tests
1013{
1114 public class UnityExtensionTests
@@ -57,6 +60,16 @@ public Service2()
5760 public string Method ( string arg ) => "service2->" + arg ;
5861 }
5962
63+ internal interface IInternalService
64+ {
65+ string Get ( ) ;
66+ }
67+
68+ internal class InternalService : IInternalService
69+ {
70+ public string Get ( ) => "InternalService" ;
71+ }
72+
6073 [ Fact ]
6174 public void ServiceCtorMustBeExecutedAfterMethodIsCalledAndOnlyOnce ( )
6275 {
@@ -281,5 +294,16 @@ public void RegistrationMustThrowAnExceptionForNonInterfaces()
281294 {
282295 Assert . Throws < NotSupportedException > ( ( ) => new UnityContainer ( ) . RegisterLazy < Service1 , Service1 > ( ) ) ;
283296 }
297+
298+ [ Fact ]
299+ public void InternalsVisibleToAttributeMustAllowToResolveInternalServices ( )
300+ {
301+ var result = new UnityContainer ( )
302+ . RegisterLazy < IInternalService , InternalService > ( )
303+ . Resolve < IInternalService > ( )
304+ . Get ( ) ;
305+
306+ Assert . Equal ( "InternalService" , result ) ;
307+ }
284308 }
285309}
You can’t perform that action at this time.
0 commit comments